DevOps Classroom Series – 13/Nov/2021

Chef Templates

  • Refer Here for the official documentation

  • Chef templates is an Embedded ruby template (ERB) so in files we can have dynamic content

  • Lets try to create a template Preview

  • Dynamic expressions in embedded ruby should be <%= %>

  • When we try to copy the template using template resource, the file will evaluated all the expression in <%= %> will be replaced by its dynamic values. Refer Here for the template resource

  • Refer Here for the changeset Preview

  • Now lets generate tomcat-users file template

  • Refer Here for the changeset containing all of the steps to install tomcat9 as per documentation Refer Here

  • Now lets also add support for centos 7

    • Refer Here for the necessary changes done in the cookbook to make it work for centos 7
  • Lets try to use the test kitchen with Azure Refer Here for the documentation

  • Lets get image urn for centos 7 Preview

  • Search for ubuntu 20 urn by executing the following command in Azure CLI az vm image list -f UbuntuServer --all --output table & the other command which we tried az vm image list -p canonical -o table --all | grep 20_04-lts | grep -v gen2

  • Fix for the issue observed in the class add the ssh_key path in transport in kitchen.yml file Preview

  • Now execute the kitchen commands Preview Preview Preview Preview

  • Azure Ubuntu 20.04 VM from test kitchen Preview Preview Preview

  • Azure Centos 7 VM from test kitchen Preview Preview Preview

  • In the changeset which i’m commiting i have removed subscription id for security reasons. Refer Here for the changeset

Leave a Reply

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

Please turn AdBlock off
Floating Social Media Icons by Acurax Wordpress Designers

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