You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.7 KiB

  1. ---
  2. # Some Fedora based distros ship without Python installed
  3. - name: Check if this is an atomic host
  4. raw: stat /run/ostree-booted
  5. register: ostree
  6. environment: {}
  7. failed_when: false
  8. changed_when: false
  9. tags:
  10. - facts
  11. - name: Store the fact if this is an atomic host
  12. set_fact:
  13. is_atomic: "{{ ostree.rc == 0 }}"
  14. tags:
  15. - facts
  16. - name: Check if bootstrap is needed
  17. raw: which python
  18. register: need_bootstrap
  19. failed_when: false
  20. changed_when: false
  21. environment: {}
  22. tags:
  23. - facts
  24. - name: Check if a proxy is set in /etc/dnf/dnf.conf
  25. raw: grep -qs 'proxy=' /etc/dnf/dnf.conf
  26. register: need_http_proxy
  27. failed_when: false
  28. changed_when: false
  29. # This command should always run, even in check mode
  30. check_mode: false
  31. environment: {}
  32. when:
  33. - http_proxy is defined
  34. - name: Add http_proxy to /etc/dnf/dnf.conf if http_proxy is defined
  35. raw: echo 'proxy={{ http_proxy }}' >> /etc/dnf/dnf.conf
  36. become: true
  37. environment: {}
  38. when:
  39. - http_proxy is defined
  40. - need_http_proxy.rc != 0
  41. - not is_atomic
  42. # Fedora's policy as of Fedora 30 is to still install python2 as /usr/bin/python
  43. # See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3 for the current status
  44. - name: Install python on fedora
  45. raw: "dnf install --assumeyes --quiet python2"
  46. become: true
  47. environment: {}
  48. when:
  49. - need_bootstrap.rc != 0
  50. - not is_atomic
  51. # libselinux-python is required on SELinux enabled hosts
  52. # See https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements
  53. - name: Install libselinux-python
  54. package:
  55. name: libselinux-python
  56. state: present
  57. become: true
  58. when:
  59. - not is_atomic