From 14eda6e7d5b31b7f51592cf0774f5216bd3f1f2b Mon Sep 17 00:00:00 2001 From: Gilles Dubreuil Date: Mon, 28 Oct 2024 11:33:40 +0100 Subject: [PATCH] Regroup pod restart --- roles/tpa_single_node/defaults/main.yml | 6 ++--- roles/tpa_single_node/handlers/main.yml | 4 ++++ .../tasks/bombastic/walker.yml | 2 +- .../tasks/install_manifest.yml | 13 +++++------ .../tasks/install_manifest_cronjob.yml | 22 +++++-------------- roles/tpa_single_node/tasks/main.yml | 4 ++++ .../templates/systemd/timer.j2 | 2 +- roles/tpa_single_node/vars/main.yml | 4 ++-- 8 files changed, 25 insertions(+), 32 deletions(-) diff --git a/roles/tpa_single_node/defaults/main.yml b/roles/tpa_single_node/defaults/main.yml index 207074a8..2580150d 100644 --- a/roles/tpa_single_node/defaults/main.yml +++ b/roles/tpa_single_node/defaults/main.yml @@ -1,10 +1,10 @@ --- # Storage Service -tpa_single_node_storage_type: s3 # Either s3 or minio or other s3 compatible +tpa_single_node_storage_type: minio # Either s3 or minio or other s3 compatible tpa_single_node_storage_region: eu-west-1 # # For Minio just keep eu-west-1 # SQS_SERVICE -tpa_single_node_event_bus_type: sqs # Either kafka or sqs +tpa_single_node_event_bus_type: kafka # Either kafka or sqs ### AWS SQS fields tpa_single_node_sqs_region: eu-west-1 # AWS SQS Region # SSO_SERVICE -tpa_single_node_oidc_type: cognito # Either Keycloak or AWS Cognito +tpa_single_node_oidc_type: keycloak # Either Keycloak or AWS Cognito diff --git a/roles/tpa_single_node/handlers/main.yml b/roles/tpa_single_node/handlers/main.yml index ed97d539..13b22203 100644 --- a/roles/tpa_single_node/handlers/main.yml +++ b/roles/tpa_single_node/handlers/main.yml @@ -1 +1,5 @@ --- +- name: Reload systemd + ansible.builtin.systemd_service: + name: "{{ item }}" + loop: "{{ services }}" diff --git a/roles/tpa_single_node/tasks/bombastic/walker.yml b/roles/tpa_single_node/tasks/bombastic/walker.yml index 1009cc24..2ea520b2 100644 --- a/roles/tpa_single_node/tasks/bombastic/walker.yml +++ b/roles/tpa_single_node/tasks/bombastic/walker.yml @@ -12,4 +12,4 @@ pattern: 1h # *:0/10 for realtime instead of monotonic kube_file_content: "{{ lookup('ansible.builtin.template', 'manifests/bombastic/walker/Deployment.yaml.j2') | from_yaml }}" configmaps: - - "{{ tpa_single_node_kube_manifest_dir }}/ConfigMaps/custom-trust-anchor.yaml" \ No newline at end of file + - "{{ tpa_single_node_kube_manifest_dir }}/ConfigMaps/custom-trust-anchor.yaml" diff --git a/roles/tpa_single_node/tasks/install_manifest.yml b/roles/tpa_single_node/tasks/install_manifest.yml index fa770273..2cae929d 100644 --- a/roles/tpa_single_node/tasks/install_manifest.yml +++ b/roles/tpa_single_node/tasks/install_manifest.yml @@ -22,11 +22,8 @@ mode: "0600" register: copy_systemd_file -- name: Restart Podman Service - ansible.builtin.systemd: - state: restarted - enabled: true - daemon_reload: true - name: "{{ podman_spec.systemd_file }}" - no_block: true - when: copy_manifest.changed or copy_systemd_file.changed +- name: Add {{ podman_spec.systemd_file }} to services list + ansible.builtin.set_fact: + services: "{{ services + [ podman_spec.systemd_file ] }}" + changed_when: true + notify: Reload systemd diff --git a/roles/tpa_single_node/tasks/install_manifest_cronjob.yml b/roles/tpa_single_node/tasks/install_manifest_cronjob.yml index e71d575d..b79cc447 100644 --- a/roles/tpa_single_node/tasks/install_manifest_cronjob.yml +++ b/roles/tpa_single_node/tasks/install_manifest_cronjob.yml @@ -27,20 +27,8 @@ mode: "0600" register: copy_systemd_timer_file -- name: Restart Podman Service - ansible.builtin.systemd: - state: started - enabled: true - daemon_reload: false - name: "{{ podman_spec.systemd_file }}" - no_block: true - when: copy_manifest.changed or copy_systemd_file.changed - -- name: Restart Timer Podman Service - ansible.builtin.systemd: - state: started - enabled: true - daemon_reload: false - name: "{{ podman_spec.systemd_file }}.timer" - no_block: true - when: copy_manifest.changed or copy_systemd_timer_file.changed +- name: Add {{ podman_spec.systemd_file }} to services list + ansible.builtin.set_fact: + services: "{{ services + [ podman_spec.systemd_file ] }}" + changed_when: true + notify: Reload systemd diff --git a/roles/tpa_single_node/tasks/main.yml b/roles/tpa_single_node/tasks/main.yml index 83c3080c..6779d749 100644 --- a/roles/tpa_single_node/tasks/main.yml +++ b/roles/tpa_single_node/tasks/main.yml @@ -15,6 +15,10 @@ - ansible_facts['distribution_major_version'] == '9' - (ansible_facts['distribution_version'] | split('.'))[1] | int >= 3 +- name: Create Services list + ansible.builtin.set_fact: + services: [] + - name: Install Operating System Components ansible.builtin.include_tasks: os.yml when: rhel diff --git a/roles/tpa_single_node/templates/systemd/timer.j2 b/roles/tpa_single_node/templates/systemd/timer.j2 index 618d36e4..3b77709c 100644 --- a/roles/tpa_single_node/templates/systemd/timer.j2 +++ b/roles/tpa_single_node/templates/systemd/timer.j2 @@ -13,4 +13,4 @@ Persistent=true {% endif %} [Install] -WantedBy=timers.target \ No newline at end of file +WantedBy=timers.target diff --git a/roles/tpa_single_node/vars/main.yml b/roles/tpa_single_node/vars/main.yml index 3961ff4b..eb0dd881 100644 --- a/roles/tpa_single_node/vars/main.yml +++ b/roles/tpa_single_node/vars/main.yml @@ -10,7 +10,7 @@ tpa_single_node_systemd_directory: /etc/systemd/system tpa_single_node_default_empty: "" # DB_SERVICE -tpa_single_node_pg_install_enabled: true +tpa_single_node_pg_install_enabled: false tpa_single_node_pg_host: "{{ lookup('env', 'TPA_PG_HOST') | default('192.168.121.60', true) }}" tpa_single_node_pg_port: 5432 tpa_single_node_pg_db: guac @@ -18,7 +18,7 @@ tpa_single_node_pg_admin: "{{ lookup('env', 'TPA_PG_ADMIN') }}" tpa_single_node_pg_admin_passwd: "{{ lookup('env', 'TPA_PG_ADMIN_PASSWORD') }}" tpa_single_node_pg_user: "{{ lookup('env', 'TPA_PG_USER') }}" tpa_single_node_pg_user_passwd: "{{ lookup('env', 'TPA_PG_USER_PASSWORD') }}" -tpa_single_node_pg_ssl_mode: disable +tpa_single_node_pg_ssl_mode: require # Storage Service tpa_single_node_storage_access_key: "{{ lookup('env', 'TPA_STORAGE_ACCESS_KEY') }}" # S3/minio root username