ansible installation: no /etc/ansible/hosts file

6,417 views
Skip to first unread message

Sebastian M Cheung

unread,
Nov 29, 2015, 8:27:38 AM11/29/15
to Ansible Project
No file for /etc/ansible/hosts

Where is this file? Instructor opened an automatically generated /etc/ansible/hosts file but there is no such file in Mac OSX after ansible is installed?

Am I supposed to create this file myself or it is automatically generated? as I cannot find it on Mac OSX after 

$brew install ansible

as well as

$pip install ansible


Thanks

Arbab Nazar

unread,
Nov 29, 2015, 11:57:44 AM11/29/15
to Ansible Project
You have to create it by yourself as pip and brew didn't create it. I think you even didn't have /etc/ansible directory.

rup

unread,
Nov 30, 2015, 12:30:54 PM11/30/15
to Ansible Project
We don't bother with the /etc/ansible/hosts file because we installed ansible in a different directory.  So we always specify which host file to use in our run.  I.e. when in the ansible directory I execute:

ansible-playbook -i <hosts_file> site.yml -vv

stevenjw...@gmail.com

unread,
Sep 24, 2020, 4:02:38 PM9/24/20
to Ansible Project
What if you want to use another directory for hosts, this is where the ansible.cfg file comes in handy. So where does this file go in MacOSX?

Dick Visser

unread,
Sep 25, 2020, 5:22:24 AM9/25/20
to ansible...@googlegroups.com
https://docs.ansible.com/ansible/latest/installation_guide/intro_configuration.html#configuration-file
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b2219180-846e-44b3-9248-3482cee6f8f5n%40googlegroups.com.



--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

ebcak random

unread,
Sep 26, 2020, 4:55:24 PM9/26/20
to Ansible Project
Referenced here in order at what ansible looks for...personally I never use /etc/ansible/ansible.cfg and tend to use a  master one in  ~/ or ansible.cfg per project directory which specifies other certain criteria I need for my playbook

  • ANSIBLE_CONFIG (environment variable if set)

  • ansible.cfg (in the current directory)

  • ~/.ansible.cfg (in the home directory)

  • /etc/ansible/ansible.cfg

Reply all
Reply to author
Forward
0 new messages