X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=playbooks%2Fdebian%2Froles%2Fphd%2Ftasks%2Fmain.yml;h=4c00ec5d2d369e06b92bd489fa10d1df1ce921a7;hb=318b40472983283e5ecaf9597effaec8ec9e77b4;hp=98973042f96342b798268e71915f507ff76a0979;hpb=4ddac78094546713d0e96f88932a0a9cfd1432ae;p=ansible.git diff --git a/playbooks/debian/roles/phd/tasks/main.yml b/playbooks/debian/roles/phd/tasks/main.yml index 9897304..4c00ec5 100644 --- a/playbooks/debian/roles/phd/tasks/main.yml +++ b/playbooks/debian/roles/phd/tasks/main.yml @@ -1,11 +1,12 @@ - name: Test if user phd already exists - command: test -f ~/.profile -a -f ~/.shellrc - failed_when: false - register: phd_exist + stat: + path: "{{ item }}" + register: phd_exists + loop: ['~/.profile', '~/.shellrc'] - debug: msg: "User phd has already been created" - when: phd_exist.rc == 0 + when: phd_exists.results|selectattr('stat.exists')|list|length == 2 - name: Create and setup user phd block: @@ -15,4 +16,4 @@ unarchive: src: ~/archive/STORE/phd/Home/phd.tar.bz2 dest: /home - when: phd_exist.rc != 0 + when: phd_exists.results|selectattr('stat.exists')|list|length == 2