Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GEANT-OAV
ansible-examples
Commits
9001bf36
Commit
9001bf36
authored
Dec 08, 2021
by
Dónal Cunningham
Browse files
DC - Initial commit
parents
Changes
61
Hide whitespace changes
Inline
Side-by-side
Section2/playbooks/simple_variables.yaml
0 → 100644
View file @
9001bf36
---
-
name
:
Set up Apache
hosts
:
webservers
vars
:
http_port
:
80
-
name
:
Set up Apache
hosts
:
webservers
vars_files
:
-
external_vars.yml
Section2/playbooks/tree.txt
0 → 100644
View file @
9001bf36
$ tree
.
├── ansible.cfg
├── hosts
└── group_vars
│ └── all.yaml
│ └── webservers.yaml
└── host_vars
│ └── web1.yaml
│ └── web2.yaml
│ └── db1.yaml
│ └── db2.yaml
├── setup_apache_playbook.yaml
└── setup_mysql_playbook.yaml
Section2/simple_YAML/list_and_dictionary.yaml
0 → 100644
View file @
9001bf36
---
devices
:
-
routers
-
switches
-
firewalls
vlan
:
name
:
DMZ
id
:
10
subnet
:
10.1.20.0/24
acl
:
DMZ_from_internet_v4
Section2/simple_YAML/list_of_dictionaries.yaml
0 → 100644
View file @
9001bf36
vlans
:
-
Management
:
vlan_id
:
99
description
:
‘Management OOB’
ipv4_subnets
:
193.1.219.0/24
-
DNS_AUTH
:
vlan_id
:
10
description
:
‘Authoritative DNS servers’
ipv4_subnets
:
193.1.220.0/26
dhcp_servers
:
-
193.1.2.1
-
193.1.3.1
Section4/check-and-diff/ansible.cfg
0 → 100644
View file @
9001bf36
[defaults]
deprecation_warnings=False
# don't like cows? that's unfortunate.
# set to 1 if you don't want cowsay support or export ANSIBLE_NOCOWS=1
nocows = 1
# You can only have one 'stdout' callback type enabled at a time. The default
# is 'default'. The 'yaml' or 'debug' stdout callback plugins are easier to read.
#
stdout_callback = default
#stdout_callback = yaml
#stdout_callback = debug
inventory = hosts
Section4/check-and-diff/change_hostname.yaml
0 → 100644
View file @
9001bf36
---
-
name
:
Change the hostname
hosts
:
veos
gather_facts
:
no
become
:
yes
vars
:
ansible_connection
:
network_cli
ansible_network_os
:
eos
tasks
:
-
name
:
run the hostname command
arista.eos.eos_config
:
lines
:
-
'
hostname
rumplestiltskin'
Section4/check-and-diff/hosts
0 → 100644
View file @
9001bf36
[guinea_pigs]
veos ansible_connection=ssh ansible_host=localhost ansible_port=9022 ansible_user=zork ansible_ssh_pass=swordfish
Section4/show-version-with-step/README.md
0 → 100644
View file @
9001bf36
# Show version with `--step`
You need to update the hosts file : replace the "veos" host
with one to which you can log on with ssh.
Run
``ansible-playbook -i hosts --step show-version.yaml``
and follow the prompts.
Section4/show-version-with-step/ansible.cfg
0 → 100644
View file @
9001bf36
[defaults]
deprecation_warnings=False
# don't like cows? that's unfortunate.
# set to 1 if you don't want cowsay support or export ANSIBLE_NOCOWS=1
nocows = 1
# You can only have one 'stdout' callback type enabled at a time. The default
# is 'default'. The 'yaml' or 'debug' stdout callback plugins are easier to read.
#
stdout_callback = default
#stdout_callback = yaml
#stdout_callback = debug
inventory = hosts
Section4/show-version-with-step/hosts
0 → 100644
View file @
9001bf36
[guinea_pigs]
veos ansible_connection=ssh ansible_host=localhost ansible_port=9022 ansible_user=zork ansible_password=swordfish
Section4/show-version-with-step/show-version.yaml
0 → 100644
View file @
9001bf36
---
-
name
:
Show version
hosts
:
veos
gather_facts
:
"
no"
connection
:
network_cli
tasks
:
-
name
:
Gather version
raw
:
'
show
version
|
include
Software'
register
:
showvers
-
name
:
Print output
debug
:
var=showvers.stdout_lines[0]
Section4/tags/playbook_with_tags.yaml
0 → 100644
View file @
9001bf36
---
-
name
:
Play to install service daemons
hosts
:
localhost
gather_facts
:
False
tasks
:
-
name
:
Install web servers
debug
:
msg
:
“Installing web servers”
tags
:
webservers
-
name
:
Install the db servers
debug
:
msg
:
“Installing db servers”
tags
:
dbservers
Section4/vault/README.md
0 → 100644
View file @
9001bf36
# Viewing a vault file
```
$ ansible-vault view secrets_encrypted.yaml
Vault password:
---
ansible_user: zork
ansible_password: swordfish
```
Section4/vault/ansible.cfg
0 → 100644
View file @
9001bf36
[defaults]
deprecation_warnings=False
# don't like cows? that's unfortunate.
# set to 1 if you don't want cowsay support or export ANSIBLE_NOCOWS=1
nocows = 1
# You can only have one 'stdout' callback type enabled at a time. The default
# is 'default'. The 'yaml' or 'debug' stdout callback plugins are easier to read.
#
stdout_callback = default
#stdout_callback = yaml
#stdout_callback = debug
inventory = hosts,hosts.cfg,hosts.ini,hosts.yml,hosts.yaml
Section4/vault/hosts_no_creds
0 → 100644
View file @
9001bf36
veos ansible_host=localhost ansible_port=9022 ansible_network_os=eos
Section4/vault/hosts_with_creds
0 → 100644
View file @
9001bf36
# veos ansible_connection=ssh ansible_host=localhost ansible_port=9022
veos ansible_connection=ssh ansible_host=localhost ansible_port=9022 ansible_user=zork ansible_ssh_pass=swordfish
Section4/vault/secrets_encrypted.yaml
0 → 100644
View file @
9001bf36
$ANSIBLE_VAULT;1.1;AES256
37353032393065373731303737373035366230386435613732346333383964623830636135323232
3132626139303264643037373937336231316531666333620a383330366531343130343262363637
35326532373235623632383537343165373637376435336261313462643639656130313035636662
3264376334333864640a366561303231303666646638666333376634393034366432633936633934
32333630356662363031323234303333336130343036633030336366616262343933303666343736
35316139336638373033633233646138633863633563363231333839303732373666356433656131
353334346133663663303734383863633334
Section4/vault/secrets_plaintext.yaml
0 → 100644
View file @
9001bf36
---
ansible_user
:
zork
ansible_password
:
swordfish
Section4/vault/show-imported-variables.yaml
0 → 100644
View file @
9001bf36
---
-
name
:
Show version
hosts
:
veos
gather_facts
:
"
no"
connection
:
network_cli
vars
:
ansible_connection
:
network_cli
ansible_network_os
:
eos
tasks
:
-
name
:
Include plaintext secrets
include_vars
:
secrets_plaintext.yaml
-
name
:
Show Ansible username
debug
:
var=ansible_user
-
name
:
Show Ansible password
debug
:
var=ansible_password
Section4/vault/show-version-with-raw.yaml
0 → 100644
View file @
9001bf36
---
-
name
:
Show version
hosts
:
veos
gather_facts
:
"
no"
connection
:
network_cli
tasks
:
-
name
:
Include plaintext secrets
include_vars
:
secrets_plaintext.yaml
# - name
:
Show Ansible username
# debug
:
var=ansible_user
#
# - name
:
Show Ansible password
# debug
:
var=ansible_password
-
name
:
Gather version from switch
raw
:
'
show
version
|
include
Software'
register
:
showvers
-
name
:
Print output
debug
:
var=showvers.stdout_lines[0]
Prev
1
2
3
4
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment