Do not fail when the registry is offline. Fix bug.

This commit is contained in:
yohan 2024-10-20 15:40:09 +02:00
parent 81f3a5a9d6
commit d7eea85c4b
13 changed files with 102 additions and 84 deletions

View File

@ -7,16 +7,16 @@
register: result_apache_scuttle_systemd_stop
failed_when: "result_apache_scuttle_systemd_stop is failed and 'Could not find the requested service' not in result_apache_scuttle_systemd_stop.msg"
- name: Check if apache-scuttle container exists
containers.podman.podman_container_info:
name: apache-scuttle
register: apache_scuttle_podman_info
- name: Check if apache-scuttle container is running
command: 'podman ps -q --filter "name=apache-scuttle"'
changed_when: false
register: podman_ps
become: true
- name: Assert that no apache-scuttle container already exists
- name: Assert that no apache-scuttle container is running
ansible.builtin.assert:
that:
- apache_scuttle_podman_info.containers | length == 0
- podman_ps.stdout_lines | length == 0
- name: Stop container service
ansible.builtin.systemd:
@ -26,16 +26,16 @@
register: result_php5_fpm_systemd_stop
failed_when: "result_php5_fpm_systemd_stop is failed and 'Could not find the requested service' not in result_php5_fpm_systemd_stop.msg"
- name: Check if php5-fpm container exists
containers.podman.podman_container_info:
name: php5-fpm
register: php5_fpm_podman_info
- name: Check if php5-fpm container is running
command: 'podman ps -q --filter "name=php5-fpm"'
changed_when: false
register: podman_ps
become: true
- name: Assert that no php5-fpm container already exists
- name: Assert that no php5-fpm container is running
ansible.builtin.assert:
that:
- php5_fpm_podman_info.containers | length == 0
- podman_ps.stdout_lines | length == 0
- name: Check if restore from backup is already done
stat:
@ -113,6 +113,8 @@
password: "{{ private_registry_password }}"
registry: "{{ private_registry_domain }}"
changed_when: false
# We ignore failures because the image should be in the cache
failed_when: false
become: true
- name: Create apache-scuttle container

View File

@ -7,16 +7,16 @@
register: result_global_cron_systemd_stop
failed_when: "result_global_cron_systemd_stop is failed and 'Could not find the requested service' not in result_global_cron_systemd_stop.msg"
- name: Check if global-cron container exists
containers.podman.podman_container_info:
name: global-cron
register: global_cron_podman_info
- name: Check if global-cron container is running
command: 'podman ps -q --filter "name=global-cron"'
changed_when: false
register: podman_ps
become: true
- name: Assert that no global-cron container already exists
- name: Assert that no global-cron container is running
ansible.builtin.assert:
that:
- global_cron_podman_info.containers | length == 0
- podman_ps.stdout_lines | length == 0
- name: Create /usr/local/docker-mounted-files/docker-global-cron-stack directory
ansible.builtin.file:
@ -113,6 +113,8 @@
password: "{{ private_registry_password }}"
registry: "{{ private_registry_domain }}"
changed_when: false
# We ignore failures because the image should be in the cache
failed_when: false
become: true
- name: Create cron container

View File

@ -7,16 +7,16 @@
register: result_dovecot_systemd_stop
failed_when: "result_dovecot_systemd_stop is failed and 'Could not find the requested service' not in result_dovecot_systemd_stop.msg"
- name: Check if dovecot container exists
containers.podman.podman_container_info:
name: dovecot
register: dovecot_podman_info
- name: Check if dovecot container is running
command: 'podman ps -q --filter "name=dovecot"'
changed_when: false
register: podman_ps
become: true
- name: Assert that no dovecot container already exists
- name: Assert that no dovecot container is running
ansible.builtin.assert:
that:
- dovecot_podman_info.containers | length == 0
- podman_ps.stdout_lines | length == 0
- name: Check if restore from backup is already done
stat:
@ -171,6 +171,8 @@
password: "{{ private_registry_password }}"
registry: "{{ private_registry_domain }}"
changed_when: false
# We ignore failures because the image should be in the cache
failed_when: false
become: true
- name: Create podman networks

View File

