Skip to content

Commit

Permalink
Regroup pod restart
Browse files Browse the repository at this point in the history
  • Loading branch information
gildub committed Oct 28, 2024
1 parent ee4e968 commit 30fa137
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 26 deletions.
4 changes: 4 additions & 0 deletions roles/tpa_single_node/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
---
- name: Reload systemd
ansible.builtin.systemd_service:
name: "{{ item }}"
loop: "{{ services }}"
13 changes: 5 additions & 8 deletions roles/tpa_single_node/tasks/install_manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] }}"

Check warning on line 27 in roles/tpa_single_node/tasks/install_manifest.yml

View workflow job for this annotation

GitHub Actions / ansible-lint

jinja[spacing]

Jinja2 spacing could be improved: {{ services + [ podman_spec.systemd_file ] }} -> {{ services + \[podman_spec.systemd_file] }}
changed_when: true
notify: Reload systemd
24 changes: 6 additions & 18 deletions roles/tpa_single_node/tasks/install_manifest_cronjob.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,10 @@
src: systemd/timer.j2
dest: "{{ tpa_single_node_systemd_directory + '/' + podman_spec.systemd_file }}.timer"
mode: "0600"
register: copy_systemd_timer_file
register: copy_systemd_timer_file045011

- 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 ] }}"

Check warning on line 32 in roles/tpa_single_node/tasks/install_manifest_cronjob.yml

View workflow job for this annotation

GitHub Actions / ansible-lint

jinja[spacing]

Jinja2 spacing could be improved: {{ services + [ podman_spec.systemd_file ] }} -> {{ services + \[podman_spec.systemd_file] }}
changed_when: true
notify: Reload systemd
4 changes: 4 additions & 0 deletions roles/tpa_single_node/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 30fa137

Please sign in to comment.