Ansible.cfg file when using ansible-playbook

Hi,All

You may want to change ansible.cfg when using ansible packs.

There are two types of ansible.cfg in stackstorm.
` /opt/stackstorm/virtualenvs/ansible/lib/python2.7/site-packages/ansible/galaxy/data/apb/tests/ansible.cfg /opt/stackstorm/virtualenvs/ansible/lib/python2.7/site-packages/ansible/galaxy/data/container/tests/ansible.cfg `

But I don’t want to use ansible-galaxy …

Is one of these two cfg files ansible.cfg that is referenced when using ansible-playbook?

The files that you are referring to are part of the Ansible pack, which is not installed by default on StackStorm.

I’m not super familiar with Ansible, but from a quick look, that pack contains actions that allow you to use ansible-galaxy (galaxy.list, galaxy.install, galaxy.remove), as well as actions that have nothing to do with ansible-galaxy (command, command_local, playbook, vault.*).

This means that while you are enabled to use Ansible galaxy, you are not forced to use Ansible galaxy.

To find an answer to the question that you asked, you’ll have to dig through the metadata and implementation of the playbook action.

You can check which ansible.cfg file is referenced when using Ansible.

Just run /opt/stackstorm/virtualenvs/ansible/bin/ansible --version to show this debug information for you:

$ /opt/stackstorm/virtualenvs/ansible/bin/ansible --version
ansible 2.9.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/vagrant/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/stackstorm/virtualenvs/ansible/lib/python2.7/site-packages/ansible
  executable location = /opt/stackstorm/virtualenvs/ansible/bin/ansible
  python version = 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609]

See more https://docs.ansible.com/ansible/latest/reference_appendices/general_precedence.html#configuration-settings about Ansible configuration file precedence and how to configure it to use the file you want.

Hi, blag and armab.

Thank you for answering.

blag
I created an EC2 instance with Ansible-playbook (using ansible pack) with an inventory, and tried to register the created host in the inventory.
Standard output when Ansible was executed ended normally.
However, nothing was written in the inventory file.
Therefore, I thought that some setting was done in ansible.cfg and wanted to confirm.

armab
Thank you! I was able to confirm.
But ansible.cfg doesn’t seem to be …

[root @ stack ~] # / opt / stackstorm / virtualenvs / ansible / bin / ansible --version
ansible 2.8.6
  config file = None
  configured module search path = [u '/ root / .ansible / plugins / modules', u '/ usr / share / ansible / plugins / modules']
  ansible python module location = /opt/stackstorm/virtualenvs/ansible/lib/python2.7/site-packages/ansible
  executable location = / opt / stackstorm / virtualenvs / ansible / bin / ansible
  python version = 2.7.5 (default, Aug 7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
[root @ stack ~] #