Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lab3_Ansible
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
alexandr.benzonan
lab3_Ansible
Commits
6eb4f866
Commit
6eb4f866
authored
2 years ago
by
alexandr.benzonan
Browse files
Options
Downloads
Patches
Plain Diff
clean part 3 using variables
parent
8583bac5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
playbook_2.yaml
+3
-13
3 additions, 13 deletions
playbook_2.yaml
vars2.yml
+16
-0
16 additions, 0 deletions
vars2.yml
vault.yml
+12
-11
12 additions, 11 deletions
vault.yml
wireguard_conf.j2
+6
-19
6 additions, 19 deletions
wireguard_conf.j2
with
37 additions
and
43 deletions
playbook_2.yaml
+
3
−
13
View file @
6eb4f866
...
@@ -35,19 +35,9 @@
...
@@ -35,19 +35,9 @@
-
name
:
configure wireguard
-
name
:
configure wireguard
hosts
:
hosts
hosts
:
hosts
vars_files
:
vault.yml
vars_files
:
vars
:
-
vars2.yml
h1_port
:
53610
-
vault.yml
h2_port
:
58970
h2_public_key
:
"
NG7C20yfj0r5KbhKqC4hVNtBoOpvFxhQ9Do+KcPxcmk="
h2_ip
:
"
10.0.0.2"
h1_ip
:
"
10.0.0.1"
h1_public_key
:
"
8pbE4PtVZk283L5Mrmn1XE04xXe1p1jPWAqUowQnBmE="
h2_AllowedIPs
:
"
10.0.0.1/32"
h1_AllowedIPs
:
"
10.0.0.2/32"
h1_endpoint
:
"
3.0.0.3"
h2_endpoint
:
"
1.0.0.3"
ifname
:
wg0
tasks
:
tasks
:
-
name
:
config wireguard
-
name
:
config wireguard
template
:
template
:
...
...
This diff is collapsed.
Click to expand it.
vars2.yml
0 → 100644
+
16
−
0
View file @
6eb4f866
all
:
ifname
:
wg0
H1
:
port
:
53610
other_port
:
58970
ip
:
"
10.0.0.1"
AllowedIPs
:
"
10.0.0.2/32"
other_public_key
:
"
NG7C20yfj0r5KbhKqC4hVNtBoOpvFxhQ9Do+KcPxcmk="
endpoint
:
"
3.0.0.3"
H2
:
port
:
58970
other_port
:
53610
ip
:
"
10.0.0.2"
other_public_key
:
"
8pbE4PtVZk283L5Mrmn1XE04xXe1p1jPWAqUowQnBmE="
AllowedIPs
:
"
10.0.0.1/32"
endpoint
:
"
1.0.0.3"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
vault.yml
+
12
−
11
View file @
6eb4f866
$ANSIBLE_VAULT;1.1;AES256
$ANSIBLE_VAULT;1.1;AES256
30376437623835666561646530366363363366323331353237393935623365623766666437313366
39333264633735383236613566343736653131373862343939333835346632313736616332623461
6139393331316437663165366133653637363131613938340a343865366364666431636335323261
6463626532633265366631353932666536313832373836660a303436316462613531393030333761
38633933623064316630376337353565326665373434363661326430633964383466303462633165
63653138376362356335373161323533323138363363396336636162373539343333353635313063
3939326435633761320a393536326365313964666163383963313535326231303063393964656530
6531656662343461300a353265383739333461616365613262333461393232653739343739653465
64346565613664393932396235643139653138343734373664663939616533383661373266326263
65303564303034316236653865623939643134373631633532343037656466313637326330303533
33333861626330663231393666333538353964373639376661353065313761316665366637633533
62613930316231333531613438316532343030653132326632643864623432616366396438396133
39323439613231363038653162333765366639643232333437326361623661303538326536636464
39376264643632663530646565383938326130613662616265666331316662323133373137323936
37303439663166663536333435363866306637396238343939303563383132376233343532643064
38616136363434663536613030303461373663653736303565663632363430326634383264326464
64613661303464366131366332386566633330626433313238383463346430306362376666323835
32666239303662643839666239343031306661303333626561333330306633333166663436366463
65653232313834373961653662373061373535663930656331656635663630386134663864313163
32626135326235663035386165326531353534353739613663656437653230346363636165643634
366339613664626231656531313830653837
34346330613035623734386665306234386431633762303430373734613164373563316536626136
33346133316232303130
This diff is collapsed.
Click to expand it.
wireguard_conf.j2
+
6
−
19
View file @
6eb4f866
[Interface]
[Interface]
{% if inventory_hostname == "H1" %}
Address = {{all[inventory_hostname].ip}}
Address = {{h1_ip}}
ListenPort = {{all[inventory_hostname].port}}
ListenPort = {{h1_port}}
PrivateKey = {{pk[inventory_hostname].private_key}}
PrivateKey = {{all.h1_private_key}}
{% else %}
Address = {{h2_ip}}
ListenPort = {{h2_port}}
PrivateKey = {{all.h2_private_key}}
{% endif %}
[Peer]
[Peer]
{% if inventory_hostname == "H1" %}
PublicKey = {{all[inventory_hostname].other_public_key}}
PublicKey = {{h2_public_key}}
AllowedIPs = {{all[inventory_hostname].AllowedIPs}}
AllowedIPs = {{h1_AllowedIPs}}
Endpoint = {{all[inventory_hostname].endpoint}}:{{all[inventory_hostname].other_port}}
Endpoint = {{h1_endpoint}}:{{h2_port}}
\ No newline at end of file
{% else %}
PublicKey = {{h1_public_key}}
AllowedIPs = {{h2_AllowedIPs}}
Endpoint = {{h2_endpoint}}:{{h1_port}}
{% endif %}
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