Hi Guys,

I am having some issues getting add_host to create a dynamic inventory 
correctly.

Here is the relevant section from my playbook:


tasks:
    - name: Connect to Cloud
      # assume RC file has already been sourced
      os_auth:

    - name: launch web instances
      os_server:
        name=web0{{ item }}
        flavor={{ flavor }}
        image={{ image }}
        key_name={{ key_name }}
        state=present
        wait=true
        network={{ network }}
        security_groups={{ security_groups }}
        auto_ip=true
      register: newnodes
      with_sequence:
        count={{ count }}

    # - debug:
    #     var: newnodes

    - name: add nodes to runtime inventory
      add_host:
        name={{ item.name }}
        # group=workers
        # ansible_host={{ item.public_v4 }}
      with_items:
        - "{{ newnodes.results.server }}"



The tasks 'Connect to Cloud' and 'launch web servers' work fine.

I also ran debug on the newnodes variable and it is returning the correct 
data. The problem is that when I try to run the 'add nodes to runtime 
inventory' task I get the following:

[DEPRECATION WARNING]: Skipping task due to undefined Error, in the future 
this will be a fatal error.. This feature will be removed in a future 
release. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.

If I run the playbook with -vvvv I get no further information. I have also 
tried various combinations of the variable name 'newnodes.results.server' in 
the with_items section but no joy.

Anyone able to see what I have missed here?

Cheers,
Glyn




-- 
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/294027a4-7f9c-4fae-9510-09173efe77ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to