2022-10-21 13:01:23 +00:00
|
|
|
# role_etc_hosts
|
2022-10-21 11:57:29 +00:00
|
|
|
|
2022-10-21 13:01:23 +00:00
|
|
|
Gérer le fichier /etc/hosts
|
|
|
|
|
|
|
|
## Variables
|
|
|
|
|
|
|
|
### etc_hosts_local
|
|
|
|
|
|
|
|
Liste de nom d'hôte attaché à 127.0.0.1.
|
|
|
|
|
|
|
|
<span style="text-decoration: underline">Valeur par défaut:</span> aucune
|
|
|
|
|
|
|
|
### etc_hosts_specifics
|
|
|
|
|
|
|
|
Liste de ligne à ajouter à `/etc/hosts`.
|
|
|
|
|
|
|
|
<span style="text-decoration: underline">Valeur par défaut:</span> aucune
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## Exemple d'utilisation
|
|
|
|
|
|
|
|
### inventory.yml
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
---
|
|
|
|
|
|
|
|
all:
|
|
|
|
hosts:
|
|
|
|
host1.ykn.local:
|
|
|
|
host2.ykn.local:
|
|
|
|
children:
|
|
|
|
dnsservers:
|
|
|
|
hosts:
|
|
|
|
dnsmasq1.ykn.local:
|
|
|
|
dnsmasq2.ykn.local:
|
|
|
|
```
|
|
|
|
|
|
|
|
### host_vars/host1.ykn.local.yml
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
---
|
|
|
|
|
|
|
|
etc_hosts_local:
|
|
|
|
- www.ykn.fr
|
|
|
|
|
|
|
|
etc_hosts_specifics:
|
|
|
|
- 192.168.50.200 gitea.ykn.fr
|
|
|
|
```
|
|
|
|
|
|
|
|
### playbook.yml
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
---
|
|
|
|
|
|
|
|
- hosts: 'all'
|
|
|
|
roles:
|
|
|
|
- name: etc_hosts
|
|
|
|
```
|