Skip to content

Code developed inside Ansible using Jinja2 and external database ( csv file )

License

Notifications You must be signed in to change notification settings

rarodrigo/jinja2_csv_template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Executing Validation Test about Jinja2 inside Ansible using csv file

The whole process about this developer action were declared inside my BLOG which is better to explain all process, as well as, print screen and explaining each code part.

I explained the role process inside my BLOG and until now are in 5 steps doing test and making validation in different situation. Follow the 4 steps explaining this implementation:

Part 1 - CSV Configuration File
Part 2 - Configuration inside Jinja2
Part 3 - Variable Loop inside Jinja2
Part 4 - Loop using variable validation

There are many resource used in this script, however all modules are inside Ansible documentation using roles, group_vars,jinja2,csv file database and conditionals.

We can follow description to execute those tasks:

  • Create CSV File Database adding all information are necessary or information are received from another database.
  • Making a dictionary in order to populate all variables.
  • Splitting in different roles to segregate process and putting clear code.
  • Execute Jinja2 template inserting variables and using conditionals to execute different actions.
  • Making some validation based in condition ( if, else, while ) to make sure if loopback ids should be implemented
  • Generate template script based in your inventory hostname.
  • Apply in your device.

PS.: The explanation in BLOG Channel was executed in Portuguese, however there are facilities inside of channel to make a translation.

About

Code developed inside Ansible using Jinja2 and external database ( csv file )

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published