DevOps Classroomnotes 10/Jan/2023

Ansible Templates

  • Ansible uses jinja2 for templating Refer Here
  • In ansible to use the variables we use expression {{ variable_name }} which is derived from templating language jinja2
  • jinja2 also has wide filters
  • We can use jinja2 in files so that the content can be dynamic
  • we have created a sample template with simple text. Refer Here for the chagnes
    Preview
  • Refer Here for the changes in tomcat where we have used template rather than static file for users.xml
  • Refer Here for the changes done to remove duplicate service file
  • Tomcat was not running due to permission issues, so ensured permissions are checked every time Refer Here for the changes
  • Refer Here for the optional update added for ubuntu instance
  • Make changes in the tomcat playbook to use find /opt/tomcat/latest/bin' -name '*.sh' and use register variable and loop to apply execute permissions to all the shell files
  • For finding files use ansible.builtin.find module, use register variable and figure out a module to change the file permissions.

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Wordpress Development Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube