Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intro to Ansible Lab inventory file not found #100

Open
GShuttleworth opened this issue Feb 17, 2021 · 2 comments
Open

Intro to Ansible Lab inventory file not found #100

GShuttleworth opened this issue Feb 17, 2021 · 2 comments

Comments

@GShuttleworth
Copy link

When trying to run the lab I get errors around the inventory file/host file not being found:

ansible-playbook ansible-02-ios-modules/02-ios_command_show.yaml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
[WARNING]: Could not match supplied host pattern, ignoring: iosxe

I believe the ansible.cfg file is incorrect.

When changed from:

[defaults]
hostfile = hosts
host_key_checking = False
deprecation_warnings=False
stdout_callback = skippy


[persistent_connection]
connect_timeout = 100
command_timeout = 80

to (changing line 2)

[defaults]
inventory = hosts
host_key_checking = False
deprecation_warnings=False
stdout_callback = skippy


[persistent_connection]
connect_timeout = 100
command_timeout = 80

all errors are solved and the playbooks run as intended.

I would create a pull request for this change but want someone to sanity check this first for me.

@d3nisko
Copy link
Contributor

d3nisko commented Feb 17, 2021

I think you got it right. Have checked official documentation from ansible here: https://docs.ansible.com/ansible/latest/reference_appendices/config.html
They have reference to inventory, but didn't find reference to hostfile. Here is what they have on the doc. page:
inventory = /etc/ansible/hosts ; This points to the file that lists your hosts

@nyukers
Copy link

nyukers commented Feb 18, 2022

[defaults]
inventory = ./hosts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants