Merge branch 'structure' into 'master'
Structure See merge request nounous/ansible!4certbot_on_virtu
commit
f05133638a
31
README.md
31
README.md
|
@ -91,18 +91,29 @@ vers les serveurs puis détruites à la fin de l'exécution.
|
||||||
|
|
||||||
### Gestion des groupes de machines
|
### Gestion des groupes de machines
|
||||||
|
|
||||||
Dans BCFG2 on avait des groupes selon la version de Debian.
|
Pour la majorité des groupes ont retrouve ce qu'il y avait dans BCFG2
|
||||||
Avec Ansible on peut utiliser en condition
|
(`crans-vm`, `crans`…).
|
||||||
`ansible_distribution_release == 'stretch'` par exemple.
|
Pour la liste complète, je vous invite à lire le fichier `hosts`.
|
||||||
Donc il n'y a plus trop d'intêret de séparer selon la version de Debian les machines.
|
|
||||||
|
|
||||||
Sinon pour les autres groupes, vous allez retrouver une configuration similaire à BCFG2
|
Néanmoins grâce au système de facts d'Ansible, les groupes suivants ont été
|
||||||
avec par exemple les groupes `crans-vm`, `crans`…
|
remplacés par une condition :
|
||||||
Pour en savoir plus je vous invite à lire le fichier `hosts`.
|
|
||||||
|
* pour tester les versions de Debian,
|
||||||
|
|
||||||
|
```YAML
|
||||||
|
ansible_distribution_release == 'stretch'
|
||||||
|
```
|
||||||
|
|
||||||
|
* pour tester si c'est un CPU Intel x86_64,
|
||||||
|
|
||||||
|
```YAML
|
||||||
|
ansible_processor[0].find('Intel') != -1
|
||||||
|
and ansible_architecture == 'x86_64'
|
||||||
|
```
|
||||||
|
|
||||||
Pour les fonctions (`proxy-server`, `dhcp-dynamique`…) il a été choisi
|
Pour les fonctions (`proxy-server`, `dhcp-dynamique`…) il a été choisi
|
||||||
de ne pas faire de groupe particulier mais plutôt de sélectionner les machines
|
de ne pas faire de groupe particulier mais plutôt de sélectionner/enlever
|
||||||
pertinentes directement dans les playbooks.
|
les machines pertinentes directement dans les playbooks.
|
||||||
|
|
||||||
### Lister tout ce que sait Ansible sur un hôte
|
### Lister tout ce que sait Ansible sur un hôte
|
||||||
|
|
||||||
|
@ -112,5 +123,5 @@ Pour lister tous les faits qu'Ansible collecte nativement d'un serveur
|
||||||
on peut exécuter le module `setup` manuellement.
|
on peut exécuter le module `setup` manuellement.
|
||||||
|
|
||||||
```
|
```
|
||||||
ansible -i hosts zamok.crans.org -m setup --ask-vault-pass
|
ansible zamok.adm.crans.org -m setup --ask-vault-pass
|
||||||
```
|
```
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
# Playbook to deploy common Crans configuration and tools
|
||||||
|
- hosts: all
|
||||||
|
roles: [] # TODO
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
# Playbook to deploy DNS server
|
||||||
|
- hosts: odlyd.adm.crans.org
|
||||||
|
roles: [] # TODO
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
# Playbook to firewall
|
||||||
|
- hosts: gulp.adm.crans.org
|
||||||
|
roles: [] # TODO
|
66
hosts
66
hosts
|
@ -2,22 +2,72 @@
|
||||||
|
|
||||||
# How to name your server ?
|
# How to name your server ?
|
||||||
# > We name servers according to location, then type.
|
# > We name servers according to location, then type.
|
||||||
# > So all containers at OVH are in ovh-container.
|
|
||||||
# > Then we regroup everything in global geographic and type groups.
|
# > Then we regroup everything in global geographic and type groups.
|
||||||
|
|
||||||
[crans-pve]
|
[crans-physical]
|
||||||
|
gulp.adm.crans.org
|
||||||
|
odlyd.adm.crans.org
|
||||||
|
soyouz.adm.crans.org
|
||||||
|
fy.adm.crans.org
|
||||||
|
zamok.adm.crans.org
|
||||||
|
vo.adm.crans.org
|
||||||
|
ft.adm.crans.org
|
||||||
|
stitch.adm.crans.org
|
||||||
|
fz.adm.crans.org
|
||||||
|
thot.adm.crans.org
|
||||||
|
cochon.adm.crans.org
|
||||||
|
charybde.adm.crans.org
|
||||||
|
vulcain.adm.crans.org
|
||||||
|
omnomnom.adm.crans.org
|
||||||
|
zbee.adm.crans.org
|
||||||
|
zephir.adm.crans.org
|
||||||
|
|
||||||
[crans-container]
|
[crans-container]
|
||||||
|
sitesweb.adm.crans.org
|
||||||
|
|
||||||
[crans-vm]
|
[crans-vm]
|
||||||
|
re2o-bcfg2.adm.crans.org
|
||||||
|
re2o-srv.adm.crans.org
|
||||||
|
re2o-ldap.adm.crans.org
|
||||||
|
dhcp.adm.crans.org
|
||||||
|
nem.adm.crans.org
|
||||||
|
kenobi.adm.crans.org
|
||||||
|
roundcube-srv.adm.crans.org
|
||||||
|
kiwi.adm.crans.org
|
||||||
|
eap.adm.crans.org
|
||||||
|
radius.adm.crans.org
|
||||||
|
titanic.adm.crans.org
|
||||||
|
irc.adm.crans.org
|
||||||
|
alice.adm.crans.org
|
||||||
|
silice.adm.crans.org
|
||||||
|
owncloud-srv.adm.crans.org
|
||||||
|
tracker.adm.crans.org
|
||||||
|
jitsi.adm.crans.org
|
||||||
|
bakdaur.adm.crans.org
|
||||||
|
frontdaur.adm.crans.org
|
||||||
|
cups.adm.crans.org
|
||||||
|
civet.adm.crans.org
|
||||||
|
owl.adm.crans.org
|
||||||
|
gitzly.adm.crans.org
|
||||||
|
cas-srv.adm.crans.org
|
||||||
|
redisdead.adm.crans.org
|
||||||
|
ethercalc-srv.adm.crans.org
|
||||||
|
mediadrop-srv.adm.crans.org
|
||||||
|
ytrap-llatsni.adm.crans.org
|
||||||
|
unifi.adm.crans.org
|
||||||
|
horde-srv.adm.crans.org
|
||||||
|
ipv6-zayo.adm.crans.org
|
||||||
|
news.adm.crans.org
|
||||||
|
xmpp.adm.crans.org
|
||||||
|
routeur.adm.crans.org
|
||||||
prometheus.adm.crans.org
|
prometheus.adm.crans.org
|
||||||
|
|
||||||
[ovh-server]
|
[ovh-server]
|
||||||
|
soyouz.adm.crans.org
|
||||||
|
|
||||||
# everything at crans
|
# everything at crans
|
||||||
[crans:children]
|
[crans:children]
|
||||||
crans-pve
|
crans-physical
|
||||||
crans-container
|
crans-container
|
||||||
crans-vm
|
crans-vm
|
||||||
|
|
||||||
|
@ -25,6 +75,10 @@ crans-vm
|
||||||
[ovh:children]
|
[ovh:children]
|
||||||
ovh-server
|
ovh-server
|
||||||
|
|
||||||
|
# every physical server
|
||||||
|
[physical:children]
|
||||||
|
crans-physical
|
||||||
|
|
||||||
# every LXC container
|
# every LXC container
|
||||||
[container:children]
|
[container:children]
|
||||||
crans-container
|
crans-container
|
||||||
|
@ -33,7 +87,3 @@ crans-container
|
||||||
[vm:children]
|
[vm:children]
|
||||||
crans-vm
|
crans-vm
|
||||||
|
|
||||||
# every PVE
|
|
||||||
[pve:children]
|
|
||||||
crans-pve
|
|
||||||
|
|
||||||
|
|
7
ldap.yml
7
ldap.yml
|
@ -13,6 +13,9 @@
|
||||||
ldap_nslcd_bind_dn: "cn=nslcd,ou=service-users,{{ ldap_base }}"
|
ldap_nslcd_bind_dn: "cn=nslcd,ou=service-users,{{ ldap_base }}"
|
||||||
ldap_nslcd_passwd: "{{ vault_ldap_nslcd_passwd }}"
|
ldap_nslcd_passwd: "{{ vault_ldap_nslcd_passwd }}"
|
||||||
|
|
||||||
|
# Group permissions
|
||||||
|
ssh_allow_groups: ssh nounou apprenti cableur root
|
||||||
|
|
||||||
# Scripts will tell users to go there to manage their account
|
# Scripts will tell users to go there to manage their account
|
||||||
intranet_url: 'https://intranet.crans.org/'
|
intranet_url: 'https://intranet.crans.org/'
|
||||||
|
|
||||||
|
@ -20,3 +23,7 @@
|
||||||
ssh_pub_keys: "{{ vault_ssh_pub_keys }}"
|
ssh_pub_keys: "{{ vault_ssh_pub_keys }}"
|
||||||
roles:
|
roles:
|
||||||
- ldap-client
|
- ldap-client
|
||||||
|
|
||||||
|
# Deploy LDAP replica
|
||||||
|
- hosts: odlyd.adm.crans.org,soyouz.adm.crans.org,fy.adm.crans.org,thot.adm.crans.org
|
||||||
|
roles: [] # TODO
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
# Playbook to deploy NFS
|
||||||
|
- hosts: crans,!odlyd.adm.crans.org
|
||||||
|
roles: [] # TODO
|
|
@ -1,24 +0,0 @@
|
||||||
---
|
|
||||||
# Filter SSH on groups
|
|
||||||
- name: Filter SSH on groups
|
|
||||||
lineinfile:
|
|
||||||
dest: /etc/ssh/sshd_config
|
|
||||||
regexp: ^AllowGroups
|
|
||||||
line: AllowGroups ssh nounou apprenti cableur root
|
|
||||||
state: present
|
|
||||||
|
|
||||||
# To gain root access with ldap rights
|
|
||||||
- name: Install SUDO package
|
|
||||||
package:
|
|
||||||
name: sudo
|
|
||||||
state: present
|
|
||||||
register: package_result
|
|
||||||
retries: 3
|
|
||||||
until: package_result is succeeded
|
|
||||||
|
|
||||||
# Set sudo group
|
|
||||||
- name: Configure sudoers sudo group
|
|
||||||
template:
|
|
||||||
src: sudoers.j2
|
|
||||||
dest: /etc/sudoers
|
|
||||||
mode: 0440
|
|
|
@ -31,5 +31,4 @@
|
||||||
- passwd
|
- passwd
|
||||||
- group
|
- group
|
||||||
- shadow
|
- shadow
|
||||||
- sudoers
|
|
||||||
notify: Restart nslcd service
|
notify: Restart nslcd service
|
||||||
|
|
|
@ -2,12 +2,17 @@
|
||||||
# Install and configure main LDAP tools
|
# Install and configure main LDAP tools
|
||||||
- include_tasks: install_ldap.yml
|
- include_tasks: install_ldap.yml
|
||||||
|
|
||||||
# Filter who can access server and sudo on groups
|
|
||||||
- include_tasks: group_security.yml
|
|
||||||
|
|
||||||
# Some userland scripts specific to LDAP install
|
# Some userland scripts specific to LDAP install
|
||||||
- include_tasks: userland_scripts.yml
|
- include_tasks: userland_scripts.yml
|
||||||
|
|
||||||
|
# Filter SSH on groups
|
||||||
|
- name: Filter SSH on groups
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/ssh/sshd_config
|
||||||
|
regexp: ^AllowGroups
|
||||||
|
line: "AllowGroups {{ ssh_allow_groups }}"
|
||||||
|
state: present
|
||||||
|
|
||||||
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=568577
|
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=568577
|
||||||
- name: Ensure home directories are created upon login
|
- name: Ensure home directories are created upon login
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
|
|
@ -14,8 +14,8 @@ uri {{ ldap_master_uri }}
|
||||||
|
|
||||||
# The search base that will be used for all queries.
|
# The search base that will be used for all queries.
|
||||||
base {{ ldap_base }}
|
base {{ ldap_base }}
|
||||||
base passwd cn=Utilisateurs,{{ ldap_base }}
|
base passwd {{ ldap_user_tree }}
|
||||||
base shadow cn=Utilisateurs,{{ ldap_base }}
|
base shadow {{ ldap_user_tree }}
|
||||||
base group ou=posix,ou=groups,{{ ldap_base }}
|
base group ou=posix,ou=groups,{{ ldap_base }}
|
||||||
|
|
||||||
# The LDAP protocol version to use.
|
# The LDAP protocol version to use.
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
# {{ ansible_managed }}
|
|
||||||
#
|
|
||||||
# This file MUST be edited with the 'visudo' command as root.
|
|
||||||
#
|
|
||||||
# Please consider adding local content in /etc/sudoers.d/ instead of
|
|
||||||
# directly modifying this file.
|
|
||||||
#
|
|
||||||
# See the man page for details on how to write a sudoers file.
|
|
||||||
#
|
|
||||||
Defaults env_keep += "DARCS_EMAIL EDITOR PYTHONIOENCODING GIT_*"
|
|
||||||
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
||||||
Defaults passprompt_override
|
|
||||||
Defaults passprompt="[sudo] password for %p on %h: "
|
|
||||||
|
|
||||||
# Host alias specification
|
|
||||||
|
|
||||||
# User alias specification
|
|
||||||
User_Alias NOUNOUS= %nounou
|
|
||||||
User_Alias CABLEUR= %cableur
|
|
||||||
User_Alias ANCIEN= %ancien
|
|
||||||
User_Alias IMPRIMEURS= %imprimeurs
|
|
||||||
User_Alias BUREAU= %bureau
|
|
||||||
|
|
||||||
Runas_Alias USERS= %users
|
|
||||||
|
|
||||||
# Cmnd alias specification
|
|
||||||
|
|
||||||
# User privilege specification
|
|
||||||
root ALL=(ALL:ALL) ALL
|
|
||||||
NOUNOUS ALL=(ALL:ALL) ALL
|
|
||||||
|
|
||||||
# See sudoers(5) for more information on "#include" directives:
|
|
||||||
|
|
||||||
#includedir /etc/sudoers.d
|
|
Loading…
Reference in New Issue