]> git.phdru.name Git - ansible.git/commitdiff
Feat(debian-init-user-phd): Create groups
authorOleg Broytman <phd@phdru.name>
Fri, 12 Jul 2019 00:14:18 +0000 (03:14 +0300)
committerOleg Broytman <phd@phdru.name>
Tue, 16 Jul 2019 18:28:41 +0000 (21:28 +0300)
playbooks/debian-init-user-phd.yml

index be5c8fab8a96320ffeb5cf4f85e8b9a190bef035..b8425995b93c4316e07f1d9626882aa1056df212 100644 (file)
@@ -1,13 +1,25 @@
 - name: Create user phd
   hosts: "{{ hosts | default('servers') }}"
   gather_facts: false
+  vars:
+    system_groups: root,adm,disk,cdrom,floppy,sudo,audio,www-data,video,plugdev,staff,users,Debian-exim,fuse,sambashare,input
   tasks:
+    - name: Create system groups
+      become: true
+      group:
+        name: "{{ item }}"
+        system: true
+      loop: "{{ system_groups.split(',') }}"
+    - name: Create group phd
+      become: true
+      group:
+        name: phd
     - name: Add user phd
       become: true
       user:
         name: phd
         group: phd
-        groups: root,adm,disk,cdrom,floppy,sudo,audio,www-data,video,plugdev,staff,users,Debian-exim,fuse,sambashare,input
+        groups: "{{ system_groups }}"
     - name: Create folder ~phd/.ssh
       file:
         path: ~phd/.ssh
         mode: 0600
 - name: Update local user phd
   hosts: localhost
+  gather_facts: false
+  vars:
+    system_groups: root,adm,disk,cdrom,floppy,sudo,audio,www-data,video,plugdev,staff,users,Debian-exim,fuse,sambashare,bluetooth,davfs2,vboxusers,input
   tasks:
+    - name: Create system groups
+      become: true
+      group:
+        name: "{{ item }}"
+        system: true
+      loop: "{{ system_groups.split(',') }}"
+    - name: Create group phd
+      become: true
+      group:
+        name: phd
     - name: user phd
       become: true
       user:
         name: phd
-        groups: root,adm,disk,cdrom,floppy,sudo,audio,www-data,video,plugdev,staff,users,Debian-exim,fuse,sambashare,bluetooth,davfs2,vboxusers,input
+        groups: "{{ system_groups }}"