Salt
fd87cb00d0
Turns out this caused serious problems if a host had never actually fully run ansible-pull before
37 lines
1.2 KiB
YAML
37 lines
1.2 KiB
YAML
#!/usr/bin/ansible-playbook
|
|
# vim:ft=ansible:
|
|
---
|
|
- name: Set up ansible-pull
|
|
block:
|
|
- name: Copy Ansible password file
|
|
copy:
|
|
src: ansiblevaultpass
|
|
dest: ~/ansiblevaultpass
|
|
mode: "0600"
|
|
become: yes
|
|
become_user: ansible
|
|
- name: Configure systemd unit
|
|
block:
|
|
- name: Template out config
|
|
template: src=ansible-pull.cfg dest=~/ansible-pull.cfg
|
|
become: yes
|
|
become_user: ansible
|
|
- name: Template out services
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
mode: "{{ item.mode }}"
|
|
loop:
|
|
- { src: "ansible-pull.service", dest: "/etc/systemd/system/ansible-pull.service", mode: "0644" }
|
|
- { src: "ansible-pull.timer", dest: "/etc/systemd/system/ansible-pull.timer", mode: "0644" }
|
|
notify: restart ansiblepull timer
|
|
- name: Enable timer
|
|
systemd:
|
|
daemon_reload: yes
|
|
name: ansible-pull.timer
|
|
enabled: yes
|
|
state: started
|
|
notify: restart ansiblepull timer
|
|
when: ansible_service_mgr == "systemd"
|
|
become: yes
|