From efaaee0ebe8c2f7fe715894c2941282cd29913e7 Mon Sep 17 00:00:00 2001 From: Devan Carpenter Date: Wed, 13 May 2020 16:11:54 +0100 Subject: add roles to get started --- roles/ansible-pull/tasks/main.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 roles/ansible-pull/tasks/main.yml (limited to 'roles/ansible-pull/tasks/main.yml') 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 @@ +- name: Update apt cache + apt: update_cache=yes + +- name: Install depends + apt: + name: [python3-pip, ansible] + state: present + +- name: Ensure /etc/ansible/facts.d exists + file: + path: /etc/ansible/facts.d + state: directory + recurse: yes + +- name: Make /etc/ansible/facts.d/pull.fact + template: + src: pull.fact + dest: /etc/ansible/facts.d/pull.fact + +- name: recollect facts + setup: + +- name: Install the ansible-pull script + template: src=ansible-pull.sh dest=/usr/sbin/run-ansible-pull mode=0755 owner=root group=root + +- name: Install cronjob + cron: name="Ansible Pull" minute="{{ ansible_local.pull.minute | default(59 | random) }}" job="/usr/sbin/run-ansible-pull" + +- name: ensure ansible-pull is run on reboot + cron: + name: run ansible on reboot + job: /usr/sbin/run-ansible-pull + special_time: reboot -- cgit v1.2.3