From 29ffe7f8fabf0ff7587d8c5b1a2405efd419a9e3 Mon Sep 17 00:00:00 2001 From: transcaffeine Date: Fri, 4 Oct 2024 17:41:34 +0200 Subject: [PATCH] feat(hydrogen): add deployment method podman --- roles/hydrogen/meta/main.yml | 1 + roles/hydrogen/tasks/deploy-podman.yml | 32 ++++++++++++++++++++++++++ roles/hydrogen/vars/main.yml | 1 + 3 files changed, 34 insertions(+) create mode 100644 roles/hydrogen/tasks/deploy-podman.yml diff --git a/roles/hydrogen/meta/main.yml b/roles/hydrogen/meta/main.yml index 90f95b4..4aaf2d8 100644 --- a/roles/hydrogen/meta/main.yml +++ b/roles/hydrogen/meta/main.yml @@ -9,3 +9,4 @@ galaxy_info: - matrix - matrix-client - docker + - podman diff --git a/roles/hydrogen/tasks/deploy-podman.yml b/roles/hydrogen/tasks/deploy-podman.yml new file mode 100644 index 0000000..e26fc5a --- /dev/null +++ b/roles/hydrogen/tasks/deploy-podman.yml @@ -0,0 +1,32 @@ +--- +- name: Ensure container image '{{ hydrogen_container_image }}' is {{ hydrogen_state }} on host + containers.podman.podman_image: + name: "{{ hydrogen_container_image }}" + state: "{{ hydrogen_state }}" + pull: "{{ hydrogen_container_image_source == 'pull' }}" + force: "{{ hydrogen_container_image_force_source }}" + register: hydrogen_container_image_info + until: hydrogen_container_image_info is success + retries: 5 + delay: 3 + +- name: Ensure hydrogen container '{{ hydrogen_container_name }}' is {{ hydrogen_container_state }} + containers.podman.podman_container: + name: "{{ hydrogen_container_name }}" + image: "{{ hydrogen_container_image }}" + env: "{{ hydrogen_container_env | default(omit, true) }}" + user: "{{ hydrogen_container_user }}" + ports: "{{ hydrogen_container_ports | default(omit, true) }}" + labels: "{{ hydrogen_container_labels | default(omit, true) }}" + ulimits: "{{ hydrogen_container_ulimits | default(omit, true) }}" + volumes: "{{ hydrogen_container_volumes }}" + network: "{{ hydrogen_container_networks | default(omit, true) }}" + purge_networks: >-2 + {{ hydrogen_container_purge_networks | default(omit, true) }} + dns_servers: >-2 + {{ hydrogen_container_dns_servers | default(omit, true) }} + etc_hosts: >-2 + {{ hydrogen_container_etc_hosts | default(omit, true) }} + restart_policy: >-2 + {{ hydrogen_container_restart_policy | default(omit, true) }} + state: "{{ hydrogen_container_state }}" diff --git a/roles/hydrogen/vars/main.yml b/roles/hydrogen/vars/main.yml index de3470c..9149e0c 100644 --- a/roles/hydrogen/vars/main.yml +++ b/roles/hydrogen/vars/main.yml @@ -4,3 +4,4 @@ hydrogen_states: - absent hydrogen_deployment_methods: - docker + - podman