blob: bd5e94b4382ad8cb2a114492a236cd52f570f201 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
---
# input_variables:
# - repoquery_cmd
# - openshift.common.service_type
# output_variables:
# - openshift_rpm_version
# if {{ openshift.common.service_type}}-excluder is enabled,
# the repoquery for {{ openshift.common.service_type}} will not work.
# Thus, create a temporary yum,conf file where exclude= is set to an empty list
- name: Create temporary yum.conf file
command: mktemp -d /tmp/yum.conf.XXXXXX
register: yum_conf_temp_file_result
- set_fact:
yum_conf_temp_file: "{{yum_conf_temp_file_result.stdout}}/yum.conf"
- name: Copy yum.conf into the temporary file
copy:
src: /etc/yum.conf
dest: "{{ yum_conf_temp_file }}"
remote_src: True
- name: Clear the exclude= list in the temporary yum.conf
lineinfile:
# since ansible 2.3 s/dest/path
dest: "{{ yum_conf_temp_file }}"
regexp: '^exclude='
line: 'exclude='
- name: Gather common package version
command: >
{{ repoquery_cmd }} --config "{{ yum_conf_temp_file }}" --qf '%{version}' "{{ openshift.common.service_type}}"
register: common_version
failed_when: false
changed_when: false
- name: Delete the temporary yum.conf
file:
path: "{{ yum_conf_temp_file_result.stdout }}"
state: absent
- set_fact:
openshift_rpm_version: "{{ common_version.stdout | default('0.0', True) }}"
|