Hello,
I'm getting a traceback on a group_by, which is intended to create a group
named after each of a host's existing groups, prepended by a variable that
is being set with '-e' at invocation (a site/host-group ID):
- name: vagrant | Create provider-agnostic ID_and_type group
> group_by: key="{{ id }}_{{ item }}"
> with_items: group_names
> when: provider == "vagrant"
>
The variable *provider* is also being set via '-e'. So for example, a host
that was part of the dns and mail groups would be added to groups like
prodSite1_dns and prodSite1_mail. These are not being set statically in an
inventory file because sometimes it is run on ec2 hosts and the groups are
pulled from tags, and sometimes it is run on a vagrant box and the groups
are written into an inventory script.
Here is what I'm getting when running with -vvvv:
TASK: [iaas_gather_multi | ec2 | Create provider-agnostic ID group]
> ***********
> skipping: [localhost]
>
> TASK: [iaas_gather_multi | ec2 | Create provider-agnostic type group]
> *********
> skipping: [localhost]
>
> TASK: [iaas_gather_multi | ec2 | Create provider-agnostic ID_and_type
> group] ***
> skipping: [localhost]
>
> TASK: [iaas_gather_multi | ec2 | Create provider-agnostic host-provisioned
> boolean] ***
> skipping: [localhost]
>
> TASK: [iaas_gather_multi | debug var=group_names]
> *****************************
> ok: [localhost] => {
> "group_names": [
> "db",
> "webnode"
> ],
> "item": ""
> }
>
> TASK: [iaas_gather_multi | vagrant | Create provider-agnostic ID_and_type
> group] ***
> created 'group_by' ActionModule: key={{id}}_{{item}}
> changed: [localhost] => (item=db) => {"changed": true, "groups":
> {"vagrant-devhost_db": ["localhost"]}, "item": "db"}
> created 'group_by' ActionModule: key={{id}}_{{item}}
> fatal: [localhost] => Traceback (most recent call last):
> File "/usr/lib/pymodules/python2.7/ansible/runner/__init__.py", line
> 394, in _executor
> exec_rc = self._executor_internal(host, new_stdin)
> File "/usr/lib/pymodules/python2.7/ansible/runner/__init__.py", line
> 514, in _executor_internal
> complex_args=complex_args
> File "/usr/lib/pymodules/python2.7/ansible/runner/__init__.py", line
> 685, in _executor_internal_inner
> result = handler.run(conn, tmp, module_name, module_args, inject,
> complex_args)
> File
> "/usr/lib/pymodules/python2.7/ansible/runner/action_plugins/group_by.py",
> line 86, in run
> del self.runner.inventory._vars_per_host[host]
> KeyError: u'localhost'
>
>
> FATAL: all hosts have already failed -- aborting
>
Thank you,
Mark
--
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].
For more options, visit https://groups.google.com/groups/opt_out.