Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Ansible-TP3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fabian.troller
Ansible-TP3
Commits
b5764c33
Commit
b5764c33
authored
2 years ago
by
poulpe
Browse files
Options
Downloads
Patches
Plain Diff
[Update] Add comments
parent
e2a815c1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Config_H1_Ping_H2.yml
+4
-1
4 additions, 1 deletion
Config_H1_Ping_H2.yml
Config_Wireguard.yml
+7
-3
7 additions, 3 deletions
Config_Wireguard.yml
with
11 additions
and
4 deletions
Config_H1_Ping_H2.yml
+
4
−
1
View file @
b5764c33
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Config_Wireguard.yml
+
7
−
3
View file @
b5764c33
...
@@ -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"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment