We will use a new branch to add the template and policy but first make sure you pull the latest change from main branch
git checkout main
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
git pull
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (1/1), 257 bytes | 257.00 KiB/s, done.
From 10.0.208.215:CL-POD02/DEVWKS-3320
539bcbe..1b8c832 main -> origin/main
Updating 539bcbe..1b8c832
Fast-forward
prod.env.tfvars | 12 ++++++++++++
stage.env.tfvars | 12 ++++++++++++
task01_interfaces/interface.tfvars | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
task01_interfaces/main.tf | 23 +++++++++++++++++++++++
task01_interfaces/variables.tf | 39 +++++++++++++++++++++++++++++++++++++++
task02_overlay/main.tf | 23 +++++++++++++++++++++++
task02_overlay/overlay.tfvars | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
task02_overlay/variables.tf | 43 +++++++++++++++++++++++++++++++++++++++++++
8 files changed, 264 insertions(+)
git checkout -b policy
Switched to a new branch 'policy'
main.tf
code -r /home/cisco/CiscoLive/DEVWKS-3320/main.tf
Add below content to the end of file and press Ctrl+s
to save it.
module "policy" {
source = "./modules/policy"
fabric_name = var.fabric_name
inventory = var.inventory
templates = var.templates
policies = var.policies
}
variables.tf
code -r /home/cisco/CiscoLive/DEVWKS-3320/variables.tf
Add below content to the end of file and press Ctrl+s
to save it.
variable "templates" {
type = list(object({
name = string
description = string
file = string
}))
}
variable "policies" {
type = list(object({
switch_id = string
template_name = string
description = string
priority = number
props = map(any)
}))
}
common.tfvars
code -r /home/cisco/CiscoLive/DEVWKS-3320/common.tfvars
Add below content to the end of file and press Ctrl+s
to save it.
templates = [
{
name = "telemetry"
description = "static telemetry config"
file = "./telemetry.tmpl"
}
]
policies = [
{
switch_id = 101
template_name = "telemetry"
description = "dialout telemetry"
priority = 500
props = {}
},
{
switch_id = 102
template_name = "telemetry"
description = "dialout telemetry"
priority = 500
props = {}
},
{
switch_id = 201
template_name = "telemetry"
description = "dialout telemetry"
priority = 500
props = {}
},
{
switch_id = 101
template_name = "ntp_server"
description = "ntp_server 10.81.254.131"
priority = 500
props = {
"NTP_SERVER" = "10.81.254.131"
"NTP_SERVER_VRF" = "management"
}
},
{
switch_id = 102
template_name = "ntp_server"
description = "ntp_server 10.81.254.131"
priority = 500
props = {
"NTP_SERVER" = "10.81.254.131"
"NTP_SERVER_VRF" = "management"
}
},
{
switch_id = 201
template_name = "ntp_server"
description = "ntp_server 10.81.254.131"
priority = 500
props = {
"NTP_SERVER" = "10.81.254.131"
"NTP_SERVER_VRF" = "management"
}
}
]
telemetry.tmpl
code -r /home/cisco/CiscoLive/DEVWKS-3320/telemetry.tmpl
Copy below content to the file and press Ctrl+s
to save it.
##template variables
##
##template content
! example of freeform template
feature telemetry
telemetry
destination-profile
use-vrf management
destination-group 1
ip address 1.1.1.1 port 57000 protocol gRPC encoding GPB
sensor-group 1
data-source DME
path sys/ch depth unbounded
sensor-group 2
data-source DME
path sys/intf depth unbounded
subscription 1
dst-grp 1
snsr-grp 1 sample-interval 10000
subscription 2
dst-grp 1
snsr-grp 2 sample-interval 10000
##
git commit -a -m "policy"
[policy abccf7b] policy
4 files changed, 109 insertions(+)
git push --set-upstream origin policy
Enumerating objects: 10, done.
Counting objects: 100% (10/10), done.
Delta compression using up to 8 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 1.19 KiB | 1.19 MiB/s, done.
Total 6 (delta 4), reused 0 (delta 0), pack-reused 0
remote:
remote: To create a merge request for policy, visit:
remote: http://10.0.208.215/CL-POD02/DEVWKS-3320/-/merge_requests/new?merge_request%5Bsource_branch%5D=policy
remote:
To 10.0.208.215:CL-POD02/DEVWKS-3320.git
* [new branch] policy -> policy
branch 'policy' set up to track 'origin/policy'.
Now we need to create PR to actual test the config on the staging environment, Open gitlab on a new tab:
At the Gitlab login screen, login using your username and password: