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.

64 lines
1.9 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. tags:
  11. - facts
  12. - name: Check http::proxy in apt configuration files
  13. raw: apt-config dump | grep -qsi 'Acquire::http::proxy'
  14. register: need_http_proxy
  15. failed_when: false
  16. changed_when: false
  17. # This command should always run, even in check mode
  18. check_mode: false
  19. - name: Add http_proxy to /etc/apt/apt.conf if http_proxy is defined
  20. raw: echo 'Acquire::http::proxy "{{ http_proxy }}";' >> /etc/apt/apt.conf
  21. become: true
  22. when:
  23. - http_proxy is defined
  24. - need_http_proxy.rc != 0
  25. - not skip_http_proxy_on_os_packages
  26. - name: Check https::proxy in apt configuration files
  27. raw: apt-config dump | grep -qsi 'Acquire::https::proxy'
  28. register: need_https_proxy
  29. failed_when: false
  30. changed_when: false
  31. # This command should always run, even in check mode
  32. check_mode: false
  33. - name: Add https_proxy to /etc/apt/apt.conf if https_proxy is defined
  34. raw: echo 'Acquire::https::proxy "{{ https_proxy }}";' >> /etc/apt/apt.conf
  35. become: true
  36. when:
  37. - https_proxy is defined
  38. - need_https_proxy.rc != 0
  39. - not skip_http_proxy_on_os_packages
  40. - name: Install python3
  41. raw:
  42. apt-get update && \
  43. DEBIAN_FRONTEND=noninteractive apt-get install -y python3-minimal
  44. become: true
  45. when:
  46. - need_bootstrap.rc != 0
  47. - name: Update Apt cache
  48. raw: apt-get update --allow-releaseinfo-change
  49. become: true
  50. when:
  51. - os_release_dict['ID'] == 'debian'
  52. - os_release_dict['VERSION_ID'] in ["10", "11"]
  53. register: bootstrap_update_apt_result
  54. changed_when:
  55. - '"changed its" in bootstrap_update_apt_result.stdout'
  56. - '"value from" in bootstrap_update_apt_result.stdout'
  57. ignore_errors: true