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.

103 lines
2.8 KiB

  1. ---
  2. # Some Debian based distros ship without Python installed
  3. - name: Check if bootstrap is needed
  4. raw: which python3
  5. register: need_bootstrap
  6. failed_when: false
  7. changed_when: false
  8. # This command should always run, even in check mode
  9. check_mode: false
  10. environment: {}
  11. tags:
  12. - facts
  13. - name: Check http::proxy in apt configuration files
  14. raw: apt-config dump | grep -qsi 'Acquire::http::proxy'
  15. register: need_http_proxy
  16. failed_when: false
  17. changed_when: false
  18. # This command should always run, even in check mode
  19. check_mode: false
  20. environment: {}
  21. when:
  22. - http_proxy is defined
  23. - not skip_http_proxy_on_os_packages
  24. - name: Add http_proxy to /etc/apt/apt.conf if http_proxy is defined
  25. raw: echo 'Acquire::http::proxy "{{ http_proxy }}";' >> /etc/apt/apt.conf
  26. become: true
  27. environment: {}
  28. when:
  29. - http_proxy is defined
  30. - need_http_proxy.rc != 0
  31. - not skip_http_proxy_on_os_packages
  32. - name: Check https::proxy in apt configuration files
  33. raw: apt-config dump | grep -qsi 'Acquire::https::proxy'
  34. register: need_https_proxy
  35. failed_when: false
  36. changed_when: false
  37. # This command should always run, even in check mode
  38. check_mode: false
  39. environment: {}
  40. when:
  41. - https_proxy is defined
  42. - not skip_http_proxy_on_os_packages
  43. - name: Add https_proxy to /etc/apt/apt.conf if https_proxy is defined
  44. raw: echo 'Acquire::https::proxy "{{ https_proxy }}";' >> /etc/apt/apt.conf
  45. become: true
  46. environment: {}
  47. when:
  48. - https_proxy is defined
  49. - need_https_proxy.rc != 0
  50. - not skip_http_proxy_on_os_packages
  51. - name: Check Network Name Resolution configuration
  52. raw: grep '^DNSSEC=allow-downgrade' /etc/systemd/resolved.conf
  53. register: need_dnssec_allow_downgrade
  54. failed_when: false
  55. changed_when: false
  56. # This command should always run, even in check mode
  57. check_mode: false
  58. environment: {}
  59. when:
  60. - '"bionic" in os_release.stdout'
  61. - name: Change Network Name Resolution configuration
  62. raw: sed -i 's/^DNSSEC=yes/DNSSEC=allow-downgrade/g' /etc/systemd/resolved.conf
  63. become: true
  64. environment: {}
  65. when:
  66. - '"bionic" in os_release.stdout'
  67. - need_dnssec_allow_downgrade.rc
  68. - name: Restart systemd-resolved service
  69. raw: systemctl restart systemd-resolved
  70. become: true
  71. environment: {}
  72. when:
  73. - '"bionic" in os_release.stdout'
  74. - need_dnssec_allow_downgrade.rc
  75. - name: Install python3
  76. raw:
  77. apt-get update && \
  78. DEBIAN_FRONTEND=noninteractive apt-get install -y python3-minimal
  79. become: true
  80. environment: {}
  81. when:
  82. - need_bootstrap.rc != 0
  83. - name: Set the ansible_python_interpreter fact
  84. set_fact:
  85. ansible_python_interpreter: "/usr/bin/python3"
  86. # Workaround for https://github.com/ansible/ansible/issues/25543
  87. - name: Install dbus for the hostname module
  88. package:
  89. name: dbus
  90. state: present
  91. use: apt
  92. become: true