site.yml 1.34 KB
Newer Older
1 2
---
# Playbook principal pour piops
Okhin's avatar
Okhin committed
3
# Permet d'installer ansible et d'installer un cronjob pour ansible-pull
4

Okhin's avatar
Okhin committed
5
- hosts: all
6 7 8 9 10 11 12 13 14
  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

Okhin's avatar
Okhin committed
15 16 17 18 19
  tasks:
      - name: installe ansible
        package:
            name: ansible
            state: latest
20

Okhin's avatar
Okhin committed
21 22 23 24 25 26
      - name: créé le répertoire de travail local
        file:
            path: "{{ workdir }}"
            state: directory
            owner: root
            mode: 0751
27

Okhin's avatar
Okhin committed
28 29 30 31 32 33 34
      - name: ajoute une entrée cron pour ansible
        template:
            dest: /etc/cron.d/ansible-pull
            src: templates/etc_cron.j2
            owner: root
            group: root
            mode: 0644
35

Okhin's avatar
Okhin committed
36 37 38 39 40 41 42
      - name: ajoute une règle logrotate pour ansible
        template:
            dest: /etc/logrotate.d/ansible
            src: templates/etc_logrotate.j2
            owner: root
            group: root
            mode: 0644
43

44 45 46
- hosts: webserver
  remote_user: root
  roles:
Okhin's avatar
Okhin committed
47 48 49 50
      - role: geerlingguy.mysql
      - role: geerlingguy.php
      - role: geerlingguy.php-mysql
      - role: geerlingguy.certbot
51 52 53 54

- hosts: wordpress
  remote_user: root
  roles:
Okhin's avatar
Okhin committed
55
      - role: wpcli
Okhin's avatar
Okhin committed
56
      - role: wordpress