rpm_version.yml 1.3 KB

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