Commit 94aba7a2 authored by Okhin's avatar Okhin

Création de la tâche d'installation pour ansible-pull

parent a84963e7
pi3.lqdn.fr
---
# Playbook principal pour piops
# Permet d'installer ansible et d'installerun cronjob
- hosts: pi3.lqdn.fr
remote_user: root
vars:
schedule: "*/15 * * * *"
cron_user: root
logfile: /var/log/ansible-pull.log
workdir: /var/lib/ansible/local
repo_url: https://git.laquadrature.net/lqdn-interne/piops.git
tasks:
- name: installe ansible
package:
name: ansible
state: latest
- name: créé le répertoire de travail local
file:
path: "{{ workdir }}"
state: directory
owner: root
mode: 0751
- name: ajoute une entrée cron pour ansible
template:
path: /etc/cron.d/ansible-pull
src: templates/etc_cron.j2
owner: root
group: root
mode: 0644
- name: ajoute une règle logrotate pour ansible
template:
path: /etc/logrotate.d/ansible
src: templates/etc_logrotate.j2
owner: root
group: root
mode: 0644
# Utilise cron.d pour maintenir le système à jour
{{ schedule }} {{ cron_user }} ansible-pull -d {{ workdir }} -U {{ repo_url }} -i {{ workdir }}/hosts >> {{ logfile }} 2>&1
{{ logfile }} {
rotate 7
daily
compress
missingok
notifempty
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment