Skip to content
Snippets Groups Projects
Commit 856ea2d1 authored by poulpe's avatar poulpe
Browse files

[Update] Fix standalone run

parent 977eda2f
No related branches found
No related tags found
No related merge requests found
...@@ -3,14 +3,10 @@ ...@@ -3,14 +3,10 @@
hosts: all hosts: all
become: true become: true
tasks: tasks:
- name: Load the variables
include_vars: variables.yml
- name: Rename hosts - name: Rename hosts
command: hostnamectl set-hostname {{ inventory_hostname }} command: hostnamectl set-hostname {{ inventory_hostname }}
notify: rename_finish
handlers:
- name: rename_finish
debug:
msg: "I can handle dates"
- name: Setup network for Hosts - name: Setup network for Hosts
hosts: hotes hosts: hotes
...@@ -18,11 +14,16 @@ ...@@ -18,11 +14,16 @@
tasks: tasks:
- name: "Create file interface in interfaces.d" - name: "Create file interface in interfaces.d"
ansible.builtin.template: ansible.builtin.template:
src: ./interfaces_H.j2 src: ./templates/host_config_template.j2
dest: /etc/network/interfaces.d/interfaces_playbook.conf dest: /etc/network/interfaces.d/interfaces_playbook.conf
mode: 0640 mode: 0640
- name: Restart interfaces hosts notify: Restart network
shell: "ifdown --force eth0" handlers:
- name: Restart network
ansible.builtin.service:
name: networking
state: restarted
enabled: yes
- name: Setup network for Routers - name: Setup network for Routers
hosts: routeurs hosts: routeurs
...@@ -30,30 +31,19 @@ ...@@ -30,30 +31,19 @@
tasks: tasks:
- name: "Create file interface in interfaces.d" - name: "Create file interface in interfaces.d"
ansible.builtin.template: ansible.builtin.template:
src: ./interfaces_R.j2 src: ./templates/router_config_template.j2
dest: /etc/network/interfaces.d/interfaces_playbook.conf dest: /etc/network/interfaces.d/interfaces_playbook.conf
mode: 0640 mode: 0640
notify: Restart network
- name: "Set ip_forwarding to 1" - name: "Set ip_forwarding to 1"
ansible.posix.sysctl: ansible.posix.sysctl:
name: net.ipv4.ip_forward name: net.ipv4.ip_forward
value: '1' value: '1'
sysctl_set: true sysctl_set: true
state: present state: present
- name: Restart interfaces hosts
shell: "ifdown --force eth0 eth1"
- name: Configuration et démarrage des interfaces réseau
hosts: all
become: true
tasks:
- name: Restart interfaces hosts
shell: "ifup -a --ignore-errors"
notify: start network
handlers: handlers:
- name: start network - name: Restart network
service: ansible.builtin.service:
name: networking name: networking
state: restarted state: restarted
enabled: yes enabled: yes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment