Allow for dynamic tagging of ansible-pull hosts
This commit is contained in:
parent
07ea9806da
commit
759df2f593
22
playbooks/ansible-pull.yml
Executable file
22
playbooks/ansible-pull.yml
Executable 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 ]
|
@ -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
|
||||
tags: [ desktop, nfs ]
|
||||
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
|
||||
vars:
|
||||
backup_s3backup_tar_args_extra: h
|
||||
|
5
site.yml
5
site.yml
@ -3,6 +3,10 @@
|
||||
---
|
||||
# Preambulatory system configuration
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: collect service facts
|
||||
service_facts:
|
||||
tags: [ always ]
|
||||
roles:
|
||||
- role: common
|
||||
tags: [ common ]
|
||||
@ -41,3 +45,4 @@
|
||||
- import_playbook: playbooks/pistorage.yml
|
||||
- import_playbook: playbooks/pik8s.yml
|
||||
- import_playbook: playbooks/desktop.yml
|
||||
- import_playbook: playbooks/ansible-pull.yml
|
||||
|
Loading…
Reference in New Issue
Block a user