- 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.exists')|selectattr('stat.islnk')|list|length == 3
- name: "Setup root mc - create directories for mc links"
become: true
state: directory
mode: "0700"
loop: ['.cache', '.config', '.local/share']
- when: links_exist.rc != 0
+ when: links_exist.results|selectattr('stat.exists')|selectattr('stat.islnk')|list|length != 3
- name: "Setup root mc - remove mc directories"
become: true
path: "~root/{{ item }}"
state: absent
loop: ['.cache/mc', '.config/mc', '.local/share/mc']
- when: links_exist.rc != 0
+ when: links_exist.results|selectattr('stat.exists')|selectattr('stat.islnk')|list|length != 3
- name: "Setup root mc - link mc directories (1)"
become: true
src: "../.mc"
force: yes
loop: ['.cache/mc', '.config/mc']
- when: links_exist.rc != 0
+ when: links_exist.results|selectattr('stat.exists')|selectattr('stat.islnk')|list|length != 3
- name: "Setup root mc - link mc directories (2)"
become: true
src: "../../.mc"
force: yes
loop: ['.local/share/mc']
- when: links_exist.rc != 0
+ when: links_exist.results|selectattr('stat.exists')|selectattr('stat.islnk')|list|length != 3
- name: "Setup root mc - overwrite files from ~phd/admin"
become: true
mode: "0600"
force: yes
loop: ['hotlist', 'ini', 'panels.ini']
-