Skip to content

Commit 831a92b

Browse files
committed
allow using podman network for all containers
Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 41094d8 commit 831a92b

File tree

7 files changed

+27
-12
lines changed

7 files changed

+27
-12
lines changed

scripts/playbooks/deploy-appliers.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
prompt: "The base directory for the container"
99
default: /data
1010
private: no
11+
- name: "podman_network"
12+
prompt: "The podman network to use for the container (empty = none)"
13+
default: ""
14+
private: no
1115
- name: "patchew_server"
1216
prompt: "The address of patchew server"
1317
default: "https://patchew.org"

scripts/playbooks/deploy-db.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,19 @@
88
prompt: "The base directory for the container"
99
default: /data
1010
private: no
11+
- name: "podman_network"
12+
prompt: "The podman network to use for the container (empty = none)"
13+
default: ""
14+
private: no
1115
vars:
1216
base_dir: "{{ container_dir }}/{{ instance_name }}"
1317
src_dir: "{{ base_dir }}/src"
1418
data_dir: "{{ base_dir }}/data"
15-
podman_run_args: "--net patchew"
1619
tasks:
1720
- name: Create data dir
1821
file:
1922
path: "{{ data_dir }}"
2023
state: directory
21-
- name: Create podman network
22-
containers.podman.podman_network:
23-
name: patchew
24-
become: true
2524
- import_tasks: tasks/podman-deploy.yml
2625
vars:
2726
instance_role: db

scripts/playbooks/deploy-importers-lore.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
prompt: "The base directory for the container"
99
default: /data
1010
private: no
11+
- name: "podman_network"
12+
prompt: "The podman network to use for the container (empty = none)"
13+
default: ""
14+
private: no
1115
- name: "patchew_server"
1216
prompt: "The address of patchew server"
1317
default: "https://patchew.org"

scripts/playbooks/deploy-importers.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
prompt: "The base directory for the container"
99
default: /data
1010
private: no
11+
- name: "podman_network"
12+
prompt: "The podman network to use for the container (empty = none)"
13+
default: ""
14+
private: no
1115
- name: "patchew_server"
1216
prompt: "The address of patchew server"
1317
default: "https://patchew.org"

scripts/playbooks/deploy-servers.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
prompt: "The base directory for the container"
99
default: /data
1010
private: no
11+
- name: "podman_network"
12+
prompt: "The podman network to use for the container (empty = none)"
13+
default: ""
14+
private: no
1115
- name: db_host
1216
prompt: "Host for PostgreSQL database (empty = SQLite)"
1317
default: ""
@@ -24,8 +28,7 @@
2428
base_dir: "{{ container_dir }}/{{ instance_name }}"
2529
src_dir: "{{ base_dir }}/src"
2630
data_dir: "{{ base_dir }}/data"
27-
db_arg: "{{ '-e PATCHEW_DB_PORT_5432_TCP_ADDR=' if db_host != '' else '' }}{{ db_host }}"
28-
podman_run_args: "--net patchew {{db_arg}}"
31+
podman_run_args: "{{ '-e PATCHEW_DB_PORT_5432_TCP_ADDR=' if db_host != '' else '' }}{{ db_host }}"
2932
tasks:
3033
- name: Create data dir
3134
file:
@@ -44,10 +47,6 @@
4447
command: "restorecon -v {{ data_dir }}/nginx.sock"
4548
become: true
4649
when: nginx_sock.stat.exists
47-
- name: Create podman network
48-
containers.podman.podman_network:
49-
name: patchew
50-
become: true
5150
- import_tasks: tasks/podman-deploy.yml
5251
vars:
5352
instance_role: server

scripts/playbooks/tasks/podman-deploy.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
file:
2222
path: "{{ data_dir }}"
2323
state: directory
24+
- name: Create podman network
25+
containers.podman.podman_network:
26+
name: "{{ podman_network }}"
27+
become: true
28+
when: podman_network != ""
2429
- name: Copy source
2530
synchronize:
2631
src: ../../../

scripts/playbooks/templates/podman.service.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ExecStartPre=-podman stop {{ instance_name }} ; -podman rm {{ instance_name }}
1010
ExecStart=podman run --privileged --name {{ instance_name }} \
1111
-v {{ data_dir }}:/data/patchew:rw \
1212
-e PATCHEW_DATA_DIR=/data/patchew \
13-
{{ podman_run_args | default() }} \
13+
{{ " --net " if podman_network else "" }}{{ podman_network }} {{ podman_run_args | default() }} \
1414
patchew:{{ instance_name }}
1515
ExecStop=podman stop -t 10 {{ instance_name }}
1616
RestartSec=60

0 commit comments

Comments
 (0)