Ansible configuration ansible.cfg env variables – Ansible tutorial Video 3



Ansible configuration ansible.cfg env variables – Ansible tutorial Video 3

Ansible configuration ansible.cfg env variables - Ansible tutorial Video 3

Ansible configuration ansible.cfg env variables – Ansible tutorial Video 3
Ansible notes https://bizanosa.com/ansible-tutorial-for-beginners/

Here is the corrected version of the YouTube captions:

This is where we ended the last part, and this is going to help us talk about Ansible configuration. So, I will do another one: `ansible –list-hosts`. When we do this, we are told that our inventory is empty. If you want to list the hosts for the inventory that we have here, we have to define it explicitly. We will have to tell Ansible to use this as an inventory.

When you do that, it’s going to list all the hosts that you have in this inventory file. That inventory file, and we’re going to look at inventories at some point. But I want to use this as an example of ansible.cfg. So, let’s talk about Ansible configuration. If you come here, I will put all the links in the description. We are going to talk about the precedence of Ansible configuration. Now, configuration simply allows you to set various settings or various features for Ansible. For example, usually, you’ll have an ansible.cfg file, and this is a file that you can use to define various things for Ansible. So, the default way is for you to use an ansible.cfg, but there are different ways for which you can set Ansible configurations. So, the first one is, and this is the one that will always take precedence, so this will override everything else that is Ansible: the environment variable. If you set an environment variable for Ansible in your shell, then that will always take precedence. So, you can set an environment variable here, and that’s going to take precedence over all these other configuration files. You can also have your files in ansible.cfg in the working directory. So, the working directory is where your current files are. So, here, where we have this, you can create a file called ansible.cfg.

This is an INI file. I mean, .INI configurations for Ansible that you put here will override all the configurations that you have in the ansible.cfg in the home directory. Let’s just confirm if we have an Ansible.cfg in the home directory. For this, let me just come back here, and I will `cd` without anything. That’s going to take me to the home directory, and I’m going to do `ls -la`, and here you can see we have ansible, but we don’t have ansible.cfg. So, if you need to create an ansible.cfg file, you could create one inside here, and it will override the one that is in `/etc`. I don’t know whether I have this. Let me confirm if I have ansible `/etc`, so this will exist depending on how you install the ansible. If you installed it via Python pip, you’re probably not going to have this directory. So, since I installed mine in Ubuntu via WSL, I know I should have it. So, I’m just going to do `ls -lh /etc` and then I’m going to paste, and you can see we do have ansible.cfg inside there. And we can even see what’s inside this file. Let’s just look at what we have here.

And you can see it’s just a small file without anything.

Right, and you’re going to see how we can disable an ansible configuration file.

What is the importance of an ansible configuration file? You can set up different things for your ansible. For instance, in my case here, we can set up a default inventory. So, you can see we have I’ve created this manually ansible.cfg, but if I run that configuration, if I run this `ansible-config init –disabled`, ansible.cfg is going to create an ansible configuration with lots and lots of different options you can have for an ansible configuration file. But since we’ve set it as disabled, all of them are going to be commented out. If you don’t want them commented out, just remove `–disabled`, and this is going to give you configurations that are not disabled, which is something you don’t want because it’s going to set those settings for your ansible. So, if I do that, enter, you’ll not see that ansible.cfg has all these options that you can have: actions, warnings, if there are any warnings, you’ll get warnings on the terminal. You can change cowsay settings, you can change cow path. This is just, I don’t know why people use this package or plugin or module, whatever it is, but it just brings

Please consider supporting my channel:
Order services:
Bizanosa WordPress Support Service : https://bizanosa.com/wordpress-support-service/
Bizanosa VPS Support service : https://bizanosa.com/web-server-services/

Donate:
https://paypal.me/rwahowa

https://www.buymeacoffee.com/bizanosa

****Support My Channel****

If this video was helpful to you, consider supporting my channel : https://paypal.me/rwahowa

I will greatly appreciate your support.

SOCIAL :
Facebook : fb.com/bizanosa
Website : https://bizanosa.com