Skip to content

Commit 7b206fc

Browse files
committed
move systemd unit modifications to start of site.yml
1 parent 5351c64 commit 7b206fc

File tree

6 files changed

+21
-10
lines changed

6 files changed

+21
-10
lines changed

ansible/bootstrap.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@
3737
- name: Reset ssh connection to allow user changes to affect ansible_user
3838
meta: reset_connection
3939

40+
- hosts: systemd
41+
become: yes
42+
gather_facts: false
43+
tags: systemd
44+
tasks:
45+
- name: Make systemd unit modifications
46+
import_role:
47+
name: systemd
48+
4049
- hosts: selinux
4150
gather_facts: false
4251
become: yes

ansible/roles/systemd/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ Create drop-in files for systemd services.
1616
- `group`: Required str. Inventory group this drop-in applies to.
1717
- `comment`: Optional str. Comment describing reason for drop-in.
1818
- `content`: Required str. Content of drop-in file.
19+
- `systemd_restart`: Optional bool. Whether to reload unit definitions and restart services. Default `false`.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#systemd_dropins:
2+
# <unit_name>:
3+
# group: <required>
4+
# comment: <optional>
5+
# content: <required>
6+
7+
systemd_restart: false

ansible/roles/systemd/tasks/main.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
- name: Reload unit definitions
2626
ansible.builtin.shell:
2727
cmd: systemctl daemon-reload
28-
when: _systemd_dropins.changed
28+
when:
29+
- _systemd_dropins.changed
30+
- systemd_restart | default(false) | bool
2931

3032
- name: Reload units
3133
ansible.builtin.systemd:
@@ -35,3 +37,4 @@
3537
when:
3638
- _systemd_dropins.changed
3739
- "item.value.group in group_names"
40+
- systemd_restart | default(false) | bool

ansible/site.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
- import_playbook: portal.yml
2323
- import_playbook: monitoring.yml
2424
- import_playbook: iam.yml
25-
- import_playbook: systemd.yml
2625

2726
- name: Run post.yml hook
2827
vars:

ansible/systemd.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)