-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaybook.yaml
More file actions
42 lines (38 loc) · 1.18 KB
/
Copy pathplaybook.yaml
File metadata and controls
42 lines (38 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
- name: configure dotfiles
hosts: localhost
gather_facts: false
tasks:
- name: sync repo
ansible.builtin.command:
cmd: git pull
chdir: "{{ playbook_dir }}"
register: git_pull
changed_when: "'Already up to date.' not in git_pull.stdout"
tags: always
- name: sync submodules
ansible.builtin.command:
cmd: git submodule update --init
chdir: "{{ playbook_dir }}"
register: git_submodule
changed_when: git_submodule.stdout | length > 0
tags: always
- name: find component tasks
ansible.builtin.find:
paths: "{{ playbook_dir }}"
patterns: tasks.yaml
recurse: true
depth: 2
register: task_files
tags: always
- name: include component tasks
ansible.builtin.include_tasks:
file: "{{ tasks_file.path }}"
apply:
tags: "{{ tasks_file.path | dirname | basename }}"
vars:
component: "{{ tasks_file.path | dirname | basename }}"
loop: "{{ task_files.files | sort(attribute='path') }}"
loop_control:
loop_var: tasks_file
label: "{{ tasks_file.path | dirname | basename }}"
tags: always