ansible/plays/root.yml

81 lines
1.8 KiB
YAML
Executable File

#!/usr/bin/env ansible-playbook
---
# root is the first playbook to launch (as root) whe initiation a new server
- hosts: server
tasks:
- name: Check if mirror.adm is defined in /etc/hosts
lineinfile:
state: absent
path: /etc/hosts
regexp: '^{{ glob_mirror.ip }}'
check_mode: True
changed_when: False
register: check_mirror
- name: Define mirror.adm.crans.org if it doesn't exist.
lineinfile:
path: /etc/hosts
line: '{{ glob_mirror.ip }} {{ glob_mirror.name }}'
insertafter: '127.0.0.1 localhost'
when: check_mirror.found == 0
- hosts: baie
roles:
- baie
- hosts: virtu
roles:
- proxmox-apt-sources
- hosts: server
vars:
# # Will be in /usr/scripts/
# crans_scripts_git: "http://gitlab.adm.crans.org/nounous/scripts.git"
ntp_client: '{{ glob_ntp_client | combine(loc_ntp_client | default({})) }}'
crans_scripts: '{{ glob_crans_scripts | combine(loc_crans_scripts | default({})) }}'
roles:
- debian-apt-sources
- common-tools
- sudo
- ntp-client
- crans-scripts
- root-config
- hosts: crans_vm
roles:
- qemu-guest-agent
- serial-tty
- import_playbook: slapd.yml
- hosts: server
vars:
ldap: '{{ glob_ldap | combine(loc_ldap | default({})) }}'
roles:
- ldap-client
- hosts: server,!ovh_physical,!tealc.adm.crans.org,!zamok.adm.crans.org
roles:
- home-nounous
- hosts: server,!virtu
roles:
- openssh
- hosts: crans_vm
tasks:
- name: Remove cloud-init
apt:
name: cloud-init
state: absent
purge: true
register: apt_result
retries: 3
until: apt_result is succeeded
- import_playbook: borgbackups_client.yml
- import_playbook: monitoring.yml
- import_playbook: network_interfaces.yml