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.

65 lines
1.7 KiB

  1. ---
  2. - name: Check if bootstrap is needed
  3. raw: which "{{ item }}"
  4. register: need_bootstrap
  5. failed_when: false
  6. changed_when: false
  7. # This command should always run, even in check mode
  8. check_mode: false
  9. with_items:
  10. - python
  11. - pip
  12. - dbus-daemon
  13. environment: {}
  14. tags: facts
  15. - name: Check http::proxy in /etc/apt/apt.conf
  16. raw: grep -qsi 'Acquire::http::proxy' /etc/apt/apt.conf
  17. register: need_http_proxy
  18. failed_when: false
  19. changed_when: false
  20. # This command should always run, even in check mode
  21. check_mode: false
  22. environment: {}
  23. when:
  24. - http_proxy is defined
  25. - name: Add http_proxy to /etc/apt/apt.conf if http_proxy is defined
  26. raw: echo 'Acquire::http::proxy "{{ http_proxy }}";' >> /etc/apt/apt.conf
  27. become: true
  28. environment: {}
  29. when:
  30. - http_proxy is defined
  31. - need_http_proxy.rc != 0
  32. - name: Check https::proxy in /etc/apt/apt.conf
  33. raw: grep -qsi 'Acquire::https::proxy' /etc/apt/apt.conf
  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. - name: Add https_proxy to /etc/apt/apt.conf if https_proxy is defined
  43. raw: echo 'Acquire::https::proxy "{{ https_proxy }}";' >> /etc/apt/apt.conf
  44. become: true
  45. environment: {}
  46. when:
  47. - https_proxy is defined
  48. - need_https_proxy.rc != 0
  49. - name: Install python, pip, and dbus
  50. raw:
  51. apt-get update && \
  52. DEBIAN_FRONTEND=noninteractive apt-get install -y python-minimal python-pip dbus
  53. become: true
  54. environment: {}
  55. when:
  56. need_bootstrap.results | map(attribute='rc') | sort | last | bool
  57. - set_fact:
  58. ansible_python_interpreter: "/usr/bin/python"
  59. tags: facts