@ -7,16 +7,16 @@
register: result_feed2imap_systemd_stop
failed_when: "result_feed2imap_systemd_stop is failed and 'Could not find the requested service' not in result_feed2imap_systemd_stop.msg"
- name: Check if feed2imap container exists
containers.podman.podman_container_info:
name: feed2imap
register: feed2imap_podman_info
- name: Check if feed2imap container is running
command: 'podman ps -q --filter "name=feed2imap"'
changed_when: false
register: podman_ps
become: true
- name: Assert that no feed2imap container already exists
- name: Assert that no feed2imap container is running
ansible.builtin.assert:
that:
- feed2imap_podman_info.containers | length == 0
- podman_ps.stdout_lines | length == 0
- name: Create /usr/local/docker-mounted-files/docker-mail-stack directory
ansible.builtin.file:
@ -55,6 +55,8 @@
password: "{{ private_registry_password }}"
registry: "{{ private_registry_domain }}"
changed_when: false
# We ignore failures because the image should be in the cache
failed_when: false
become: true
- name: Create podman networks

View File

@ -12,16 +12,16 @@
register: result_fetchmail_systemd_stop
failed_when: "result_fetchmail_systemd_stop is failed and 'Could not find the requested service' not in result_fetchmail_systemd_stop.msg"
- name: Check if fetchmail-{{ fetchmail_instance }} container exists
containers.podman.podman_container_info:
name: "fetchmail-{{ fetchmail_instance }}"
register: fetchmail_podman_info
- name: Check if fetchmail-{{ fetchmail_instance }} container is running
command: 'podman ps -q --filter "name=fetchmail-{{ fetchmail_instance }}"'
changed_when: false
register: podman_ps
become: true
- name: Assert that no fetchmail-{{ fetchmail_instance }} container already exists
- name: Assert that no fetchmail-{{ fetchmail_instance }} container is running
ansible.builtin.assert:
that:
- fetchmail_podman_info.containers | length == 0
- podman_ps.stdout_lines | length == 0
- name: Create /usr/local/docker-mounted-files/docker-mail-stack directory
ansible.builtin.file:
@ -75,6 +75,8 @@
password: "{{ private_registry_password }}"
registry: "{{ private_registry_domain }}"
changed_when: false
# We ignore failures because the image should be in the cache
failed_when: false
become: true
- name: Create fetchmail-{{ fetchmail_instance }} container

View File

@ -7,16 +7,16 @@
register: result_grafana_systemd_stop
failed_when: "result_grafana_systemd_stop is failed and 'Could not find the requested service' not in result_grafana_systemd_stop.msg"
- name: Check if grafana container exists
containers.podman.podman_container_info:
name: grafana
register: grafana_podman_info
- name: Check if grafana container is running
command: 'podman ps -q --filter "name=grafana"'
changed_when: false
register: podman_ps
become: true
- name: Assert that no grafana container already exists
- name: Assert that no grafana container is running
ansible.builtin.assert:
that:
- grafana_podman_info.containers | length == 0
- podman_ps.stdout_lines | length == 0
- name: Check if restore from backup is already done
stat:

View File

@ -7,16 +7,16 @@
register: result_nextcloud_systemd_stop
failed_when: "result_nextcloud_systemd_stop is failed and 'Could not find the requested service' not in result_nextcloud_systemd_stop.msg"
- name: Check if nextcloud container exists
containers.podman.podman_container_info:
name: nextcloud
register: nextcloud_podman_info
- name: Check if nextcloud container is running
command: 'podman ps -q --filter "name=nextcloud"'
changed_when: false
register: podman_ps
become: true
- name: Assert that no nextcloud container already exists
- name: Assert that no nextcloud container is running
ansible.builtin.assert:
that:
- nextcloud_podman_info.containers | length == 0
- podman_ps.stdout_lines | length == 0
- name: Check if restore from backup is already done
stat:
@ -90,6 +90,8 @@
password: "{{ private_registry_password }}"
registry: "{{ private_registry_domain }}"
changed_when: false
# We ignore failures because the image should be in the cache
failed_when: false
become: true
- name: Create podman networks

View File

@ -7,16 +7,16 @@
register: result_onlyoffice_document_server_systemd_stop
failed_when: "result_onlyoffice_document_server_systemd_stop is failed and 'Could not find the requested service' not in result_onlyoffice_document_server_systemd_stop.msg"
- name: Check if onlyoffice-document-server container exists
containers.podman.podman_container_info:
name: onlyoffice-document-server
register: onlyoffice_document_server_podman_info
- name: Check if onlyoffice-document-server container is running
command: 'podman ps -q --filter "name=onlyoffice-document-server"'
changed_when: false
register: podman_ps
become: true
- name: Assert that no onlyoffice-document-server container already exists
- name: Assert that no onlyoffice-document-server container is running
ansible.builtin.assert:
that:
- onlyoffice_document_server_podman_info.containers | length == 0
- podman_ps.stdout_lines | length == 0
- name: Create volume directories
ansible.builtin.file:

View File

