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.

99 lines
2.6 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. - name: Add http_proxy to /etc/apt/apt.conf if http_proxy is defined
  24. raw: echo 'Acquire::http::proxy "{{ http_proxy }}";' >> /etc/apt/apt.conf
  25. become: true
  26. environment: {}
  27. when:
  28. - http_proxy is defined
  29. - need_http_proxy.rc != 0
  30. - name: Check https::proxy in apt configuration files
  31. raw: apt-config dump | grep -qsi 'Acquire::https::proxy'
  32. register: need_https_proxy
  33. failed_when: false
  34. changed_when: false
  35. # This command should always run, even in check mode
  36. check_mode: false
  37. environment: {}
  38. when:
  39. - https_proxy is defined
  40. - name: Add https_proxy to /etc/apt/apt.conf if https_proxy is defined
  41. raw: echo 'Acquire::https::proxy "{{ https_proxy }}";' >> /etc/apt/apt.conf
  42. become: true
  43. environment: {}
  44. when:
  45. - https_proxy is defined
  46. - need_https_proxy.rc != 0
  47. - name: Check Network Name Resolution configuration
  48. raw: grep '^DNSSEC=allow-downgrade' /etc/systemd/resolved.conf
  49. register: need_dnssec_allow_downgrade
  50. failed_when: false
  51. changed_when: false
  52. # This command should always run, even in check mode
  53. check_mode: false
  54. environment: {}
  55. when:
  56. - '"bionic" in os_release.stdout'
  57. - name: Change Network Name Resolution configuration
  58. raw: sed -i 's/^DNSSEC=yes/DNSSEC=allow-downgrade/g' /etc/systemd/resolved.conf
  59. become: true
  60. environment: {}
  61. when:
  62. - '"bionic" in os_release.stdout'
  63. - need_dnssec_allow_downgrade.rc
  64. - name: Restart systemd-resolved service
  65. raw: systemctl restart systemd-resolved
  66. become: true
  67. environment: {}
  68. when:
  69. - '"bionic" in os_release.stdout'
  70. - need_dnssec_allow_downgrade.rc
  71. - name: Install python3
  72. raw:
  73. apt-get update && \
  74. DEBIAN_FRONTEND=noninteractive apt-get install -y python3-minimal
  75. become: true
  76. environment: {}
  77. when:
  78. - need_bootstrap.rc != 0
  79. - name: Set the ansible_python_interpreter fact
  80. set_fact:
  81. ansible_python_interpreter: "/usr/bin/python3"
  82. # Workaround for https://github.com/ansible/ansible/issues/25543
  83. - name: Install dbus for the hostname module
  84. package:
  85. name: dbus
  86. state: present
  87. use: apt
  88. become: true