SHA256
1
0
Files
deploy/roles/scripts/tasks/main.yml

31 lines
896 B
YAML

---
- name: Glob all files in role directory
ansible.builtin.find:
paths: "{{ role_path }}"
depth: 1
file_type: file
register: scripts_files
- name: "Ensure script directory exist"
ansible.builtin.file:
path: "{{ ansible_facts.env.HOME }}/.local/bin"
state: directory
mode: "0755"
- name: "Deploy scripts (local with symlinks)"
ansible.builtin.file:
src: "{{ item.path }}"
dest: "{{ ansible_facts.env.HOME }}/.local/bin/{{ item.path | basename }}"
state: link
force: true
loop: "{{ scripts_files.files }}"
when: ansible_connection in ['local', 'localhost']
- name: "Deploy scripts (remote with copy)"
ansible.builtin.copy:
src: "{{ item.path }}"
dest: "{{ ansible_facts.env.HOME }}/.local/bin/{{ item.path | basename }}"
mode: '0755'
loop: "{{ scripts_files.files }}"
when: ansible_connection not in ['local', 'localhost']