patchew-server.service | 13 ----- patchew-tester.service | 15 ------ scripts/playbooks/deploy-appliers.yml | 8 ++- scripts/playbooks/deploy-db.yml | 8 ++- scripts/playbooks/deploy-importers-lore.yml | 10 ++-- scripts/playbooks/deploy-importers.yml | 8 ++- scripts/playbooks/deploy-servers.yml | 12 +++-- .../{docker-deploy.yml => podman-deploy.yml} | 51 +++++++++---------- .../{docker.service.j2 => podman.service.j2} | 12 ++--- 9 files changed, 63 insertions(+), 74 deletions(-) delete mode 100644 patchew-server.service delete mode 100644 patchew-tester.service rename scripts/playbooks/tasks/{docker-deploy.yml => podman-deploy.yml} (48%) rename scripts/playbooks/templates/{docker.service.j2 => podman.service.j2} (38%)
This is not really complete yet, and should be split into multiple
patches, but I have already tried running the playbook on a spare server
except for the systemd start step; it seems to work.
I would like to move the patchew.org services to a new server because
next.patchew.org is already running low on disk space, and I would like to
experiment there with removing the blob storage for messages. I'd like
to avoid that running out of disk space during the conversion messes up
the other containers.
While sooner or later I would like to move to Kubernetes, this
intermediate step also lets us move the hosts to a more recent version
of CentOS than CentOS 7.
Paolo
---
patchew-server.service | 13 -----
patchew-tester.service | 15 ------
scripts/playbooks/deploy-appliers.yml | 8 ++-
scripts/playbooks/deploy-db.yml | 8 ++-
scripts/playbooks/deploy-importers-lore.yml | 10 ++--
scripts/playbooks/deploy-importers.yml | 8 ++-
scripts/playbooks/deploy-servers.yml | 12 +++--
.../{docker-deploy.yml => podman-deploy.yml} | 51 +++++++++----------
.../{docker.service.j2 => podman.service.j2} | 12 ++---
9 files changed, 63 insertions(+), 74 deletions(-)
delete mode 100644 patchew-server.service
delete mode 100644 patchew-tester.service
rename scripts/playbooks/tasks/{docker-deploy.yml => podman-deploy.yml} (48%)
rename scripts/playbooks/templates/{docker.service.j2 => podman.service.j2} (38%)
diff --git a/patchew-server.service b/patchew-server.service
deleted file mode 100644
index d8b17ea..0000000
--- a/patchew-server.service
+++ /dev/null
@@ -1,13 +0,0 @@
-[Unit]
-Description=Patchew server docker instance
-Requires=docker.service
-After=docker.service
-
-[Service]
-Restart=always
-ExecStartPre=-/usr/bin/docker stop patchew-server ; -/usr/bin/docker rm patchew-server
-ExecStart= /usr/bin/docker run --privileged --name patchew-server -v /data:/data:rw -p 8081:80 patchew:server
-ExecStop=/usr/bin/docker stop -t 10 patchew-server
-
-[Install]
-WantedBy=default.target
diff --git a/patchew-tester.service b/patchew-tester.service
deleted file mode 100644
index 118c76a..0000000
--- a/patchew-tester.service
+++ /dev/null
@@ -1,15 +0,0 @@
-[Unit]
-Description=Patchew Tester
-After=network.target
-
-[Service]
-ExecStart=/usr/bin/patchew-tester
-Restart=always
-RestartSec=30
-User=root
-StandardOutput=syslog+journal
-StandardError=inherit
-
-[Install]
-WantedBy=multi-user.target
-
diff --git a/scripts/playbooks/deploy-appliers.yml b/scripts/playbooks/deploy-appliers.yml
index 18edac7..863c167 100644
--- a/scripts/playbooks/deploy-appliers.yml
+++ b/scripts/playbooks/deploy-appliers.yml
@@ -4,6 +4,10 @@
prompt: "The instance name"
default: patchew-applier
private: no
+ - name: container_dir
+ prompt: "The base directory for the container"
+ default: /data
+ private: no
- name: "patchew_server"
prompt: "The address of patchew server"
default: "https://patchew.org"
@@ -23,7 +27,7 @@
default: ""
private: no
vars:
- base_dir: "/data/{{ instance_name }}"
+ base_dir: "{{ container_dir }}/{{ instance_name }}"
src_dir: "{{ base_dir }}/src"
data_dir: "{{ base_dir }}/data"
config_file: "{{ data_dir }}/config"
@@ -43,6 +47,6 @@
template:
src: "templates/applier-config.j2"
dest: "{{ config_file }}"
- - import_tasks: tasks/docker-deploy.yml
+ - import_tasks: tasks/podman-deploy.yml
vars:
instance_role: applier
diff --git a/scripts/playbooks/deploy-db.yml b/scripts/playbooks/deploy-db.yml
index 2b69995..1db810f 100644
--- a/scripts/playbooks/deploy-db.yml
+++ b/scripts/playbooks/deploy-db.yml
@@ -4,8 +4,12 @@
prompt: "Instance name of the patchew postgres db"
default: patchew-server-db
private: no
+ - name: container_dir
+ prompt: "The base directory for the container"
+ default: /data
+ private: no
vars:
- base_dir: "/data/{{ instance_name }}"
+ base_dir: "{{ container_dir }}/{{ instance_name }}"
src_dir: "{{ base_dir }}/src"
data_dir: "{{ base_dir }}/data"
tasks:
@@ -13,6 +17,6 @@
file:
path: "{{ data_dir }}"
state: directory
- - import_tasks: tasks/docker-deploy.yml
+ - 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 9f80d93..ab76ba6 100644
--- a/scripts/playbooks/deploy-importers-lore.yml
+++ b/scripts/playbooks/deploy-importers-lore.yml
@@ -4,6 +4,10 @@
prompt: "The instance name"
default: patchew-importer-lore
private: no
+ - name: container_dir
+ prompt: "The base directory for the container"
+ default: /data
+ private: no
- name: "patchew_server"
prompt: "The address of patchew server"
default: "https://patchew.org"
@@ -20,11 +24,11 @@
default: "https://lore.kernel.org/lkml/"
private: no
vars:
- base_dir: "/data/{{ instance_name }}"
+ base_dir: "{{ container_dir }}/{{ instance_name }}"
src_dir: "{{ base_dir }}/src"
data_dir: "{{ base_dir }}/data"
config_file: "{{ data_dir }}/config"
- docker_run_args: "--init"
+ podman_run_args: "--init"
tasks:
- name: Create data dir
file:
@@ -34,6 +38,6 @@
template:
src: "templates/importer-lore-config.j2"
dest: "{{ config_file }}"
- - import_tasks: tasks/docker-deploy.yml
+ - import_tasks: tasks/podman-deploy.yml
vars:
instance_role: importer-lore
diff --git a/scripts/playbooks/deploy-importers.yml b/scripts/playbooks/deploy-importers.yml
index 8d362ee..3711dbd 100644
--- a/scripts/playbooks/deploy-importers.yml
+++ b/scripts/playbooks/deploy-importers.yml
@@ -4,6 +4,10 @@
prompt: "The instance name"
default: patchew-importer
private: no
+ - name: container_dir
+ prompt: "The base directory for the container"
+ default: /data
+ private: no
- name: "patchew_server"
prompt: "The address of patchew server"
default: "https://patchew.org"
@@ -41,7 +45,7 @@
default: "y"
private: no
vars:
- base_dir: "/data/{{ instance_name }}"
+ base_dir: "{{ container_dir }}/{{ instance_name }}"
src_dir: "{{ base_dir }}/src"
data_dir: "{{ base_dir }}/data"
config_file: "{{ data_dir }}/config"
@@ -54,6 +58,6 @@
template:
src: "templates/importer-config.j2"
dest: "{{ config_file }}"
- - import_tasks: tasks/docker-deploy.yml
+ - import_tasks: tasks/podman-deploy.yml
vars:
instance_role: importer
diff --git a/scripts/playbooks/deploy-servers.yml b/scripts/playbooks/deploy-servers.yml
index 18acb36..4a90c75 100644
--- a/scripts/playbooks/deploy-servers.yml
+++ b/scripts/playbooks/deploy-servers.yml
@@ -4,6 +4,10 @@
prompt: "Instance name of the webserver"
default: patchew-server
private: no
+ - name: container_dir
+ prompt: "The base directory for the container"
+ default: /data
+ private: no
- name: superuser_name
prompt: "Admin account to create (optional)"
default: ""
@@ -13,22 +17,22 @@
default: "adminpass"
private: yes
vars:
- base_dir: "/data/{{ instance_name }}"
+ base_dir: "{{ container_dir }}/{{ instance_name }}"
src_dir: "{{ base_dir }}/src"
data_dir: "{{ base_dir }}/data"
- docker_run_args: "--link {{ instance_name }}-db:patchew-db"
+ podman_run_args: "--link {{ instance_name }}-db:patchew-db"
tasks:
- name: Create data dir
file:
path: "{{ data_dir }}"
state: directory
- - import_tasks: tasks/docker-deploy.yml
+ - import_tasks: tasks/podman-deploy.yml
vars:
instance_role: server
- name: Create superuser
when: superuser_name != ""
shell: |
- docker exec -i {{ instance_name }} bash -c "
+ podman exec -i {{ instance_name }} bash -c "
cd /opt/patchew &&
. venv/bin/activate &&
./manage.py migrate &&
diff --git a/scripts/playbooks/tasks/docker-deploy.yml b/scripts/playbooks/tasks/podman-deploy.yml
similarity index 48%
rename from scripts/playbooks/tasks/docker-deploy.yml
rename to scripts/playbooks/tasks/podman-deploy.yml
index 2cd2f32..45328ba 100644
--- a/scripts/playbooks/tasks/docker-deploy.yml
+++ b/scripts/playbooks/tasks/podman-deploy.yml
@@ -4,27 +4,17 @@
name: rsync
- name: Install pip
package:
- name: python-pip
-- name: Install docker
+ name: python3-pip
+- name: Install podman
package:
- name: docker
-- name: Start docker daemon
- service:
- name: docker
- state: started
-- name: Install docker python library for ansible
- pip:
- name: docker-py
-- name: Install SELinux python bindings (for systemd setup)
- package:
- name: libselinux-python
+ name: podman
- name: Stop systemd service for "{{ instance_name }}"
service:
name: "{{ instance_name }}"
state: stopped
ignore_errors: yes
-- name: Stop docker instance
- docker_container:
+- name: Stop podman instance
+ containers.podman.podman_container:
name: "{{ instance_name }}"
state: absent
- name: Create patchew data folder
@@ -43,24 +33,33 @@
- "--exclude=*.pyc"
- "--exclude=*.swp"
- "--exclude=/venv"
-- name: Delete old docker image stash
- docker_image:
- force_absent: yes
+- name: Check for existing backup image
+ containers.podman.podman_image_info:
name: "patchew:{{ instance_name }}-prev"
- state: absent
-- name: Stash docker image
- shell: docker tag "patchew:{{ instance_name }}" "patchew:{{ instance_name }}-prev" || true
-- name: Rebuild docker image
- # docker_image module doesn't work on Fedora
- shell: docker build -t "patchew:{{ instance_name }}" -f "{{ src_dir }}/scripts/dockerfiles/{{ instance_role }}.docker" "{{ src_dir }}"
+ register: prev_image
+- name: Delete old podman image stash
+ shell: "podman untag 'patchew:{{ instance_name }}-prev'"
+ when: prev_image.images
+- name: Check for existing image
+ containers.podman.podman_image_info:
+ name: "patchew:{{ instance_name }}"
+ register: current_image
+- name: Stash podman image
+ containers.podman.podman_tag:
+ image: "patchew:{{ instance_name }}"
+ target_names: "patchew:{{ instance_name }}-prev"
+ when: current_image.images
+- name: Rebuild podman image
+ # docker_image module wants a file named Dockerfile
+ shell: "podman build -t 'patchew:{{ instance_name }}' -f '{{ src_dir }}/scripts/dockerfiles/{{ instance_role }}.docker' '{{ src_dir }}'"
- name: Install systemd service
template:
- src: "templates/docker.service.j2"
+ src: "templates/podman.service.j2"
dest: "/etc/systemd/system/{{ instance_name }}.service"
- name: Systemd daemon reload
systemd:
daemon_reload: yes
-- name: Start docker instance
+- name: Start podman instance
service:
name: "{{ instance_name }}"
state: restarted
diff --git a/scripts/playbooks/templates/docker.service.j2 b/scripts/playbooks/templates/podman.service.j2
similarity index 38%
rename from scripts/playbooks/templates/docker.service.j2
rename to scripts/playbooks/templates/podman.service.j2
index 85dd9d2..e1edfb9 100644
--- a/scripts/playbooks/templates/docker.service.j2
+++ b/scripts/playbooks/templates/podman.service.j2
@@ -1,18 +1,16 @@
[Unit]
-Description=Patchew docker instance control service for {{ instance_name }}
-Requires=docker.service
-After=docker.service
+Description=Patchew podman instance control service for {{ instance_name }}
StartLimitIntervalSec=0
[Service]
Restart=always
-ExecStartPre=-/usr/bin/docker stop {{ instance_name }} ; -/usr/bin/docker rm {{ instance_name }}
-ExecStart=/usr/bin/docker run --privileged --name {{ instance_name }} \
+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 \
- {{ docker_run_args | default() }} \
+ {{ podman_run_args | default() }} \
patchew:{{ instance_name }}
-ExecStop=/usr/bin/docker stop -t 10 {{ instance_name }}
+ExecStop=podman stop -t 10 {{ instance_name }}
RestartSec=60
[Install]
--
2.35.1
_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/patchew-devel
On 2022-04-06 17:28, Paolo Bonzini wrote: > This is not really complete yet, and should be split into multiple > patches, but I have already tried running the playbook on a spare server > except for the systemd start step; it seems to work. > > I would like to move the patchew.org services to a new server because > next.patchew.org is already running low on disk space, and I would like to > experiment there with removing the blob storage for messages. I'd like > to avoid that running out of disk space during the conversion messes up > the other containers. > > While sooner or later I would like to move to Kubernetes, this > intermediate step also lets us move the hosts to a more recent version > of CentOS than CentOS 7. I have no experience with podman but the changes look fine. Let me know if you need any DNS record change. Fam > > Paolo > --- > patchew-server.service | 13 ----- > patchew-tester.service | 15 ------ > scripts/playbooks/deploy-appliers.yml | 8 ++- > scripts/playbooks/deploy-db.yml | 8 ++- > scripts/playbooks/deploy-importers-lore.yml | 10 ++-- > scripts/playbooks/deploy-importers.yml | 8 ++- > scripts/playbooks/deploy-servers.yml | 12 +++-- > .../{docker-deploy.yml => podman-deploy.yml} | 51 +++++++++---------- > .../{docker.service.j2 => podman.service.j2} | 12 ++--- > 9 files changed, 63 insertions(+), 74 deletions(-) > delete mode 100644 patchew-server.service > delete mode 100644 patchew-tester.service > rename scripts/playbooks/tasks/{docker-deploy.yml => podman-deploy.yml} (48%) > rename scripts/playbooks/templates/{docker.service.j2 => podman.service.j2} (38%) > > diff --git a/patchew-server.service b/patchew-server.service > deleted file mode 100644 > index d8b17ea..0000000 > --- a/patchew-server.service > +++ /dev/null > @@ -1,13 +0,0 @@ > -[Unit] > -Description=Patchew server docker instance > -Requires=docker.service > -After=docker.service > - > -[Service] > -Restart=always > -ExecStartPre=-/usr/bin/docker stop patchew-server ; -/usr/bin/docker rm patchew-server > -ExecStart= /usr/bin/docker run --privileged --name patchew-server -v /data:/data:rw -p 8081:80 patchew:server > -ExecStop=/usr/bin/docker stop -t 10 patchew-server > - > -[Install] > -WantedBy=default.target > diff --git a/patchew-tester.service b/patchew-tester.service > deleted file mode 100644 > index 118c76a..0000000 > --- a/patchew-tester.service > +++ /dev/null > @@ -1,15 +0,0 @@ > -[Unit] > -Description=Patchew Tester > -After=network.target > - > -[Service] > -ExecStart=/usr/bin/patchew-tester > -Restart=always > -RestartSec=30 > -User=root > -StandardOutput=syslog+journal > -StandardError=inherit > - > -[Install] > -WantedBy=multi-user.target > - > diff --git a/scripts/playbooks/deploy-appliers.yml b/scripts/playbooks/deploy-appliers.yml > index 18edac7..863c167 100644 > --- a/scripts/playbooks/deploy-appliers.yml > +++ b/scripts/playbooks/deploy-appliers.yml > @@ -4,6 +4,10 @@ > prompt: "The instance name" > default: patchew-applier > private: no > + - name: container_dir > + prompt: "The base directory for the container" > + default: /data > + private: no > - name: "patchew_server" > prompt: "The address of patchew server" > default: "https://patchew.org" > @@ -23,7 +27,7 @@ > default: "" > private: no > vars: > - base_dir: "/data/{{ instance_name }}" > + base_dir: "{{ container_dir }}/{{ instance_name }}" > src_dir: "{{ base_dir }}/src" > data_dir: "{{ base_dir }}/data" > config_file: "{{ data_dir }}/config" > @@ -43,6 +47,6 @@ > template: > src: "templates/applier-config.j2" > dest: "{{ config_file }}" > - - import_tasks: tasks/docker-deploy.yml > + - import_tasks: tasks/podman-deploy.yml > vars: > instance_role: applier > diff --git a/scripts/playbooks/deploy-db.yml b/scripts/playbooks/deploy-db.yml > index 2b69995..1db810f 100644 > --- a/scripts/playbooks/deploy-db.yml > +++ b/scripts/playbooks/deploy-db.yml > @@ -4,8 +4,12 @@ > prompt: "Instance name of the patchew postgres db" > default: patchew-server-db > private: no > + - name: container_dir > + prompt: "The base directory for the container" > + default: /data > + private: no > vars: > - base_dir: "/data/{{ instance_name }}" > + base_dir: "{{ container_dir }}/{{ instance_name }}" > src_dir: "{{ base_dir }}/src" > data_dir: "{{ base_dir }}/data" > tasks: > @@ -13,6 +17,6 @@ > file: > path: "{{ data_dir }}" > state: directory > - - import_tasks: tasks/docker-deploy.yml > + - 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 9f80d93..ab76ba6 100644 > --- a/scripts/playbooks/deploy-importers-lore.yml > +++ b/scripts/playbooks/deploy-importers-lore.yml > @@ -4,6 +4,10 @@ > prompt: "The instance name" > default: patchew-importer-lore > private: no > + - name: container_dir > + prompt: "The base directory for the container" > + default: /data > + private: no > - name: "patchew_server" > prompt: "The address of patchew server" > default: "https://patchew.org" > @@ -20,11 +24,11 @@ > default: "https://lore.kernel.org/lkml/" > private: no > vars: > - base_dir: "/data/{{ instance_name }}" > + base_dir: "{{ container_dir }}/{{ instance_name }}" > src_dir: "{{ base_dir }}/src" > data_dir: "{{ base_dir }}/data" > config_file: "{{ data_dir }}/config" > - docker_run_args: "--init" > + podman_run_args: "--init" > tasks: > - name: Create data dir > file: > @@ -34,6 +38,6 @@ > template: > src: "templates/importer-lore-config.j2" > dest: "{{ config_file }}" > - - import_tasks: tasks/docker-deploy.yml > + - import_tasks: tasks/podman-deploy.yml > vars: > instance_role: importer-lore > diff --git a/scripts/playbooks/deploy-importers.yml b/scripts/playbooks/deploy-importers.yml > index 8d362ee..3711dbd 100644 > --- a/scripts/playbooks/deploy-importers.yml > +++ b/scripts/playbooks/deploy-importers.yml > @@ -4,6 +4,10 @@ > prompt: "The instance name" > default: patchew-importer > private: no > + - name: container_dir > + prompt: "The base directory for the container" > + default: /data > + private: no > - name: "patchew_server" > prompt: "The address of patchew server" > default: "https://patchew.org" > @@ -41,7 +45,7 @@ > default: "y" > private: no > vars: > - base_dir: "/data/{{ instance_name }}" > + base_dir: "{{ container_dir }}/{{ instance_name }}" > src_dir: "{{ base_dir }}/src" > data_dir: "{{ base_dir }}/data" > config_file: "{{ data_dir }}/config" > @@ -54,6 +58,6 @@ > template: > src: "templates/importer-config.j2" > dest: "{{ config_file }}" > - - import_tasks: tasks/docker-deploy.yml > + - import_tasks: tasks/podman-deploy.yml > vars: > instance_role: importer > diff --git a/scripts/playbooks/deploy-servers.yml b/scripts/playbooks/deploy-servers.yml > index 18acb36..4a90c75 100644 > --- a/scripts/playbooks/deploy-servers.yml > +++ b/scripts/playbooks/deploy-servers.yml > @@ -4,6 +4,10 @@ > prompt: "Instance name of the webserver" > default: patchew-server > private: no > + - name: container_dir > + prompt: "The base directory for the container" > + default: /data > + private: no > - name: superuser_name > prompt: "Admin account to create (optional)" > default: "" > @@ -13,22 +17,22 @@ > default: "adminpass" > private: yes > vars: > - base_dir: "/data/{{ instance_name }}" > + base_dir: "{{ container_dir }}/{{ instance_name }}" > src_dir: "{{ base_dir }}/src" > data_dir: "{{ base_dir }}/data" > - docker_run_args: "--link {{ instance_name }}-db:patchew-db" > + podman_run_args: "--link {{ instance_name }}-db:patchew-db" > tasks: > - name: Create data dir > file: > path: "{{ data_dir }}" > state: directory > - - import_tasks: tasks/docker-deploy.yml > + - import_tasks: tasks/podman-deploy.yml > vars: > instance_role: server > - name: Create superuser > when: superuser_name != "" > shell: | > - docker exec -i {{ instance_name }} bash -c " > + podman exec -i {{ instance_name }} bash -c " > cd /opt/patchew && > . venv/bin/activate && > ./manage.py migrate && > diff --git a/scripts/playbooks/tasks/docker-deploy.yml b/scripts/playbooks/tasks/podman-deploy.yml > similarity index 48% > rename from scripts/playbooks/tasks/docker-deploy.yml > rename to scripts/playbooks/tasks/podman-deploy.yml > index 2cd2f32..45328ba 100644 > --- a/scripts/playbooks/tasks/docker-deploy.yml > +++ b/scripts/playbooks/tasks/podman-deploy.yml > @@ -4,27 +4,17 @@ > name: rsync > - name: Install pip > package: > - name: python-pip > -- name: Install docker > + name: python3-pip > +- name: Install podman > package: > - name: docker > -- name: Start docker daemon > - service: > - name: docker > - state: started > -- name: Install docker python library for ansible > - pip: > - name: docker-py > -- name: Install SELinux python bindings (for systemd setup) > - package: > - name: libselinux-python > + name: podman > - name: Stop systemd service for "{{ instance_name }}" > service: > name: "{{ instance_name }}" > state: stopped > ignore_errors: yes > -- name: Stop docker instance > - docker_container: > +- name: Stop podman instance > + containers.podman.podman_container: > name: "{{ instance_name }}" > state: absent > - name: Create patchew data folder > @@ -43,24 +33,33 @@ > - "--exclude=*.pyc" > - "--exclude=*.swp" > - "--exclude=/venv" > -- name: Delete old docker image stash > - docker_image: > - force_absent: yes > +- name: Check for existing backup image > + containers.podman.podman_image_info: > name: "patchew:{{ instance_name }}-prev" > - state: absent > -- name: Stash docker image > - shell: docker tag "patchew:{{ instance_name }}" "patchew:{{ instance_name }}-prev" || true > -- name: Rebuild docker image > - # docker_image module doesn't work on Fedora > - shell: docker build -t "patchew:{{ instance_name }}" -f "{{ src_dir }}/scripts/dockerfiles/{{ instance_role }}.docker" "{{ src_dir }}" > + register: prev_image > +- name: Delete old podman image stash > + shell: "podman untag 'patchew:{{ instance_name }}-prev'" > + when: prev_image.images > +- name: Check for existing image > + containers.podman.podman_image_info: > + name: "patchew:{{ instance_name }}" > + register: current_image > +- name: Stash podman image > + containers.podman.podman_tag: > + image: "patchew:{{ instance_name }}" > + target_names: "patchew:{{ instance_name }}-prev" > + when: current_image.images > +- name: Rebuild podman image > + # docker_image module wants a file named Dockerfile > + shell: "podman build -t 'patchew:{{ instance_name }}' -f '{{ src_dir }}/scripts/dockerfiles/{{ instance_role }}.docker' '{{ src_dir }}'" > - name: Install systemd service > template: > - src: "templates/docker.service.j2" > + src: "templates/podman.service.j2" > dest: "/etc/systemd/system/{{ instance_name }}.service" > - name: Systemd daemon reload > systemd: > daemon_reload: yes > -- name: Start docker instance > +- name: Start podman instance > service: > name: "{{ instance_name }}" > state: restarted > diff --git a/scripts/playbooks/templates/docker.service.j2 b/scripts/playbooks/templates/podman.service.j2 > similarity index 38% > rename from scripts/playbooks/templates/docker.service.j2 > rename to scripts/playbooks/templates/podman.service.j2 > index 85dd9d2..e1edfb9 100644 > --- a/scripts/playbooks/templates/docker.service.j2 > +++ b/scripts/playbooks/templates/podman.service.j2 > @@ -1,18 +1,16 @@ > [Unit] > -Description=Patchew docker instance control service for {{ instance_name }} > -Requires=docker.service > -After=docker.service > +Description=Patchew podman instance control service for {{ instance_name }} > StartLimitIntervalSec=0 > > [Service] > Restart=always > -ExecStartPre=-/usr/bin/docker stop {{ instance_name }} ; -/usr/bin/docker rm {{ instance_name }} > -ExecStart=/usr/bin/docker run --privileged --name {{ instance_name }} \ > +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 \ > - {{ docker_run_args | default() }} \ > + {{ podman_run_args | default() }} \ > patchew:{{ instance_name }} > -ExecStop=/usr/bin/docker stop -t 10 {{ instance_name }} > +ExecStop=podman stop -t 10 {{ instance_name }} > RestartSec=60 > > [Install] > -- > 2.35.1 > > _______________________________________________ > Patchew-devel mailing list > Patchew-devel@redhat.com > https://listman.redhat.com/mailman/listinfo/patchew-devel > _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://listman.redhat.com/mailman/listinfo/patchew-devel
© 2016 - 2024 Red Hat, Inc.