Skip to content

Commit 511f611

Browse files
committed
python terraform and other notes updates
1 parent 25acaac commit 511f611

8 files changed

+68
-6
lines changed

agile-automation/napalm-scripting.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### napalm scripting ###
2+
3+
# napalm module documentation
4+
ansible-doc napalm_get_facts

agile-automation/python.txt

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// install python modules
2+
sudo apt install python python3 virtualenv python-virtualenv
3+
cd
4+
// setup environment
5+
# switch to root of new project folder
6+
cd newproj
7+
8+
# create a new virtual environment inside the project folder called env
9+
virtualenv -p /usr/bin/python3 env
10+
11+
# change to new working directory to be used as root of new environment
12+
13+
# initialize python environment
14+
source env/bin/activate
15+
16+
// setup napalm
17+
# install modules
18+
pip install ansible napalm napalm-ansible
19+
20+
# can also install modules using a requirements.txt file
21+
requirements.txt:
22+
napalm==2.4.0
23+
click==6.7
24+
25+
pip install -r requirements.txt
26+
27+
# clone napalm ansible modules from repo
28+
sudo mkdir -p /usr/share/ansible/plugins/modules
29+
30+
sudo git clone https://github.com/napalm-automation/napalm-ansible.git /usr/share/ansible/plugins/modules
31+
ansible-doc napalm_get_facts
32+
33+
# verify installation
34+
ansible-doc napalm_get_facts
35+
36+
// napalm commands
37+
# napalm connect to device for basic info
38+
napalm -u cisco -p cisco -v ios csr1kv1 call get_facts

agile-automation/terraform.txt

+24-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
1-
Terraform
1+
// view traces //
2+
export TF_LOG=TRACE
3+
set 'TF_LOG' environment variable to trace for logging
4+
5+
## dynamic backend files
6+
terraform init -backend-config './np1/backend.conf'
27

8+
## dynamic variable files
9+
terraform plan –var-file ./np1/vars.tf
10+
11+
// general notes //
312
each file is a representation of a state file back on the storage blob
413

14+
// general commands //
515
terraform init: create working directory
616
terraform plan: connect to storage account as listed in main.tf file
717
compare state in storage account with running state
818
show differences
919

1020
terraform apply: apply generated plan
1121

12-
export TF_LOG=TRACE
13-
set 'TF_LOG' environment variable to trace for logging
22+
23+
// manage state file //
24+
# list items
25+
terraform state list
26+
27+
# remove items
28+
terraform state rm ADDRESS
29+
30+
# show items
31+
terraform state show ADDRESS
32+
33+
# import resource into state file
34+
terraform import

blueprints-combined.xlsx

315 Bytes
Binary file not shown.

linux/gnu-linux-cheat-sheet.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
### GNU Linux Cheat Sheet ###
22

3-
43
# special permissions for ssh keys
54
chmod 600 keyfile.pub
65

@@ -56,6 +55,8 @@ screen -d -R name
5655
screen -r name
5756
[CTRL+a, d to detach]
5857

58+
screen -X -S [# to kill] quit kill the screen session
59+
5960
TAR (BACKUP WITH GZIP COMPRESSION)
6061
tar czfv source dest.tgz
6162

regex-tricks.txt

-2
This file was deleted.
Binary file not shown.

topic-notes/dhcp-snooping.xlsx

9.68 KB
Binary file not shown.

0 commit comments

Comments
 (0)