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.

67 lines
1.8 KiB

  1. ---
  2. # Some Debian based distros ship without Python installed
  3. - name: Check if bootstrap is needed
  4. raw: which python
  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: Install python
  48. raw:
  49. apt-get update && \
  50. DEBIAN_FRONTEND=noninteractive apt-get install -y python-minimal
  51. become: true
  52. environment: {}
  53. when:
  54. - need_bootstrap.rc != 0
  55. # Workaround for https://github.com/ansible/ansible/issues/25543
  56. - name: Install dbus for the hostname module
  57. package:
  58. name: dbus
  59. state: present
  60. become: true