#122 fix python interpreter on RHEL-8
Merged 6 years ago by astepano. Opened 6 years ago by bgoncalv.
bgoncalv/standard-test-roles test-runner-interpreter  into  master

@@ -19,4 +19,17 @@ 

        {{ ansible_pkg_mgr == 'yum' }}

      is_dnf_os: >

        {{ ansible_pkg_mgr == 'dnf' }}

+     is_rhel8_based: >

+       {{

+           ( ['ansible_distribution'] |

+           intersect(['RedHat', 'CentOS']) | bool ) and

+           ansible_distribution_version|int == 8

+       }}

  

+ # Fix python ansible interpreter when running on RHEL8. Currently RHEL8

+ # uses python2, but it does miss some python2 modules, such as python2-dnf.

+ # This can be removed once RHEL8 uses by default Python3

+ - name: Hardcode Python interpreter for ansible modules on RHEL8 based OS

+   set_fact:

+     ansible_python_interpreter: /usr/bin/env python3

+     when: is_rhel8_based

@@ -16,6 +16,23 @@ 

          {{ hostvars[test_runner_inventory_name]['ansible_pkg_mgr'] == 'yum' }}

        is_dnf_os: >

          {{ hostvars[test_runner_inventory_name]['ansible_pkg_mgr'] == 'dnf' }}

+       is_rhel8_based: >

+         {{

+           ( [hostvars[test_runner_inventory_name]['ansible_distribution']] |

+           intersect(['RedHat', 'CentOS']) | bool )

+           and

+           ( hostvars[test_runner_inventory_name]['ansible_distribution_version'] |

+           int == 8 )

+         }}

+ 

+   # Fix python ansible interpreter when running on RHEL8. Currently RHEL8

+   # uses python2, but it does miss some python2 modules, such as python2-dnf.

+   # This can be removed once RHEL8 uses by default Python 3.

+   - name: Hardcode Python interpreter for ansible modules on RHEL8 based OS

+     delegate_facts: True

+     set_fact:

+       ansible_python_interpreter: /usr/bin/env python3

+       when: "hostvars[test_runner_inventory_name]['is_rhel8_based'] | bool"

  

    - name: Fetch tests from remote repositories

      git:
@@ -43,3 +60,9 @@ 

        {{ test_runner_inventory_name }} uses dnf:

        {{ hostvars[test_runner_inventory_name]['is_dnf_os'] }}

      verbosity: 1

+ 

+ - debug:

+     msg: >

+       {{ test_runner_inventory_name }} is RHEL8 based OS:

+       {{ hostvars[test_runner_inventory_name]['is_rhel8_based'] }}

+     verbosity: 1

I have suspicious that this line is not correct. I need to do some investigation.

  1. Please duplicate this code to 'trunner.yml' (use hostvars for duplicated code).
  2. Please change variable name from is_rhel8 to is_rhel8_based

Metadata Update from @astepano:
- Request assigned

6 years ago

fixes #120

rebased onto 74e43c6f730940638128b4872f21437e7257db93

6 years ago

rebased onto 74091c0257fb84df507ed6c14cf57215d31f360c

6 years ago

rebased onto a2cfa397189da80b0a113e6d2d1bd18b92f8a28c

6 years ago

rebased onto 33056c1989d222e7df166cb0127db34a1b51d98e

6 years ago

rebased onto 9a790f5016c437c2ba506b43485d155a86dcd2d9

6 years ago

rebased onto bf383c0

6 years ago

Commit 0f12f05 fixes this pull-request

Pull-Request has been merged by astepano

6 years ago

Pull-Request has been merged by astepano

6 years ago