[INFO] Création du rôle #1
44
README.md
44
README.md
@ -1,3 +1,43 @@
|
||||
# role_modele
|
||||
# role_ipforwarding
|
||||
|
||||
Modèle
|
||||
Rôle de déploiement de l'ipforwarding.
|
||||
|
||||
## Variables
|
||||
|
||||
### ipforwarding_ipv4
|
||||
|
||||
Permet d'activer ou désactiver le forwarding pour IPv4.
|
||||
|
||||
*<span style="text-decoration: underline">Valeur par défaut:</span> aucune*
|
||||
<span style="font-style: italic;">
|
||||
<span style="text-decoration: underline">Valeur possibles:</span>
|
||||
- `1` : activer le forwarding
|
||||
- `0` : désactiver le forwarding
|
||||
</span>
|
||||
|
||||
### ipforwarding_ipv6
|
||||
|
||||
Permet d'activer ou désactiver le forwarding pour IPv6.
|
||||
Les informations sont les mêmes que pour `ipforwarding_ipv4`
|
||||
|
||||
## Exemples
|
||||
|
||||
### group_vars/gw.yml
|
||||
|
||||
```yaml
|
||||
---
|
||||
|
||||
ipforwarding_ipv4: 1
|
||||
ipforwarding_ipv6: 1
|
||||
```
|
||||
|
||||
### playbook.yml
|
||||
|
||||
```yaml
|
||||
---
|
||||
|
||||
- name: Déployer le rôle ipforwarding
|
||||
hosts: gw
|
||||
roles:
|
||||
- name: ipforwarding
|
||||
```
|
||||
|
5
defaults/main.yml
Normal file
5
defaults/main.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
# defaults file for ipforwarding
|
||||
|
||||
ipforwarding_ipv4: 0
|
||||
ipforwarding_ipv6: 0
|
@ -1,8 +1,7 @@
|
||||
galaxy_info:
|
||||
namespace: ykn
|
||||
author: pulsar89.5
|
||||
description: Rôle modèle
|
||||
|
||||
description: Rôle de déploiement de l'ipforwarding
|
||||
license: GPL-3.0-or-later
|
||||
|
||||
min_ansible_version: '2.1'
|
||||
|
20
tasks/main.yml
Normal file
20
tasks/main.yml
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
# tasks file for ipforwarding
|
||||
|
||||
- name: Changer pour IPv4
|
||||
ansible.posix.sysctl:
|
||||
name: net.ipv4.conf.all.forwarding
|
||||
value: "{{ ipforwarding_ipv4 | string }}"
|
||||
sysctl_file: /etc/sysctl.d/100-ipv4_forwarding.conf
|
||||
sysctl_set: true
|
||||
become: true
|
||||
when: ipforwarding_ipv4 | string | length > 0
|
||||
|
||||
- name: Changer pour IPv6
|
||||
ansible.posix.sysctl:
|
||||
name: net.ipv6.conf.all.forwarding
|
||||
value: "{{ ipforwarding_ipv6 | string }}"
|
||||
sysctl_file: /etc/sysctl.d/100-ipv6_forwarding.conf
|
||||
sysctl_set: true
|
||||
become: true
|
||||
when: ipforwarding_ipv6 | string | length > 0
|
Loading…
Reference in New Issue
Block a user