It seems that the problem is definetly about reading the inventory. at
the
/Users/oyarimtepe/Dev/vmware/command-center/cc-cli/venv/lib/python2.7/site-packages/ansible/inventory/__init__.py
def get_host(self, hostname):
if hostname not in self._hosts_cache:
self._hosts_cache[hostname] = self._get_host(hostname)
*..*
*hosts_cache is empty. *
Thats why it is throwing exception. Seems i am doing something wrong
about defining an Inventory as host.
Here is my hosts file /Users/oyarimtepe/Dev/vmware/command-center/register/hosts
[local]
127.0.0.1 ansible_python_interpreter=python
[default]
10.35.75.247 ansible_python_interpreter=python ansible_user=root
ansible_ssh_pass=xxxx
I set it at
# create inventory and pass to var manager
inventory = Inventory(loader=loader,
variable_manager=variable_manager, host_list=self.hostname_hosts)
variable_manager.extra_vars = {'hosts': self.host, 'hostname': self.hostname,
'conn_name': self.conn_name,
'guest_ip4_address': self.guest_ip4_address,
'guest_ip4_address_for_restart':
self.guest_ip4_address_for_restart,
'guest_gw4_address':
self.guest_gw4_address, 'template_ip': self.template_ip} # This can
accomodate various other command line arguments.`
variable_manager.set_inventory(inventory)
Below are the variables:
host: 'default'
hostname: 'somehostname'
suffix: 'xxx'
conn_name: 'ens192'
guest_ip4_address_for_restart: '10.35.101.220'
guest_ip4_address: '10.35.101.220/24'
guest_gw4_address: '10.35.101.1'
self.hostname_hosts is set as
/Users/oyarimtepe/Dev/vmware/command-center/register/hosts. Is it true
to use a file there?
Also the hosts part at variable_manager.extra_vars is default, is it true?
Any idea what i am doing wrong?
I also set the ansible.cfg path and below is the content
[defaults]
hostfile = /Users/oyarimtepe/Dev/vmware/command-center/register/hosts
inventory = /Users/oyarimtepe/Dev/vmware/command-center/register/hosts
On Mon, Oct 24, 2016 at 4:37 PM, Brian Coca <[email protected]> wrote:
> You don't show how/where you define `self.hostname_hosts`.
>
>
> ----------
> Brian Coca
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/p8OzBaUbjpU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/CACVha7cTCgv%2BGXOjcGXhewNSQT-
> B7CPM3%3DYPGL_ryG6yiD7rOw%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CACVha7cTCgv%2BGXOjcGXhewNSQT-B7CPM3%3DYPGL_ryG6yiD7rOw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
Oğuz Yarımtepe
http://about.me/oguzy
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAKtWOTToqTUU2oVTNCD0Cgpt6q0AAVX%2BjgAVmjr7yKFGF9UThQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.