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.

58 lines
1.4 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. register: stat_result
  7. - name: Create the /etc/sysconfig/proxy empty file
  8. file:
  9. path: /etc/sysconfig/proxy
  10. state: touch
  11. when:
  12. - http_proxy is defined or https_proxy is defined
  13. - not stat_result.stat.exists
  14. - name: Set the http_proxy in /etc/sysconfig/proxy
  15. lineinfile:
  16. path: /etc/sysconfig/proxy
  17. regexp: '^HTTP_PROXY='
  18. line: 'HTTP_PROXY="{{ http_proxy }}"'
  19. become: true
  20. when:
  21. - http_proxy is defined
  22. - name: Set the https_proxy in /etc/sysconfig/proxy
  23. lineinfile:
  24. path: /etc/sysconfig/proxy
  25. regexp: '^HTTPS_PROXY='
  26. line: 'HTTPS_PROXY="{{ https_proxy }}"'
  27. become: true
  28. when:
  29. - https_proxy is defined
  30. - name: Enable proxies
  31. lineinfile:
  32. path: /etc/sysconfig/proxy
  33. regexp: '^PROXY_ENABLED='
  34. line: 'PROXY_ENABLED="yes"'
  35. become: true
  36. when:
  37. - http_proxy is defined or https_proxy is defined
  38. # Required for zypper module
  39. - name: Install python-xml
  40. shell: zypper refresh && zypper --non-interactive install python-xml
  41. changed_when: false
  42. become: true
  43. tags:
  44. - facts
  45. # Without this package, the get_url module fails when trying to handle https
  46. - name: Install python-cryptography
  47. zypper:
  48. name: python-cryptography
  49. state: present
  50. update_cache: true
  51. become: true