From d1bbf6a3da8a4eb7c1a5d689511112502178f5ff Mon Sep 17 00:00:00 2001 From: Axel Date: Tue, 14 May 2024 11:30:11 +0200 Subject: [PATCH] Commit initiale --- local.yml | 13 +++++++++---- tasks/cron.yml | 6 ++++++ tasks/files/sudoers_ansible | 1 + tasks/packages.yml | 4 ++++ tasks/users.yml | 12 ++++++++++++ 5 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 tasks/cron.yml create mode 100644 tasks/files/sudoers_ansible create mode 100644 tasks/packages.yml create mode 100644 tasks/users.yml diff --git a/local.yml b/local.yml index 0c2f42c..51466ef 100644 --- a/local.yml +++ b/local.yml @@ -3,8 +3,13 @@ connection: local become: true + pre_tasks: + - name: update repositories + apt: + update_cache: yes + changed_when: False + tasks: - - name: install htop - package: - name: htop - state: absent \ No newline at end of file + - include: tasks/users.yml + - include: tasks/cron.yml + - include: tasks/packages.yml \ No newline at end of file diff --git a/tasks/cron.yml b/tasks/cron.yml new file mode 100644 index 0000000..e8eac52 --- /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" \ No newline at end of file diff --git a/tasks/files/sudoers_ansible b/tasks/files/sudoers_ansible new file mode 100644 index 0000000..dccc3f4 --- /dev/null +++ b/tasks/files/sudoers_ansible @@ -0,0 +1 @@ +ansible ALL=(ALL) NOPASSWD:ALL \ No newline at end of file diff --git a/tasks/packages.yml b/tasks/packages.yml new file mode 100644 index 0000000..4069f1c --- /dev/null +++ b/tasks/packages.yml @@ -0,0 +1,4 @@ +- name: Install packages + apt: + name: + - chromium \ No newline at end of file diff --git a/tasks/users.yml b/tasks/users.yml new file mode 100644 index 0000000..ad02642 --- /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 \ No newline at end of file