diff --git a/Config_H1_Ping_H2.yml b/Config_H1_Ping_H2.yml index ab3e694782d6748db1aa92fb32694b5c084ef71f..df24f9e441ed27c7f7b2466424c0ee5745a9a315 100644 --- a/Config_H1_Ping_H2.yml +++ b/Config_H1_Ping_H2.yml @@ -3,11 +3,12 @@ hosts: all become: true tasks: +# Load all variables in the playbook - name: Load the variables include_vars: variables.yml - name: Rename hosts command: hostnamectl set-hostname {{ inventory_hostname }} - +# For all host we config network interfaces - name: Setup network for Hosts hosts: hotes become: yes @@ -25,6 +26,7 @@ state: restarted enabled: yes +# For all routers we config network interfaces - name: Setup network for Routers hosts: routeurs become: yes @@ -49,6 +51,7 @@ state: restarted enabled: yes +# make the test - name: Display ping value hosts: H1 become: yes diff --git a/Config_Wireguard.yml b/Config_Wireguard.yml index b739474bdb7bf8432ec6350e11f537036f19e5dc..24b8da0519a946944691819590d756dfb151b728 100644 --- a/Config_Wireguard.yml +++ b/Config_Wireguard.yml @@ -4,6 +4,7 @@ hosts: all become: true + # Load all variables in the playbook tasks: - name: Load the variables include_vars: variables.yml @@ -14,6 +15,7 @@ - name: Rename hosts command: hostnamectl set-hostname {{ inventory_hostname }} +# For all host we config network interfaces - name: Setup network for Hosts hosts: hotes become: yes @@ -31,6 +33,7 @@ state: restarted enabled: yes +# For all routers we config network interfaces - name: Setup network for Routers hosts: routeurs become: yes @@ -54,6 +57,7 @@ state: restarted enabled: yes +# Install somes program on host so install route for internet and install program and finally remove route - name: Install all needed program hosts: hotes become: true @@ -61,14 +65,12 @@ - name: Give internet to host ansible.builtin.shell: cmd: "ip r add default nexthop via 10.0.2.2" - # check_mode: yes - name: Install update for install other programs ansible.builtin.apt: cache_valid_time: 86400 upgrade: yes update_cache: yes - # check_mode: yes - name: Install nginx ansible.builtin.apt: @@ -83,6 +85,7 @@ ansible.builtin.shell: 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 hosts: H2 become: true @@ -118,6 +121,7 @@ state: restarted enabled: yes +# Setup the wireguard tunnel for H1 and make all the tests - name: Setup wireguard on H1 hosts: H1 become: true @@ -127,7 +131,7 @@ src: ./templates/wireguard_config_template_H1.j2 dest: /etc/wireguard/wg0.conf mode: 0640 - + - name: wg-quick ansible.builtin.shell: cmd: "wg-quick up wg0 2>/dev/null"