File tree Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 1438
1438
- name : Print kernel lockdown
1439
1439
ansible.builtin.debug :
1440
1440
msg : " {{ kernel_lockdown.stdout }}"
1441
+
1442
+ - name : Verify netplan files permissions
1443
+ become : true
1444
+ block :
1445
+ - name : Find all netplan configuration files
1446
+ ansible.builtin.find :
1447
+ paths :
1448
+ - /etc/netplan
1449
+ - /lib/netplan
1450
+ - /run/netplan
1451
+ recurse : true
1452
+ patterns : " *.yaml"
1453
+ register : netplan_configuration
1454
+
1455
+ - name : Assert netplan files permissions
1456
+ ansible.builtin.assert :
1457
+ that :
1458
+ - item.mode == "0600"
1459
+ success_msg : " {{ item.path }} has correct permissions: {{ item.mode }}"
1460
+ fail_msg : " {{ item.path }} permissions are incorrect: {{ item.mode }}"
1461
+ with_items :
1462
+ - " {{ netplan_configuration.files }}"
Original file line number Diff line number Diff line change 323
323
tags :
324
324
- sudo
325
325
326
+ - name : Set netplan permissions
327
+ ansible.builtin.import_tasks :
328
+ file : netplan.yml
329
+ tags :
330
+ - netplan
331
+
326
332
- name : Miscellaneous extra tasks
327
333
ansible.builtin.import_tasks :
328
334
file : extras.yml
Original file line number Diff line number Diff line change
1
+ ---
2
+ - name : Find and set permissions of netplan configuration files
3
+ become : true
4
+ block :
5
+ - name : Find all netplan configuration files
6
+ ansible.builtin.find :
7
+ paths :
8
+ - /etc/netplan
9
+ - /lib/netplan
10
+ - /run/netplan
11
+ recurse : true
12
+ patterns : " *.yaml"
13
+ register : netplan_configuration
14
+
15
+ - name : Set permissions of netplan configuration files
16
+ ansible.builtin.file :
17
+ path : " {{ item.path }}"
18
+ mode : " 0600"
19
+ owner : root
20
+ group : root
21
+ with_items :
22
+ - " {{ netplan_configuration.files }}"
You can’t perform that action at this time.
0 commit comments