X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=playbooks%2Fdebian%2Froles%2Froot%2Ftasks%2Fmc.yml;h=dbb78bad25e8639dc1a4e7d4f3e34284f15d6bdf;hb=32266b707ada32788d608fa6fbe7f1de623f2755;hp=e46d622f7731aeab7a24fb220f2e5f2762f8846e;hpb=edf447b86f291118443987ab67de35b99e9b2d38;p=ansible.git diff --git a/playbooks/debian/roles/root/tasks/mc.yml b/playbooks/debian/roles/root/tasks/mc.yml index e46d622..dbb78ba 100644 --- a/playbooks/debian/roles/root/tasks/mc.yml +++ b/playbooks/debian/roles/root/tasks/mc.yml @@ -1,12 +1,13 @@ - name: "Setup root mc - check mc links" become: true - command: test -L ~root/.cache/mc -a -L ~root/.config/mc -a -L ~root/.local/share/mc - failed_when: false + stat: + path: "{{ item }}" register: links_exist + loop: ['~root/.cache/mc', '~root/.config/mc', '~root/.local/share/mc'] - debug: msg: "mc links have already been created" - when: links_exist.rc == 0 + when: links_exist.results|selectattr('stat.islnk')|list|length == 3 - name: "Setup root mc - create directories for mc links" become: true @@ -15,7 +16,7 @@ state: directory mode: "0700" loop: ['.cache', '.config', '.local/share'] - when: links_exist.rc != 0 + when: links_exist.results|selectattr('stat.islnk')|list|length == 3 - name: "Setup root mc - remove mc directories" become: true @@ -23,7 +24,7 @@ path: "~root/{{ item }}" state: absent loop: ['.cache/mc', '.config/mc', '.local/share/mc'] - when: links_exist.rc != 0 + when: links_exist.results|selectattr('stat.islnk')|list|length == 3 - name: "Setup root mc - link mc directories (1)" become: true @@ -33,7 +34,7 @@ src: "../.mc" force: yes loop: ['.cache/mc', '.config/mc'] - when: links_exist.rc != 0 + when: links_exist.results|selectattr('stat.islnk')|list|length == 3 - name: "Setup root mc - link mc directories (2)" become: true @@ -43,9 +44,9 @@ src: "../../.mc" force: yes loop: ['.local/share/mc'] - when: links_exist.rc != 0 + when: links_exist.results|selectattr('stat.islnk')|list|length == 3 -- name: "Setup root ms - overwrite files from ~phd/admin" +- name: "Setup root mc - overwrite files from ~phd/admin" become: true copy: src: "~phd/admin/home/root/.mc/{{ item }}" @@ -56,4 +57,3 @@ mode: "0600" force: yes loop: ['hotlist', 'ini', 'panels.ini'] -