Skip to content

Commit c97dc32

Browse files
Michael Vasseurvmcj
authored andcommitted
Bundle all actions with same condition
1 parent 1d6d28e commit c97dc32

File tree

1 file changed

+18
-18
lines changed
  • provision-contest/ansible/roles/system_fixes/tasks

1 file changed

+18
-18
lines changed

provision-contest/ansible/roles/system_fixes/tasks/main.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,27 @@
4343
notify: Update dconf
4444
when: GRAPHICAL
4545

46-
- name: Configure static IP address
47-
template:
48-
src: static_ip.j2
49-
dest: /etc/network/interfaces.d/{{ STATIC_IP_INTERFACE }}
50-
notify: Reboot the machine
46+
- name: Configure network for static IP address
5147
when: STATIC_IP_ENABLED
48+
block:
49+
- name: Configure static IP address
50+
template:
51+
src: static_ip.j2
52+
dest: /etc/network/interfaces.d/{{ STATIC_IP_INTERFACE }}
53+
notify: Reboot the machine
5254

53-
- name: Load configuration from /etc/network/interfaces.d
54-
lineinfile:
55-
path: /etc/network/interfaces
56-
line: 'source-directory /etc/network/interfaces.d'
57-
notify: Reboot the machine
58-
when: STATIC_IP_ENABLED
55+
- name: Load configuration from /etc/network/interfaces.d
56+
lineinfile:
57+
path: /etc/network/interfaces
58+
line: 'source-directory /etc/network/interfaces.d'
59+
notify: Reboot the machine
5960

60-
- name: Use 8.8.8.8 as DNS server
61-
lineinfile:
62-
path: /etc/systemd/resolved.conf
63-
regexp: '^#?DNS='
64-
line: 'DNS=8.8.8.8'
65-
notify: Reboot the machine
66-
when: STATIC_IP_ENABLED
61+
- name: Use 8.8.8.8 as DNS server
62+
lineinfile:
63+
path: /etc/systemd/resolved.conf
64+
regexp: '^#?DNS='
65+
line: 'DNS=8.8.8.8'
66+
notify: Reboot the machine
6767

6868
- name: Flush handlers
6969
meta: flush_handlers

0 commit comments

Comments
 (0)