X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=playbooks%2Fdebian%2Froles%2Fphd%2Ftasks%2Fmain.yml;h=a26a738cf7af22bece6f41f84bdfbfd51312f2a9;hb=86f60f40dd650fcf9ac23e40b9afa8357d00e2c2;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..a26a738 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,40 @@ - 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: Remove mc directories + file: + path: "{{ item }}" + state: absent + loop: ['~/.cache/mc', '~/.config/mc', '~/.local/share/mc'] + - 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