X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=playbooks%2Fdebian%2Froles%2Fphd%2Ftasks%2Fmain.yml;h=a8ea36ee63e6470f0268b39f44761ab65d0ee1ff;hb=d8db111bb38f5d764ddfa853629a42e86e9572ac;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..a8ea36e 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,34 @@ - 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 + + - name: Add alias + become: true + lineinfile: + path: /etc/aliases + regexp: "^root: phd$" + line: "root: phd" + when: phd_exists.results|selectattr('stat.exists')|list|length != 2