Allow for dynamic tagging of ansible-pull hosts

This commit is contained in:
Salt 2021-08-07 17:09:20 -05:00
parent 07ea9806da
commit 759df2f593
3 changed files with 27 additions and 8 deletions

22
playbooks/ansible-pull.yml Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env ansible-playbook
# vim:ft=ansible:
---
- hosts: tags_ansible-pull
roles:
- role: ansible-pull
tags: [ ansible ]
- role: git
vars:
git_repos:
- repo: "{{ ansible_pull_repo }}"
dest: /etc/ansible
tags: [ ansible ]
- hosts: all
tasks:
- name: disable ansible-pull when not tagged
systemd: name={{ item }} state=stopped enabled=no
with_items:
- ansible-pull.timer
- ansible-pull.service
when: "'tags_ansible-pull' not in group_names and item in services"
tags: [ ansible ]

View File

@ -11,14 +11,6 @@
mount: path=/nfs/pi-storage-1.desu.ltd src=pi-storage-1.desu.ltd:/srv/nfs fstype=nfs4 opts="rsize=10248576,wsize=1048576,soft,timeo=600,retrans=2" state=mounted mount: path=/nfs/pi-storage-1.desu.ltd src=pi-storage-1.desu.ltd:/srv/nfs fstype=nfs4 opts="rsize=10248576,wsize=1048576,soft,timeo=600,retrans=2" state=mounted
tags: [ desktop, nfs ] tags: [ desktop, nfs ]
roles: roles:
- role: ansible-pull
tags: [ ansible, desktop ]
- role: git
vars:
git_repos:
- repo: "{{ ansible_pull_repo }}"
dest: /etc/ansible
tags: [ ansible, git, desktop ]
- role: backup - role: backup
vars: vars:
backup_s3backup_tar_args_extra: h backup_s3backup_tar_args_extra: h

View File

@ -3,6 +3,10 @@
--- ---
# Preambulatory system configuration # Preambulatory system configuration
- hosts: all - hosts: all
tasks:
- name: collect service facts
service_facts:
tags: [ always ]
roles: roles:
- role: common - role: common
tags: [ common ] tags: [ common ]
@ -41,3 +45,4 @@
- import_playbook: playbooks/pistorage.yml - import_playbook: playbooks/pistorage.yml
- import_playbook: playbooks/pik8s.yml - import_playbook: playbooks/pik8s.yml
- import_playbook: playbooks/desktop.yml - import_playbook: playbooks/desktop.yml
- import_playbook: playbooks/ansible-pull.yml