From 0ec7ad238bf15effeab6a8a99cd751cbf39b024c Mon Sep 17 00:00:00 2001 From: Jay LaCroix Date: Tue, 1 Sep 2020 16:23:18 -0400 Subject: [PATCH] added cron and user taskbooks --- local.yml | 2 ++ tasks/cron.yml | 6 ++++++ tasks/files/sudoers_ansible | 1 + tasks/users.yml | 12 ++++++++++++ 4 files changed, 21 insertions(+) create mode 100644 tasks/cron.yml create mode 100644 tasks/files/sudoers_ansible create mode 100644 tasks/users.yml diff --git a/local.yml b/local.yml index 902e345..cce63f8 100644 --- a/local.yml +++ b/local.yml @@ -9,4 +9,6 @@ changed_when: False tasks: + - include: tasks/users.yml + - include: tasks/cron.yml - include: tasks/packages.yml diff --git a/tasks/cron.yml b/tasks/cron.yml new file mode 100644 index 0000000..9e84c35 --- /dev/null +++ b/tasks/cron.yml @@ -0,0 +1,6 @@ +- name: install cron job (ansible-pull) + cron: + user: ansible + name: "ansible provision" + minute: "*/10" + job: "/usr/bin/ansible-pull -o -U https://github.com/jlacroix82/ansible_pull_tutorial.git > /dev/null" diff --git a/tasks/files/sudoers_ansible b/tasks/files/sudoers_ansible new file mode 100644 index 0000000..9888393 --- /dev/null +++ b/tasks/files/sudoers_ansible @@ -0,0 +1 @@ +ansible ALL=(ALL) NOPASSWD: ALL diff --git a/tasks/users.yml b/tasks/users.yml new file mode 100644 index 0000000..ddf6ff4 --- /dev/null +++ b/tasks/users.yml @@ -0,0 +1,12 @@ +- name: create ansible user + user: + name: ansible + system: yes + +- name: copy sudoers_ansible + copy: + src: files/sudoers_ansible + dest: /etc/sudoers.d/ansible + owner: root + group: root + mode: 0440