Search code examples
ansibleansible-inventory

Is there a way to define the ansible inventory path inside the playbook?


I'm trying to find a way to specify the inventory path in a playbook instead of in the ansible.cfg file or by using -i during execution of the playbook. Is this possible?


Solution

  • No. It's not possible to define the ansible inventory path inside the playbook.

    Quoting from Ansible Configuration Settings

    "Ansible supports a few ways of providing configuration variables, mainly through environment variables, command line switches and an ini file named ansible.cfg