X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=playbooks%2Fdebian%2Froles%2Fphd%2Ftasks%2Fmain.yml;h=2c7373c0845e7ba58b5cd9f437cc92aa2bf8c0c8;hb=2e89ce86ff469b61661a0c7335b75ba6d5bcf05f;hp=455605f45225f57ee9cd14ba4ef9505991f20cce;hpb=009018ea1ff7e3eab45c523559c0271850da228b;p=ansible.git diff --git a/playbooks/debian/roles/phd/tasks/main.yml b/playbooks/debian/roles/phd/tasks/main.yml index 455605f..2c7373c 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 - ignore_errors: true - 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