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

[Update] Add comments

parent e2a815c1
No related branches found
No related tags found
No related merge requests found
...@@ -3,11 +3,12 @@ ...@@ -3,11 +3,12 @@
hosts: all hosts: all
become: true become: true
tasks: tasks:
# Load all variables in the playbook
- name: Load the variables - name: Load the variables
include_vars: variables.yml include_vars: variables.yml
- name: Rename hosts - name: Rename hosts
command: hostnamectl set-hostname {{ inventory_hostname }} command: hostnamectl set-hostname {{ inventory_hostname }}
# For all host we config network interfaces
- name: Setup network for Hosts - name: Setup network for Hosts
hosts: hotes hosts: hotes
become: yes become: yes
...@@ -25,6 +26,7 @@ ...@@ -25,6 +26,7 @@
state: restarted state: restarted
enabled: yes enabled: yes
# For all routers we config network interfaces
- name: Setup network for Routers - name: Setup network for Routers
hosts: routeurs hosts: routeurs
become: yes become: yes
...@@ -49,6 +51,7 @@ ...@@ -49,6 +51,7 @@
state: restarted state: restarted
enabled: yes enabled: yes
# make the test
- name: Display ping value - name: Display ping value
hosts: H1 hosts: H1
become: yes become: yes
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
hosts: all hosts: all
become: true become: true
# Load all variables in the playbook
tasks: tasks:
- name: Load the variables - name: Load the variables
include_vars: variables.yml include_vars: variables.yml
...@@ -14,6 +15,7 @@ ...@@ -14,6 +15,7 @@
- name: Rename hosts - name: Rename hosts
command: hostnamectl set-hostname {{ inventory_hostname }} command: hostnamectl set-hostname {{ inventory_hostname }}
# For all host we config network interfaces
- name: Setup network for Hosts - name: Setup network for Hosts
hosts: hotes hosts: hotes
become: yes become: yes
...@@ -31,6 +33,7 @@ ...@@ -31,6 +33,7 @@
state: restarted state: restarted
enabled: yes enabled: yes
# For all routers we config network interfaces
- name: Setup network for Routers - name: Setup network for Routers
hosts: routeurs hosts: routeurs
become: yes become: yes
...@@ -54,6 +57,7 @@ ...@@ -54,6 +57,7 @@
state: restarted state: restarted
enabled: yes enabled: yes
# Install somes program on host so install route for internet and install program and finally remove route
- name: Install all needed program - name: Install all needed program
hosts: hotes hosts: hotes
become: true become: true
...@@ -61,14 +65,12 @@ ...@@ -61,14 +65,12 @@
- name: Give internet to host - name: Give internet to host
ansible.builtin.shell: ansible.builtin.shell:
cmd: "ip r add default nexthop via 10.0.2.2" cmd: "ip r add default nexthop via 10.0.2.2"
# check_mode: yes
- name: Install update for install other programs - name: Install update for install other programs
ansible.builtin.apt: ansible.builtin.apt:
cache_valid_time: 86400 cache_valid_time: 86400
upgrade: yes upgrade: yes
update_cache: yes update_cache: yes
# check_mode: yes
- name: Install nginx - name: Install nginx
ansible.builtin.apt: ansible.builtin.apt:
...@@ -83,6 +85,7 @@ ...@@ -83,6 +85,7 @@
ansible.builtin.shell: ansible.builtin.shell:
cmd: "ip r del default" cmd: "ip r del default"
# Push in the web server the config for wireguard, nginx and the HTML for web index
- name: Setup index.html on H2 - name: Setup index.html on H2
hosts: H2 hosts: H2
become: true become: true
...@@ -118,6 +121,7 @@ ...@@ -118,6 +121,7 @@
state: restarted state: restarted
enabled: yes enabled: yes
# Setup the wireguard tunnel for H1 and make all the tests
- name: Setup wireguard on H1 - name: Setup wireguard on H1
hosts: H1 hosts: H1
become: true become: true
...@@ -127,7 +131,7 @@ ...@@ -127,7 +131,7 @@
src: ./templates/wireguard_config_template_H1.j2 src: ./templates/wireguard_config_template_H1.j2
dest: /etc/wireguard/wg0.conf dest: /etc/wireguard/wg0.conf
mode: 0640 mode: 0640
- name: wg-quick - name: wg-quick
ansible.builtin.shell: ansible.builtin.shell:
cmd: "wg-quick up wg0 2>/dev/null" cmd: "wg-quick up wg0 2>/dev/null"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment