feat(*): allow for filtering the playbook by role
Allow for appending ansible-playbook arguments to the dotfiles script, and automatically applying tags to the included roles. For example: `./bin/dotfiles --tags=neovim`
This commit is contained in:
parent
093df0ac09
commit
7ee57545ce
|
@ -23,4 +23,4 @@ run_playbook() {
|
||||||
|
|
||||||
clone_or_update_dotfiles
|
clone_or_update_dotfiles
|
||||||
install_dependencies
|
install_dependencies
|
||||||
run_playbook
|
run_playbook "${@}"
|
||||||
|
|
15
main.yaml
15
main.yaml
|
@ -2,13 +2,22 @@
|
||||||
- hosts: localhost
|
- hosts: localhost
|
||||||
tasks:
|
tasks:
|
||||||
- name: Set roles
|
- name: Set roles
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
roles: "{{ default_roles | difference(exclude_roles | default([])) }}"
|
roles: "{{ default_roles | difference(exclude_roles | default([])) }}"
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
- name: Display roles
|
- name: Display roles
|
||||||
debug: "var=roles"
|
ansible.builtin.debug: "var=roles"
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
- name: Run roles
|
- name: Run roles
|
||||||
include_role:
|
ansible.builtin.include_role:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
|
apply:
|
||||||
|
tags:
|
||||||
|
- "{{ item }}"
|
||||||
with_items: "{{ roles }}"
|
with_items: "{{ roles }}"
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
Loading…
Reference in a new issue