-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.yml
50 lines (45 loc) · 1.58 KB
/
main.yml
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
43
44
45
46
47
48
49
50
- name: DotFiles Config
hosts: all
gather_facts: yes
pre_tasks:
- name: Import Configuration Tasks Based on Conditions
include_tasks: "{{ pre_task.path }}"
loop:
- { path: 'pre_tasks/package_manager/tasks/main.yml', condition: 'package_manager' }
- { path: 'pre_tasks/detect_vm/tasks/main.yml', condition: 'detect_vm' }
- { path: 'pre_tasks/drivers/tasks/main.yml', condition: 'drivers' }
- { path: 'pre_tasks/laptop_workarounds/tasks/main.yml', condition: 'laptop_workarounds' }
- { path: 'pre_tasks/system/tasks/main.yml', condition: 'system' }
loop_control:
loop_var: pre_task
when: pre_task.condition in pre_tasks
tasks:
- name: Set roles
ansible.builtin.set_fact:
run_roles: "{{ ansible_run_tags != ['all'] and ansible_run_tags or default_roles | difference(exclude_roles | default([])) }}"
tags:
- always
- name: Display roles
ansible.builtin.debug:
var: run_roles
tags:
- always
- name: Run roles
ansible.builtin.include_role:
apply:
tags:
- "{{ roles_item }}"
name: "{{ roles_item }}"
loop_control:
loop_var: roles_item
with_items: "{{ run_roles }}"
tags:
- always
post_tasks:
- name: Import Cleanup Tasks Based on Conditions
include_tasks: "{{ post_task.path }}"
loop:
- { path: 'post_tasks/package_cleanup/tasks/main.yml', condition: 'package_cleanup' }
loop_control:
loop_var: post_task
when: post_task.condition in post_tasks