What is Ansible Part V: Code vs Data

Gourav Shah
A free video tutorial from Gourav Shah
Premium Instructor| 35k+ students| Devops Trainer and Author
4.1 instructor rating • 14 courses • 41,181 students

Learn more from the full course

Ultimate Ansible Bootcamp by School of Devops®

Unofficial Guide to EX407 Redhat Certified Specialist in Ansible Automation

07:32:45 of on-demand video • Updated July 2020

  • What is ansible, why its needed and how it works
  • How to configure ansible and setup static/dynamic inventories
  • Ad hoc server management, running jobs in parallel
  • Managing systems entities using ansible Modules
  • Writing Playbooks to define the state of infrastructure as a code
  • Creating modular, reusable code with Roles
  • Creating dynmic code with vars and templates
  • Using Ansible Galaxy
  • Encrypting sensitive data with Vault
  • Service Discovery and managing Multiple Environments
  • Application Deployment Strategies, Rolling Updates
English [Auto] In the previous lesson I talked about the infrastructure as a called abilities of animal. In this one I I'm going to talk about animals ability to separate code and data which makes and table code that you write generic reusable and shareable. And why this is important is because if we do not have this feature imagine you will have one application and you want to run it across your environments. Let's say you have three different environment Dev staging and production. Now even though let's say I'm going to take an example of a very generic application open source application that is a Apache now but has millions of installation across hundreds of thousands of organizations possibly even more. Now even though we all use let's say all these organizations he was a Bashi they might configure it differently even within one organization. You may want to call even though it is a passion you may want to configure it differently using different boards. You may want to run it as different users. You may have different configuration parameters and you may want to do that for every single environment. Now unless you have an ability to create some generic template to hold these configuration it would be extremely difficult to manage such kind of environments and then it would be you know very inconsistent way to do that because one way to one when I can think of doing this is creating three different configuration files with three different environments. But imagine I have more than three. I have probably 7 8 environments and imagine the scale at which we are talking about let's say Apache is being used in hundreds of thousands of organizations so it could also translate to hundreds of thousands of configuration copies of those configuration files. Now instead of this kind we just make the configuration as generic as the partial server itself is and that's where the templating comes in which allows you to create one single template which is part of your code which looks like this. So instead of running that configuration or creating the copies of the configuration files you create a template which is this one which is as good as one generic code for one application and then you can create the configuration profiles for your environment. For example in dev I want to use this configuration in staging I may have a different configuration file in production. I may have a different configuration file. And the advantage with this is since you split your code from the data. Data is specific to the organizations you take organizational specific data out of it. Your code becomes very generic and that code then can be shared with others in the form of typically rules. Rules is how you package your code and share it with others. And the best part about all of this is you have a site called identical galaxy. And there you can find hundreds or thousands of rules for thousands of different applications available there. Now why this is important again is if you want to let it configure Cassandra tomorrow or if you want to configure Hadoop cluster you don't even have to write a single line of code there because you might find some generic tasks and templates and rules available in animal galaxy which you can download at configuration file all variables file which is specific to your organization which is this matter of defining or configuration and you're done with the complete configuration. That is a possibility that is very much a possibility and this is why the separation of code and data is important because that is what allows you to share the rules share the code with others and then reuse the code written by others somebody else right. So you can save weeks or months of time at a time in some cases if you know if you have an ability to reuse that code and that's what makes a symbol quite powerful again. So we just talked about code and data separation. We're going to continue talking about the features related to infrastructure as a core with IDE importance as the next one.