@ -7,16 +7,16 @@
register: result_openvpn_server_systemd_stop
failed_when: "result_openvpn_server_systemd_stop is failed and 'Could not find the requested service' not in result_openvpn_server_systemd_stop.msg"
- name: Check if openvpn-server container exists
containers.podman.podman_container_info:
name: openvpn-server
register: openvpn_server_podman_info
- name: Check if openvpn-server container is running
command: 'podman ps -q --filter "name=openvpn-server"'
changed_when: false
register: podman_ps
become: true
- name: Assert that no openvpn-server container already exists
- name: Assert that no openvpn-server container is running
ansible.builtin.assert:
that:
- openvpn_server_podman_info.containers | length == 0
- podman_ps.stdout_lines | length == 0
# Everything in this volume comes from Git. No need to back it up.
- name: Create /mnt/volumes/openvpn-server_conf directory
@ -92,6 +92,8 @@
password: "{{ private_registry_password }}"
registry: "{{ private_registry_domain }}"
changed_when: false
# We ignore failures because the image should be in the cache
failed_when: false
become: true
- name: Create openvpn-server container

View File

@ -7,16 +7,16 @@
register: result_registry_systemd_stop
failed_when: "result_registry_systemd_stop is failed and 'Could not find the requested service' not in result_registry_systemd_stop.msg"
- name: Check if registry container exists
containers.podman.podman_container_info:
name: registry
register: registry_podman_info
- name: Check if registry container is running
command: 'podman ps -q --filter "name=registry"'
changed_when: false
register: podman_ps
become: true
- name: Assert that no registry container already exists
- name: Assert that no registry container is running
ansible.builtin.assert:
that:
- registry_podman_info.containers | length == 0
- podman_ps.stdout_lines | length == 0
- name: Check if restore from backup is already done
stat:

View File

@ -7,16 +7,16 @@
register: result_store_metrics_in_db_systemd_stop
failed_when: "result_store_metrics_in_db_systemd_stop is failed and 'Could not find the requested service' not in result_store_metrics_in_db_systemd_stop.msg"
- name: Check if store-metrics-in-db container exists
containers.podman.podman_container_info:
name: store-metrics-in-db
register: store_metrics_in_db_podman_info
- name: Check if store-metrics-in-db container is running
command: 'podman ps -q --filter "name=store-metrics-in-db"'
changed_when: false
register: podman_ps
become: true
- name: Assert that no store-metrics-in-db container already exists
- name: Assert that no store-metrics-in-db container is running
ansible.builtin.assert:
that:
- store_metrics_in_db_podman_info.containers | length == 0
- podman_ps.stdout_lines | length == 0
- name: Create /usr/local/docker-mounted-files/docker-store-metrics-in-db-stack directory
ansible.builtin.file:
@ -39,6 +39,8 @@
password: "{{ private_registry_password }}"
registry: "{{ private_registry_domain }}"
changed_when: false
# We ignore failures because the image should be in the cache
failed_when: false
become: true
- name: Create podman networks

View File

@ -7,16 +7,16 @@
register: result_gogs_systemd_stop
failed_when: "result_gogs_systemd_stop is failed and 'Could not find the requested service' not in result_gogs_systemd_stop.msg"
- name: Check if gogs container exists
containers.podman.podman_container_info:
name: gogs
register: gogs_podman_info
- name: Check if gogs container is running
command: 'podman ps -q --filter "name=gogs"'
changed_when: false
register: podman_ps
become: true
- name: Assert that no gogs container already exists
- name: Assert that no gogs container is running
ansible.builtin.assert:
that:
- gogs_podman_info.containers | length == 0
- podman_ps.stdout_lines | length == 0
- name: Check if restore from backup is already done
stat:

View File

@ -7,16 +7,16 @@
register: result_mysql_server_systemd_stop
failed_when: "result_mysql_server_systemd_stop is failed and 'Could not find the requested service' not in result_mysql_server_systemd_stop.msg"
- name: Check if mysql-server container exists
containers.podman.podman_container_info:
name: mysql-server
register: mysql_server_podman_info
- name: Check if mysql-server container is running
command: 'podman ps -q --filter "name=mysql-server"'
changed_when: false
register: podman_ps
become: true
- name: Assert that no mysql-server container already exists
- name: Assert that no mysql-server container is running
ansible.builtin.assert:
that:
- mysql_server_podman_info.containers | length == 0
- podman_ps.stdout_lines | length == 0
- name: Check if restore from backup is already done
stat:
@ -37,6 +37,8 @@
password: "{{ private_registry_password }}"
registry: "{{ private_registry_domain }}"
changed_when: false
# We ignore failures because the image should be in the cache
failed_when: false
become: true
- name: Create mysql-server container