From 41da1d8fbcc63bc7807ed8de33647727d8ed4fde Mon Sep 17 00:00:00 2001 From: ace Date: Tue, 24 May 2022 12:34:39 +0300 Subject: [PATCH] move from docker to podman wikijs: bump to v2.5.283, helm chart v2.2.20 --- .../ghp/sample/group_vars/all/versions.yaml | 2 +- roles/ddclient/tasks/podman.yml | 52 +++++++++++++++++++ roles/podman/README.md | 1 + roles/podman/defaults/main.yaml | 2 + roles/podman/meta/main.yaml | 7 +++ roles/podman/tasks/RedHat.yaml | 5 ++ roles/podman/tasks/main.yaml | 3 ++ 7 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 roles/ddclient/tasks/podman.yml create mode 100644 roles/podman/README.md create mode 100644 roles/podman/defaults/main.yaml create mode 100644 roles/podman/meta/main.yaml create mode 100644 roles/podman/tasks/RedHat.yaml create mode 100644 roles/podman/tasks/main.yaml diff --git a/inventory/ghp/sample/group_vars/all/versions.yaml b/inventory/ghp/sample/group_vars/all/versions.yaml index 7fb28e5..6c50343 100644 --- a/inventory/ghp/sample/group_vars/all/versions.yaml +++ b/inventory/ghp/sample/group_vars/all/versions.yaml @@ -60,7 +60,7 @@ rspamd_version: 0.2.0 pypiserver_version: 2.3.0 # WikiJS -wikijs_version: 2.2.19 +wikijs_version: 2.2.20 # PeerTube peertube_version: 0.1.8 diff --git a/roles/ddclient/tasks/podman.yml b/roles/ddclient/tasks/podman.yml new file mode 100644 index 0000000..0a61db0 --- /dev/null +++ b/roles/ddclient/tasks/podman.yml @@ -0,0 +1,52 @@ +--- +- name: Create configuration dir for {{ ddclient_namespace }} + file: + name: "/opt/{{ ddclient_namespace }}" + state: directory + +- name: Copy ddclient configuration for {{ ddclient_namespace }} + copy: + dest: "/opt/{{ ddclient_namespace }}/ddclient.conf" + content: "{{ ddclient_conf }}" + notify: restart docker ddclient + +- name: Copy Kvps.key for {{ ddclient_namespace }} + copy: + dest: "/opt/{{ ddclient_namespace }}/Kvps.key" + content: "{{ ddclient_tsig_public_key_base64 | b64decode }}" + notify: restart podman ddclient + +- name: Copy Kvps.private for {{ ddclient_namespace }} + copy: + dest: "/opt/{{ ddclient_namespace }}/Kvps.private" + content: "{{ ddclient_tsig_private_key_base64 | b64decode }}" + notify: restart podman ddclient + +- name: Start ddclient with podman for {{ ddclient_namespace }} + containers.podman.podman_container: + name: "{{ ddclient_container_name }}" + hostname: "{{ ddclient_container_name }}" + network: "{{ ddclient_network_mode }}" + image: "{{ ddclient_container_registry }}/{{ ddclient_image_name }}:{{ ddclient_image_tag }}" + state: present + volumes: + - "/opt/{{ ddclient_namespace }}/ddclient.conf:/config/ddclient.conf" + - "/opt/{{ ddclient_namespace }}/Kvps.key:/config/Kvps.key" + - "/opt/{{ ddclient_namespace }}/Kvps.private:/config/Kvps.private" + +- name: Generate container systemd unit + shell: "podman generate systemd {{ ddclient_container_name }}" + register: ddclient_systemd_unit + changed_when: False + +- name: Create ddclient systemd unit + copy: + dest: "/etc/systemd/system/{{ ddclient_systemd_unit_name }}" + content: "{{ ddclient_systemd_unit.stdout | regex_replace('^#.*', multiline=True) | trim }}" + +- name: Enable ddclient systemd unit + ansible.builtin.systemd: + name: "{{ ddclient_systemd_unit_name }}" + enabled: yes + state: started + daemon_reload: yes diff --git a/roles/podman/README.md b/roles/podman/README.md new file mode 100644 index 0000000..4da51c1 --- /dev/null +++ b/roles/podman/README.md @@ -0,0 +1 @@ +Install podman. diff --git a/roles/podman/defaults/main.yaml b/roles/podman/defaults/main.yaml new file mode 100644 index 0000000..69895ee --- /dev/null +++ b/roles/podman/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +podman_version: "{{ '1.6.4' if ansible_facts['distribution_major_version'] == '7' else '4.0.2' if ansible_facts['distribution_major_version'] == '8' }}" diff --git a/roles/podman/meta/main.yaml b/roles/podman/meta/main.yaml new file mode 100644 index 0000000..4b319eb --- /dev/null +++ b/roles/podman/meta/main.yaml @@ -0,0 +1,7 @@ +--- +galaxy_info: + description: Podman + galaxy_tags: + - podman + +dependencies: [] diff --git a/roles/podman/tasks/RedHat.yaml b/roles/podman/tasks/RedHat.yaml new file mode 100644 index 0000000..e1d9edf --- /dev/null +++ b/roles/podman/tasks/RedHat.yaml @@ -0,0 +1,5 @@ +--- +- name: Ensure podman {{ podman_version }} installed + yum: + name: "podman-{{ podman_version }}" + state: present diff --git a/roles/podman/tasks/main.yaml b/roles/podman/tasks/main.yaml new file mode 100644 index 0000000..84d4e90 --- /dev/null +++ b/roles/podman/tasks/main.yaml @@ -0,0 +1,3 @@ +--- +- name: Include podman install + include_tasks: "{{ ansible_facts['os_family'] }}.yaml"