The "|default('')" should handle individual meta data keys not being
available.I've never seen this happen. You might try running with -v to see what the calls to rax_facts are returning. rax_metadata should always be present and should always be a dict. On Wed, Jun 4, 2014 at 2:03 PM, Jurgen Coetsiers < [email protected]> wrote: > Matt, > > Great, meta data is now correctly put into the api call.. > > However we still are having some problems. Sometimes the script goes > faster then the meta data becomes available: > > fatal: [web6] => error while evaluating conditional: > rax_facts.ansible_facts.rax_metadata['rackconnect_automation_status']|default('') > == 'DEPLOYED' > > We checked and the automation status metadata is not yet present and as > such the check fails. > > Jurgen > > > > On 04 Jun 2014, at 18:15, Matt Martz <[email protected]> wrote: > > PR #7122 has just been merged. It also includes a new module "rax_meta" > for more easily allowing metadata updates on cloud servers. > > Both "rax" and "rax_meta" use the improved metadata normalization code. > > > On Tue, Jun 3, 2014 at 6:26 PM, Matt Martz <[email protected]> wrote: > >> That issue is fixed in another pull request which is waiting to be merged: >> >> https://github.com/ansible/ansible/pull/7122 >> >> -- >> Matt Martz >> [email protected] >> >> On June 3, 2014 at 6:22:59 PM, Jürgen Coetsiers ( >> [email protected]) wrote: >> >> Matt, >> >> tx this was of great help! >> >> We saw that wen adding the metadata for the LB Pools >> >> meta: >> RackConnectLBPool: marlintest >> >> that strangely the name that is captured by the api is: >> >> u'marlintest' and as such the rackconnect script fails. >> >> I tried putting " around it but no luck >> >> Any ideas? >> >> Op dinsdag 3 juni 2014 18:52:07 UTC+2 schreef Matt Martz: >>> >>> I have some sample plays that show how to wait for RackConnect >>> automation and the Managed Cloud automation to complete before moving on. >>> I haven't gotten around to adding it to the Rackspace guide, but hope to >>> do so soon. >>> >>> You can see those sample playbooks: >>> >>> https://github.com/sivel/ansible-samples/tree/master/rackconnect >>> >>> In your specific case, the following lines are probably what you are in >>> need of https://github.com/sivel/ansible-samples/blob/master/ >>> rackconnect/rackconnect-push-mode.yml#L49-L58 >>> >>> On another note, you cannot call a module from within another module. >>> So your attempts at running set_fact inside of a local_action for >>> rax_facts just can't work. >>> >>> >>> On Tue, Jun 3, 2014 at 11:29 AM, Jürgen Coetsiers < >>> [email protected]> wrote: >>> >>>> Hi All, >>>> >>>> My Rackspace cloud servers are under managed services and under >>>> RackConnect services. This means than when they are built, first 2 other >>>> scripts need to run before I can actually use the server to provision it. >>>> >>>> The peculiar thing is that during the RackConnect script the public ip >>>> of the server changes, so it in validates the data you "register" using the >>>> rax module when adding a server. >>>> >>>> The fact is that we do not know precise when these build scripts have >>>> finished running. The only way to figure it out is either through the >>>> presence of a file in the servers /tmp directory or by querying the fact >>>> data received through the rackspace api. It should have a NVP set in the >>>> metatags field. >>>> >>>> So basically what I want to do is: >>>> >>>> - create cloud server >>>> - poll factsdata until certain values are set >>>> - provision the server >>>> >>>> The documentation of the rax_facts module does not provide a lot of >>>> info, event when copying the sample is fails due to "{{ rax_accessipv4 }}" >>>> not existing... >>>> >>>> So who can help me out here or me into the right direction? >>>> >>>> My current playbook: >>>> - name: Wait for Rackspace Managed Service provisioning completion >>>> hosts: raxtest >>>> gather_facts: False >>>> remote_user: root >>>> tasks: >>>> - name: Get meta data and check for completion of setup >>>> local_action: >>>> module: rax_facts >>>> api_key: <hidden> >>>> username: <hidden> >>>> register: result >>>> name: "{{ inventory_hostname }}" >>>> set_fact: managed_done = "{{rax_metadata.rax_service_ >>>> level_automation}}" >>>> set_fact: ansible_ssh_host = "{{ rax_accessipv4 }}" >>>> until: managed_done = "Complete" >>>> retries: 20 >>>> delay: 30 >>>> >>>> >>>> >>>> -- >>>> 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/f64bc273-bb58-41d0-9879- >>>> 91a4d2ecf3a3%40googlegroups.com >>>> <https://groups.google.com/d/msgid/ansible-project/f64bc273-bb58-41d0-9879-91a4d2ecf3a3%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >>> >>> -- >>> Matt Martz >>> [email protected] >>> http://sivel.net/ >>> >> -- >> 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/fd15d63d-ba20-4db3-b48b-ae36ce01d4e9%40googlegroups.com >> <https://groups.google.com/d/msgid/ansible-project/fd15d63d-ba20-4db3-b48b-ae36ce01d4e9%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> >> > > > -- > Matt Martz > [email protected] > http://sivel.net/ > > > -- Matt Martz [email protected] http://sivel.net/ -- 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/CAD8N0v8xLJK9h_pR7WKGuzZT5S2XMvptNLW0ahYo2U7hESC19w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
