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.

61 lines
1.5 KiB

  1. ---
  2. # OpenSUSE ships with Python installed
  3. - name: Check that /etc/sysconfig/proxy file exists
  4. stat:
  5. path: /etc/sysconfig/proxy
  6. get_attributes: no
  7. get_checksum: no
  8. get_mime: no
  9. register: stat_result
  10. - name: Create the /etc/sysconfig/proxy empty file
  11. file: # noqa risky-file-permissions
  12. path: /etc/sysconfig/proxy
  13. state: touch
  14. when:
  15. - http_proxy is defined or https_proxy is defined
  16. - not stat_result.stat.exists
  17. - name: Set the http_proxy in /etc/sysconfig/proxy
  18. lineinfile:
  19. path: /etc/sysconfig/proxy
  20. regexp: '^HTTP_PROXY='
  21. line: 'HTTP_PROXY="{{ http_proxy }}"'
  22. become: true
  23. when:
  24. - http_proxy is defined
  25. - name: Set the https_proxy in /etc/sysconfig/proxy
  26. lineinfile:
  27. path: /etc/sysconfig/proxy
  28. regexp: '^HTTPS_PROXY='
  29. line: 'HTTPS_PROXY="{{ https_proxy }}"'
  30. become: true
  31. when:
  32. - https_proxy is defined
  33. - name: Enable proxies
  34. lineinfile:
  35. path: /etc/sysconfig/proxy
  36. regexp: '^PROXY_ENABLED='
  37. line: 'PROXY_ENABLED="yes"'
  38. become: true
  39. when:
  40. - http_proxy is defined or https_proxy is defined
  41. # Required for zypper module
  42. - name: Install python-xml
  43. shell: zypper refresh && zypper --non-interactive install python-xml
  44. changed_when: false
  45. become: true
  46. tags:
  47. - facts
  48. # Without this package, the get_url module fails when trying to handle https
  49. - name: Install python-cryptography
  50. zypper:
  51. name: python-cryptography
  52. state: present
  53. update_cache: true
  54. become: true