diff --git a/scripts/playbooks/deploy-appliers.yml b/scripts/playbooks/deploy-appliers.yml index 863c167..19afc1c 100644 --- a/scripts/playbooks/deploy-appliers.yml +++ b/scripts/playbooks/deploy-appliers.yml @@ -8,6 +8,10 @@ prompt: "The base directory for the container" default: /data private: no + - name: "podman_network" + prompt: "The podman network to use for the container (empty = none)" + default: "" + private: no - name: "patchew_server" prompt: "The address of patchew server" default: "https://patchew.org" diff --git a/scripts/playbooks/deploy-db.yml b/scripts/playbooks/deploy-db.yml index daac7b5..77b2707 100644 --- a/scripts/playbooks/deploy-db.yml +++ b/scripts/playbooks/deploy-db.yml @@ -8,20 +8,19 @@ prompt: "The base directory for the container" default: /data private: no + - name: "podman_network" + prompt: "The podman network to use for the container (empty = none)" + default: "" + private: no vars: base_dir: "{{ container_dir }}/{{ instance_name }}" src_dir: "{{ base_dir }}/src" data_dir: "{{ base_dir }}/data" - podman_run_args: "--net patchew" tasks: - name: Create data dir file: path: "{{ data_dir }}" state: directory - - name: Create podman network - containers.podman.podman_network: - name: patchew - become: true - import_tasks: tasks/podman-deploy.yml vars: instance_role: db diff --git a/scripts/playbooks/deploy-importers-lore.yml b/scripts/playbooks/deploy-importers-lore.yml index ab76ba6..bc054af 100644 --- a/scripts/playbooks/deploy-importers-lore.yml +++ b/scripts/playbooks/deploy-importers-lore.yml @@ -8,6 +8,10 @@ prompt: "The base directory for the container" default: /data private: no + - name: "podman_network" + prompt: "The podman network to use for the container (empty = none)" + default: "" + private: no - name: "patchew_server" prompt: "The address of patchew server" default: "https://patchew.org" diff --git a/scripts/playbooks/deploy-importers.yml b/scripts/playbooks/deploy-importers.yml index 3711dbd..db75ca5 100644 --- a/scripts/playbooks/deploy-importers.yml +++ b/scripts/playbooks/deploy-importers.yml @@ -8,6 +8,10 @@ prompt: "The base directory for the container" default: /data private: no + - name: "podman_network" + prompt: "The podman network to use for the container (empty = none)" + default: "" + private: no - name: "patchew_server" prompt: "The address of patchew server" default: "https://patchew.org" diff --git a/scripts/playbooks/deploy-servers.yml b/scripts/playbooks/deploy-servers.yml index 227b84b..3378769 100644 --- a/scripts/playbooks/deploy-servers.yml +++ b/scripts/playbooks/deploy-servers.yml @@ -8,6 +8,10 @@ prompt: "The base directory for the container" default: /data private: no + - name: "podman_network" + prompt: "The podman network to use for the container (empty = none)" + default: "" + private: no - name: db_host prompt: "Host for PostgreSQL database (empty = SQLite)" default: "" @@ -24,8 +28,7 @@ base_dir: "{{ container_dir }}/{{ instance_name }}" src_dir: "{{ base_dir }}/src" data_dir: "{{ base_dir }}/data" - db_arg: "{{ '-e PATCHEW_DB_PORT_5432_TCP_ADDR=' if db_host != '' else '' }}{{ db_host }}" - podman_run_args: "--net patchew {{db_arg}}" + podman_run_args: "{{ '-e PATCHEW_DB_PORT_5432_TCP_ADDR=' if db_host != '' else '' }}{{ db_host }}" tasks: - name: Create data dir file: @@ -44,10 +47,6 @@ command: "restorecon -v {{ data_dir }}/nginx.sock" become: true when: nginx_sock.stat.exists - - name: Create podman network - containers.podman.podman_network: - name: patchew - become: true - import_tasks: tasks/podman-deploy.yml vars: instance_role: server diff --git a/scripts/playbooks/tasks/podman-deploy.yml b/scripts/playbooks/tasks/podman-deploy.yml index 6d7792f..739b9c9 100644 --- a/scripts/playbooks/tasks/podman-deploy.yml +++ b/scripts/playbooks/tasks/podman-deploy.yml @@ -21,6 +21,11 @@ file: path: "{{ data_dir }}" state: directory +- name: Create podman network + containers.podman.podman_network: + name: "{{ podman_network }}" + become: true + when: podman_network != "" - name: Copy source synchronize: src: ../../../ diff --git a/scripts/playbooks/templates/podman.service.j2 b/scripts/playbooks/templates/podman.service.j2 index 94f3c67..6b257c7 100644 --- a/scripts/playbooks/templates/podman.service.j2 +++ b/scripts/playbooks/templates/podman.service.j2 @@ -10,7 +10,7 @@ ExecStartPre=-podman stop {{ instance_name }} ; -podman rm {{ instance_name }} ExecStart=podman run --privileged --name {{ instance_name }} \ -v {{ data_dir }}:/data/patchew:rw \ -e PATCHEW_DATA_DIR=/data/patchew \ - {{ podman_run_args | default() }} \ + {{ " --net " if podman_network else "" }}{{ podman_network }} {{ podman_run_args | default() }} \ patchew:{{ instance_name }} ExecStop=podman stop -t 10 {{ instance_name }} RestartSec=60