aboutsummaryrefslogtreecommitdiff
path: root/roles/ansible-pull/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/ansible-pull/tasks/main.yml')
-rw-r--r--roles/ansible-pull/tasks/main.yml33
1 files changed, 33 insertions, 0 deletions
diff --git a/roles/ansible-pull/tasks/main.yml b/roles/ansible-pull/tasks/main.yml
new file mode 100644
index 0000000..7414bd9
--- /dev/null
+++ b/roles/ansible-pull/tasks/main.yml
@@ -0,0 +1,33 @@
1- name: Update apt cache
2 apt: update_cache=yes
3
4- name: Install depends
5 apt:
6 name: [python3-pip, ansible]
7 state: present
8
9- name: Ensure /etc/ansible/facts.d exists
10 file:
11 path: /etc/ansible/facts.d
12 state: directory
13 recurse: yes
14
15- name: Make /etc/ansible/facts.d/pull.fact
16 template:
17 src: pull.fact
18 dest: /etc/ansible/facts.d/pull.fact
19
20- name: recollect facts
21 setup:
22
23- name: Install the ansible-pull script
24 template: src=ansible-pull.sh dest=/usr/sbin/run-ansible-pull mode=0755 owner=root group=root
25
26- name: Install cronjob
27 cron: name="Ansible Pull" minute="{{ ansible_local.pull.minute | default(59 | random) }}" job="/usr/sbin/run-ansible-pull"
28
29- name: ensure ansible-pull is run on reboot
30 cron:
31 name: run ansible on reboot
32 job: /usr/sbin/run-ansible-pull
33 special_time: reboot