Compatibility with new podman on bookworm

This commit is contained in:
Wojciech Kozlowski 2023-08-18 13:01:36 +02:00
parent 4340b894aa
commit abfbc2fc5b
20 changed files with 208 additions and 140 deletions

View File

@ -6,6 +6,13 @@
- block:
- name: "{{ services_service_name }} : configure hosts file"
ansible.builtin.template:
src: "hosts"
dest: "{{ services_service_user_home }}/.config/service/hosts"
mode: 0644
register: services_deploy_cloud_hosts_file
- name: "configure nginx"
ansible.builtin.copy:
src: "./config/nginx.conf"
@ -65,7 +72,8 @@
state: "restarted"
scope: "user"
when:
(services_deploy_cloud_config_files.changed or
(services_deploy_cloud_hosts_file.changed or
services_deploy_cloud_config_files.changed or
services_deploy_cloud_nextcloud_files.changed or
services_deploy_cloud_systemd_files.changed) and
services_deploy_cloud_service_active_state.stdout == "active"

View File

@ -0,0 +1,9 @@
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.1.1 cloud
{{ services_all_services['database'].inet6_address }} pod-database
{{ services_all_services['database'].inet_address }} pod-database

View File

@ -22,9 +22,8 @@ ExecStart=/usr/bin/podman run \
--label "io.containers.autoupdate=image" \
--log-driver=journald \
-dt \
--add-host=pod-database:{{ services_all_services['database'].inet_address }} \
--add-host=pod-database:{{ services_all_services['database'].inet6_address }} \
-v {{ system_etc_root_directory }}/resolv.conf:/etc/resolv.conf:ro \
-v ./.config/service/hosts:/etc/hosts:ro \
-v {{ services_data_directory }}/pod-cloud/nextcloud/_data:/var/www/html \
-v {{ services_data_directory }}/pod-cloud/data/_data:/var/www/html/data \
-v {{ services_data_directory }}/pod-cloud/external/_data:/media/external \

View File

@ -22,9 +22,8 @@ ExecStart=/usr/bin/podman run \
--label "io.containers.autoupdate=image" \
--log-driver=journald \
-dt \
--add-host=pod-database:{{ services_all_services['database'].inet_address }} \
--add-host=pod-database:{{ services_all_services['database'].inet6_address }} \
-v {{ system_etc_root_directory }}/resolv.conf:/etc/resolv.conf:ro \
-v ./.config/service/hosts:/etc/hosts:ro \
-v {{ services_data_directory }}/pod-cloud/nextcloud/_data:/var/www/html \
-v {{ services_data_directory }}/pod-cloud/data/_data:/var/www/html/data \
-v {{ services_data_directory }}/pod-cloud/external/_data:/media/external \

View File

@ -12,7 +12,12 @@ Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
TimeoutStopSec=70
ExecStartPre=/bin/rm -f %t/pod-cloud.pid %t/pod-cloud.pod-id
ExecStartPre=/usr/bin/podman pod create --infra-conmon-pidfile %t/pod-cloud.pid --pod-id-file %t/pod-cloud.pod-id --name=cloud --network=none --replace
ExecStartPre=/usr/bin/podman pod create \
--infra-conmon-pidfile %t/pod-cloud.pid \
--pod-id-file %t/pod-cloud.pod-id \
--name=cloud \
--network=none \
--replace
ExecStart=/usr/bin/podman pod start --pod-id-file %t/pod-cloud.pod-id
ExecStartPost=/usr/bin/sh -c 'podman inspect --format "{% raw %}{{ .State.Pid }}{% endraw %}" $(podman inspect --format "{% raw %}{{ .InfraContainerID }}{% endraw %}" cloud) > {{ services_containers_directory }}/pod-cloud/pidfile'
ExecStartPost=/usr/bin/sudo /usr/sbin/ifdown --ignore-errors veth-cloud

View File

@ -6,6 +6,13 @@
- block:
- name: "{{ services_service_name }} : configure hosts file"
ansible.builtin.template:
src: "hosts"
dest: "{{ services_service_user_home }}/.config/service/hosts"
mode: 0644
register: services_deploy_git_hosts_file
- name: "configure systemd service"
ansible.builtin.template:
src: "./systemd/{{ item }}"
@ -43,7 +50,8 @@
state: "restarted"
scope: "user"
when:
services_deploy_git_systemd_files.changed and
(services_deploy_git_hosts_file.changed or
services_deploy_git_systemd_files.changed) and
services_deploy_git_service_active_state.stdout == "active"
become_user: "{{ services_service_user_name }}"

View File

@ -0,0 +1,9 @@
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.1.1 git
{{ services_all_services['database'].inet6_address }} pod-database
{{ services_all_services['database'].inet_address }} pod-database

View File

@ -21,9 +21,8 @@ ExecStart=/usr/bin/podman run \
--label "io.containers.autoupdate=image" \
--log-driver=journald \
-dt \
--add-host=pod-database:{{ services_all_services['database'].inet_address }} \
--add-host=pod-database:{{ services_all_services['database'].inet6_address }} \
-v {{ system_etc_root_directory }}/resolv.conf:/etc/resolv.conf:ro \
-v ./.config/service/hosts:/etc/hosts:ro \
-v {{ services_data_directory }}/pod-git/data/_data:/data \
-v /etc/timezone:/etc/timezone:ro \
-v /etc/localtime:/etc/localtime:ro \

View File

@ -12,7 +12,12 @@ Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
TimeoutStopSec=70
ExecStartPre=/bin/rm -f %t/pod-git.pid %t/pod-git.pod-id
ExecStartPre=/usr/bin/podman pod create --infra-conmon-pidfile %t/pod-git.pid --pod-id-file %t/pod-git.pod-id --name=git --network=none --replace
ExecStartPre=/usr/bin/podman pod create \
--infra-conmon-pidfile %t/pod-git.pid \
--pod-id-file %t/pod-git.pod-id \
--name=git \
--network=none \
--replace
ExecStart=/usr/bin/podman pod start --pod-id-file %t/pod-git.pod-id
ExecStartPost=/usr/bin/sh -c 'podman inspect --format "{% raw %}{{ .State.Pid }}{% endraw %}" $(podman inspect --format "{% raw %}{{ .InfraContainerID }}{% endraw %}" git) > {{ services_containers_directory }}/pod-git/pidfile'
ExecStartPost=/usr/bin/sudo /usr/sbin/ifdown --ignore-errors veth-git

View File

@ -6,6 +6,13 @@
- block:
- name: "{{ services_service_name }} : configure hosts file"
ansible.builtin.template:
src: "hosts"
dest: "{{ services_service_user_home }}/.config/service/hosts"
mode: 0644
register: services_deploy_notes_hosts_file
- name: "configure systemd service"
ansible.builtin.template:
src: "./systemd/{{ item }}"
@ -44,7 +51,8 @@
state: "restarted"
scope: "user"
when:
services_deploy_notes_systemd_files.changed and
(services_deploy_notes_hosts_file.changed or
services_deploy_notes_systemd_files.changed) and
services_deploy_notes_service_active_state.stdout == "active"
become_user: "{{ services_service_user_name }}"

View File

@ -0,0 +1,9 @@
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.1.1 notes
{{ services_all_services['database'].inet6_address }} pod-database
{{ services_all_services['database'].inet_address }} pod-database

View File

@ -22,9 +22,8 @@ ExecStart=/usr/bin/podman run \
--label "io.containers.autoupdate=image" \
--log-driver=journald \
-dt \
--add-host=pod-database:{{ services_all_services['database'].inet_address }} \
--add-host=pod-database:{{ services_all_services['database'].inet6_address }} \
-v {{ system_etc_root_directory }}/resolv.conf:/etc/resolv.conf:ro \
-v ./.config/service/hosts:/etc/hosts:ro \
-v {{ services_data_directory }}/pod-notes/data/_data:/data \
-e APP_BASE_URL="https://{{ services[services_service_name].domain }}" \
-e APP_PORT="22300" \

View File

@ -12,7 +12,12 @@ Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
TimeoutStopSec=70
ExecStartPre=/bin/rm -f %t/pod-notes.pid %t/pod-notes.pod-id
ExecStartPre=/usr/bin/podman pod create --infra-conmon-pidfile %t/pod-notes.pid --pod-id-file %t/pod-notes.pod-id --name=notes --network=none --replace
ExecStartPre=/usr/bin/podman pod create \
--infra-conmon-pidfile %t/pod-notes.pid \
--pod-id-file %t/pod-notes.pod-id \
--name=notes \
--network=none \
--replace
ExecStart=/usr/bin/podman pod start --pod-id-file %t/pod-notes.pod-id
ExecStartPost=/usr/bin/sh -c 'podman inspect --format "{% raw %}{{ .State.Pid }}{% endraw %}" $(podman inspect --format "{% raw %}{{ .InfraContainerID }}{% endraw %}" notes) > {{ services_containers_directory }}/pod-notes/pidfile'
ExecStartPost=/usr/bin/sudo /usr/sbin/ifdown --ignore-errors veth-notes

View File

@ -4,12 +4,15 @@
name: "services/include"
vars_from: "user"
- name: "{{ services_service_name }} : set the rproxy variables"
ansible.builtin.include_vars:
file: "nginx.yml"
- block:
- name: "{{ services_service_name }} : configure hosts file"
ansible.builtin.template:
src: "hosts"
dest: "{{ services_service_user_home }}/.config/service/hosts"
mode: 0644
register: services_deploy_rproxy_hosts_file
- name: "{{ services_service_name }} : create nginx conf.d"
ansible.builtin.file:
path: "{{ services_service_user_home }}/.config/service/nginx-conf.d"
@ -93,7 +96,8 @@
state: "restarted"
scope: "user"
when:
(services_deploy_rproxy_generic_config.changed or
(services_deploy_rproxy_hosts_file.changed or
services_deploy_rproxy_generic_config.changed or
services_deploy_rproxy_stream_config.changed or
services_deploy_rproxy_subdomain_config_files.changed or
services_deploy_rproxy_systemd_files.changed or

View File

@ -0,0 +1,11 @@
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.1.1 {{ services_service_name }}
{% for service in ( services_all_services | dict2items ) %}
{{ service.value.inet6_address }} pod-{{ service.key }}
{{ service.value.inet_address }} pod-{{ service.key }}
{% endfor %}

View File

@ -22,9 +22,8 @@ ExecStart=/usr/bin/podman run \
--label "io.containers.autoupdate=image" \
--log-driver=journald \
-dt \
{{ services_rproxy_nginx_add_inet_hosts }} \
{{ services_rproxy_nginx_add_inet6_hosts }} \
-v {{ system_etc_root_directory }}/resolv.conf:/etc/resolv.conf:ro \
-v ./.config/service/hosts:/etc/hosts:ro \
-v %t/resolver.conf:/etc/nginx/resolver.conf:ro \
-v ./.config/service/nginx.conf:/etc/nginx/nginx.conf:ro \
-v ./.config/service/stream.conf:/etc/nginx/stream.conf:ro \

View File

@ -12,7 +12,12 @@ Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
TimeoutStopSec=70
ExecStartPre=/bin/rm -f %t/pod-{{ services_service_name }}.pid %t/pod-{{ services_service_name }}.pod-id
ExecStartPre=/usr/bin/podman pod create --infra-conmon-pidfile %t/pod-{{ services_service_name }}.pid --pod-id-file %t/pod-{{ services_service_name }}.pod-id --name={{ services_service_name }} --network=none --replace
ExecStartPre=/usr/bin/podman pod create \
--infra-conmon-pidfile %t/pod-{{ services_service_name }}.pid \
--pod-id-file %t/pod-{{ services_service_name }}.pod-id \
--name={{ services_service_name }} \
--network=none \
--replace
ExecStart=/usr/bin/podman pod start --pod-id-file %t/pod-{{ services_service_name }}.pod-id
ExecStartPost=/usr/bin/sh -c 'podman inspect --format "{% raw %}{{ .State.Pid }}{% endraw %}" $(podman inspect --format "{% raw %}{{ .InfraContainerID }}{% endraw %}" {{ services_service_name }}) > {{ services_containers_directory }}/pod-{{ services_service_name }}/pidfile'
ExecStartPost=/usr/bin/sudo /usr/sbin/ifdown --ignore-errors veth-{{ services_service_name }}

View File

@ -1,13 +0,0 @@
---
services_rproxy_nginx_add_inet_hosts: "\
{% set add_host_list = [] %}\
{% for service in ( services_all_services | dict2items ) %}\
{{ add_host_list.append('--add-host=pod-' ~ service.key ~ ':' ~ service.value.inet_address) }}\
{% endfor %}\
{{ add_host_list | join(' ') }}"
services_rproxy_nginx_add_inet6_hosts: "\
{% set add_host_list = [] %}\
{% for service in ( services_all_services | dict2items ) %}\
{{ add_host_list.append('--add-host=pod-' ~ service.key ~ ':' ~ service.value.inet6_address) }}\
{% endfor %}\
{{ add_host_list | join(' ') }}"