- 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 }}"