summaryrefslogtreecommitdiffstats
path: root/validate-installation
diff options
context:
space:
mode:
authorManuel Bentele2021-07-05 14:46:12 +0200
committerManuel Bentele2021-07-05 14:46:12 +0200
commitd6efcc69f2ff30dd0fd030f45296d4827e79d26a (patch)
treeccf1c97a278712ad65a868b3c17f15be4732cc97 /validate-installation
parent[mltk-qemu] Add build of 'qemu' mltk target (diff)
downloadansible-bwlp-d6efcc69f2ff30dd0fd030f45296d4827e79d26a.tar.gz
ansible-bwlp-d6efcc69f2ff30dd0fd030f45296d4827e79d26a.tar.xz
ansible-bwlp-d6efcc69f2ff30dd0fd030f45296d4827e79d26a.zip
[validate-installation] Add role to check UIDs/GIDs after installation
Diffstat (limited to 'validate-installation')
-rw-r--r--validate-installation/tasks/main.yml22
1 files changed, 22 insertions, 0 deletions
diff --git a/validate-installation/tasks/main.yml b/validate-installation/tasks/main.yml
new file mode 100644
index 0000000..44d1720
--- /dev/null
+++ b/validate-installation/tasks/main.yml
@@ -0,0 +1,22 @@
+---
+- name: validate-installation | Get all users from the installed system
+ getent:
+ database: passwd
+
+- name: validate-installation | Assert that all users have an UID smaller or equal than 1000
+ fail:
+ msg: "User {{ item }} has the UID {{ getent_passwd[item].1 }} > 1000!"
+ when: ((getent_passwd[item].1 | int) > 1000) and (item != "nobody")
+ with_items:
+ - "{{ getent_passwd.keys() | list }}"
+
+- name: validate-installation | Get all groups from the installed system
+ getent:
+ database: group
+
+- name: validate-installation | Assert that all groups have a GID smaller or equal than 1000
+ fail:
+ msg: "Group {{ item }} has the GID {{ getent_group[item].1 }} > 1000!"
+ when: ((getent_group[item].1 | int) > 1000) and (item != "nogroup")
+ with_items:
+ - "{{ getent_group.keys() | list }}"