2018-04-26 17:52:06 +08:00
|
|
|
---
|
2019-04-24 06:46:02 +08:00
|
|
|
# OpenSUSE ships with Python installed
|
2022-08-15 10:02:13 +08:00
|
|
|
- name: Gather host facts to get ansible_distribution_version ansible_distribution_major_version
|
|
|
|
setup:
|
|
|
|
gather_subset: '!all'
|
|
|
|
filter: ansible_distribution_*version
|
2019-04-09 15:17:05 +08:00
|
|
|
|
2020-04-18 05:23:35 +08:00
|
|
|
- name: Check that /etc/sysconfig/proxy file exists
|
|
|
|
stat:
|
|
|
|
path: /etc/sysconfig/proxy
|
2024-08-28 13:30:56 +08:00
|
|
|
get_attributes: false
|
|
|
|
get_checksum: false
|
|
|
|
get_mime: false
|
2020-04-18 05:23:35 +08:00
|
|
|
register: stat_result
|
|
|
|
|
|
|
|
- name: Create the /etc/sysconfig/proxy empty file
|
2021-07-12 15:00:47 +08:00
|
|
|
file: # noqa risky-file-permissions
|
2020-04-18 05:23:35 +08:00
|
|
|
path: /etc/sysconfig/proxy
|
|
|
|
state: touch
|
|
|
|
when:
|
|
|
|
- http_proxy is defined or https_proxy is defined
|
|
|
|
- not stat_result.stat.exists
|
|
|
|
|
2019-05-03 03:28:22 +08:00
|
|
|
- name: Set the http_proxy in /etc/sysconfig/proxy
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/sysconfig/proxy
|
|
|
|
regexp: '^HTTP_PROXY='
|
|
|
|
line: 'HTTP_PROXY="{{ http_proxy }}"'
|
|
|
|
become: true
|
|
|
|
when:
|
|
|
|
- http_proxy is defined
|
|
|
|
|
|
|
|
- name: Set the https_proxy in /etc/sysconfig/proxy
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/sysconfig/proxy
|
|
|
|
regexp: '^HTTPS_PROXY='
|
|
|
|
line: 'HTTPS_PROXY="{{ https_proxy }}"'
|
|
|
|
become: true
|
|
|
|
when:
|
|
|
|
- https_proxy is defined
|
|
|
|
|
|
|
|
- name: Enable proxies
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/sysconfig/proxy
|
|
|
|
regexp: '^PROXY_ENABLED='
|
|
|
|
line: 'PROXY_ENABLED="yes"'
|
|
|
|
become: true
|
|
|
|
when:
|
|
|
|
- http_proxy is defined or https_proxy is defined
|
|
|
|
|
2020-04-08 22:37:44 +08:00
|
|
|
# Required for zypper module
|
|
|
|
- name: Install python-xml
|
|
|
|
shell: zypper refresh && zypper --non-interactive install python-xml
|
|
|
|
changed_when: false
|
|
|
|
become: true
|
|
|
|
tags:
|
|
|
|
- facts
|
|
|
|
|
2019-04-24 06:46:02 +08:00
|
|
|
# Without this package, the get_url module fails when trying to handle https
|
|
|
|
- name: Install python-cryptography
|
2023-06-26 18:15:45 +08:00
|
|
|
community.general.zypper:
|
2019-04-24 06:46:02 +08:00
|
|
|
name: python-cryptography
|
2018-04-26 17:52:06 +08:00
|
|
|
state: present
|
2019-04-24 06:46:02 +08:00
|
|
|
update_cache: true
|
2019-02-12 06:04:27 +08:00
|
|
|
become: true
|
2022-08-15 10:02:13 +08:00
|
|
|
when:
|
|
|
|
- ansible_distribution_version is version('15.4', '<')
|
|
|
|
|
|
|
|
- name: Install python3-cryptography
|
2023-06-26 18:15:45 +08:00
|
|
|
community.general.zypper:
|
2022-08-15 10:02:13 +08:00
|
|
|
name: python3-cryptography
|
|
|
|
state: present
|
|
|
|
update_cache: true
|
|
|
|
become: true
|
|
|
|
when:
|
|
|
|
- ansible_distribution_version is version('15.4', '>=')
|
2021-12-04 04:20:35 +08:00
|
|
|
|
|
|
|
# Nerdctl needs some basic packages to get an environment up
|
|
|
|
- name: Install basic dependencies
|
2023-06-26 18:15:45 +08:00
|
|
|
community.general.zypper:
|
2021-12-04 04:20:35 +08:00
|
|
|
name:
|
|
|
|
- iptables
|
|
|
|
- apparmor-parser
|
|
|
|
state: present
|
|
|
|
become: true
|