"Is there a way I can get the children of realtime_system_components and
use that within the vars_files"

Sort of.  You can see what machines are in any group:

- debug: var=item
  with_items: groups.webservers

etc







On Mon, Dec 16, 2013 at 3:57 PM, Mike Cavedon <[email protected]> wrote:

> It was explained to me by one of my co-workers that "{{ host }}" doesn't
> exist and there should probably be a failure prior to
> executing tasks/realtime_system/kill.yml.
>
> Is there a way I can get the children of realtime_system_components and
> use that within the vars_files?
>
>
> On Monday, December 16, 2013 2:24:25 PM UTC-5, Mike Cavedon wrote:
>>
>> I have the following yml file:
>>
>> # Kill RTS components
>> ---
>> - hosts: realtime_system_components
>>   user: dataxu
>>   vars_files:
>>     - vars/globals.yml
>>     - vars/realtime_system.yml
>>     - rules/realtime_system/defaults/{{ host }}.yml
>>   tasks:
>>     - include: tasks/realtime_system/kill.yml
>>
>> I have defined the child 'request_router' as part of hosts
>> realtime_system_components:
>>
>>   - name: realtime_system_components
>>     children: [request_router]
>>
>> The file rules/realtime_system/defaults/request_router.yml contains:
>>
>> ---
>> component_script: 'requestrouter.sh'
>> process_identifier: 'log4j-dxad-web.xml'
>>
>> tasks/realtime_system/kill.yml is the following:
>>
>> # Kills the RTS Component
>>
>> - name: Kill process if not stopped gracefully
>>   shell: echo process_identifier is {{ process_identifier }}
>>   ignore_errors: True
>>
>> When I echo process_identifier in tasks/realtime_system/kill.yml I get:
>>
>> TASK: [Kill process if not stopped gracefully]
>> ********************************
>> fatal: [router.releng.net] => One or more undefined variables:
>> 'process_identifier' is undefined
>>
>> Why isn't process_identifier in 
>> rules/realtime_system/defaults/request_router.yml
>> which is dynamically being defined, and found, here: "-
>> rules/realtime_system/defaults/{{ host }}.yml" making it into the task?
>>
>> Thanks.
>>
>> Mike
>>
>  --
> 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.
>



-- 
Michael DeHaan <[email protected]>
CTO, AnsibleWorks, Inc.
http://www.ansibleworks.com/

-- 
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.

Reply via email to