X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=playbooks%2Fdebian%2Froles%2Fphd%2Ftasks%2Fmain.yml;h=1ca3a4b3c8340b70fd436ce2a836328395618a41;hb=e2f84bb9d51c4452b61763857dee14db8bc32824;hp=4c00ec5d2d369e06b92bd489fa10d1df1ce921a7;hpb=32266b707ada32788d608fa6fbe7f1de623f2755;p=ansible.git diff --git a/playbooks/debian/roles/phd/tasks/main.yml b/playbooks/debian/roles/phd/tasks/main.yml index 4c00ec5..1ca3a4b 100644 --- a/playbooks/debian/roles/phd/tasks/main.yml +++ b/playbooks/debian/roles/phd/tasks/main.yml @@ -2,6 +2,7 @@ stat: path: "{{ item }}" register: phd_exists + changed_when: not phd_exists.stat.exists loop: ['~/.profile', '~/.shellrc'] - debug: @@ -10,10 +11,27 @@ - name: Create and setup user phd block: - - name: Create user phd - import_tasks: create.yml + - 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: "{{ system_groups }}" + - name: Upload and extract home archive unarchive: src: ~/archive/STORE/phd/Home/phd.tar.bz2 dest: /home - when: phd_exists.results|selectattr('stat.exists')|list|length == 2 + when: phd_exists.results|selectattr('stat.exists')|list|length != 2