Linux – No Ansible config file or /etc/ansible directory after trying pip and yum install

ansibleinstallationlinuxpipyum

So I have been trying to install Ansible for some server management however it seems that yum and pip both don't want to co-operate:

  1. I tried a yum install which refuses to work because it cant seem to find any more repo's for babel/jinja2.
  2. pip installation works, however it left me without any Ansible.cfg file, or any /etc/Ansible directory at all. It seems to have installed it to the python 2.7 directory which is showing python configuration files but not anything to do with the standard Ansible configuration files that I have been seeing in the documentation.

Questions:

  • Is there any work around for this, or is there any way to just use Ansible through python directly (meaning update inventory lists and create playbooks that would I guess be saved to pythons directory?).
  • Also is there a way to force yum to install Ansible regardless of the jinja2/babel dependencies so I can at least work on creating my first few playbooks and getting familiar with the basics?

I'm not sure if these packages are necessary to Ansible operations and if it would create a dependency loop issue when trying to later install/update. Please go easy as I am new and trying to learn more about the capabilities of Ansbile. Os is RHEL 7.5 btw, and no it doesn't have a subscription I've been using EPEL which doesn't seem to work!

Best Answer

Ansible works fine from any directory. You don't need to use /etc/ansible.

  • Install Ansible from pip
  • Create work directory with recommended structure
  • Use -i to point your current inventory (testing or production, for example).
  • Create ansible.cfg in the root of your directory if you need:

    [defaults]
    #inventory      = /etc/ansible/hosts
    inventory      = hosts