-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.yaml
More file actions
72 lines (62 loc) · 1.67 KB
/
main.yaml
File metadata and controls
72 lines (62 loc) · 1.67 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
- name: Dotfiles bootstrap
hosts: localhost
connection: local
# vars_files:
# - Pop!_OS.yaml
pre_tasks:
- name: Load ENVs
ansible.builtin.import_tasks: pre_tasks/load-envs.yaml
tags:
- always
- name: "Import var file {{ playbook_name }}"
ansible.builtin.include_vars:
file: "vars/{{ playbook_name }}.yaml"
tags:
- always
when: playbook_name is defined
# obtained from
# - https://github.com/TechDufus/dotfiles/blob/c8280a1/main.yml#L7-L10
- name: Detect WSL
ansible.builtin.import_tasks: pre_tasks/detect-wsl.yaml
tags:
- always
tasks:
# - name: Print all available facts
# ansible.builtin.debug:
# var: ansible_facts
# tags:
# - always
- name: Print fact playbook
ansible.builtin.debug:
var: playbook_name
when: playbook_name is defined
tags:
- always
- name: Print default_roles
ansible.builtin.debug:
var: default_roles
when: playbook_name is defined
tags:
- always
- name: Set roles
ansible.builtin.set_fact:
run_roles: "{% if ansible_run_tags | list == ['all'] %}{{ default_roles }}{% else %}{{ ansible_run_tags | list | difference(['all']) }}{% endif %}"
tags:
- always
- name: Roles to run
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