It's hard to say what you've got in there wrong without seeing your entire
playbook.




On Sat, Dec 14, 2013 at 11:43 PM, Mike Cavedon <[email protected]> wrote:

> Here is the issue reproduced. router is a child of both request_router and
> memcached_router. In order to kill request_router, "log4j-dxad-web.xml" is
> looked for in the process running on the 'router' host. In order to kill
> memcached_router, "log4j-memcached-router.xml" is looked for in the process
> running on the 'router' host.
>
> (skytap_env)-bash-4.1$ cat hosts
> [router]
> router.releng.net    ansible_ssh_host=172.24.233.2
>
>
> [router:vars]
>
>
>
> [request_router]
>
> [request_router:vars]
> process_identifier=log4j-dxad-web.xml
>
> [request_router:children]
> router
>
>
>
> [memcached_router]
>
>
> [memcached_router:vars]
> process_identifier=log4j-memcached-router.xml
>
> [memcached_router:children]
> router
>
>
>
> [matcher]
> matcher.releng.net    ansible_ssh_host=172.24.233.3
>
>
> [matcher:children]
> ad_matcher
> memcached_matcher
>
>
>
> [ad_matcher]
>
> [ad_matcher:vars]
> process_identifier=log4j-admatcher.xml
>
>
> [memcached_matcher]
>
> [memcached_matcher:vars]
> process_identifier=log4j-memcached-matcher.xml
>
>
>
> [realtime_system_components]
>
> [realtime_system_components:vars]
> rts_user=dxrts
>
>
> [realtime_system_components:children]
> request_router
> ad_matcher
> (skytap_env)-bash-4.1$
>
> (skytap_env)-bash-4.1$ cat ansible/kill.yml
> - hosts: request_router
>   user: dataxu
>   vars_files:
>     - vars/globals.yml
>     - vars/realtime_system.yml
>   tasks:
>     - include: tasks/realtime_system/kill.yml
>
> - hosts: memcached_router
>   user: dataxu
>   vars_files:
>     - vars/globals.yml
>     - vars/realtime_system.yml
>   tasks:
>     - include: tasks/realtime_system/kill.yml
> (skytap_env)-bash-4.1$
>
>
> (skytap_env)-bash-4.1$ cat ansible/tasks/realtime_system/kill.yml
> - name: Kill process if not stopped gracefully
>   shell: pgrep -f {{ process_identifier }} && (echo "Killing"; pkill -9 -f
> {{ process_identifier }});
>   ignore_errors: True
>
>
> In the following, the second pgrep/kill command should be looking for
> log4j-memcached-router.xml
>
> (skytap_env)-bash-4.1$ ansible-playbook -v -i hosts ansible/kill.yml
>
> PLAY [request_router]
> *********************************************************
>
> GATHERING FACTS
> ***************************************************************
> ok: [router.releng.net]
>
> TASK: [Kill process if not stopped gracefully]
> ********************************
> failed: [router.releng.net] => {"changed": true, "cmd": "pgrep -f*
> log4j-dxad-web.xml* && (echo \"Killing\"; pkill -9 -f *log4j-dxad-web.xml*);
> ", "delta": "0:00:00.035682", "end": "2013-12-14 23:32:22.911873", "item":
> "", "rc": -9, "start": "2013-12-14 23:32:22.876191"}
> stdout: 26041
> Killing
> ...ignoring
>
> PLAY [memcached_router]
> *******************************************************
>
> TASK: [Kill process if not stopped gracefully]
> ********************************
> failed: [router.releng.net] => {"changed": true, "cmd": "pgrep -f
> *log4j-dxad-web.xml* && (echo \"Killing\"; pkill -9 -f
> *log4j-dxad-web.xml*); ", "delta": "0:00:00.030875", "end": "2013-12-14
> 23:32:28.376401", "item": "", "rc": -9, "start": "2013-12-14
> 23:32:28.345526"}
> stdout: 26074
> Killing
> ...ignoring
>
> PLAY RECAP
> ********************************************************************
> router.releng.net          : ok=3    changed=2    unreachable=0
>  failed=0
>
>
> If in the hosts file, I delete everything having to do
> with realtime_system_components (see first "cat hosts" above) which
> shouldn't have anything to do with the kill commands, the opposite log4j
> xml file is looked for both times.
>
> (skytap_env)-bash-4.1$ cat hosts
> [router]
> router.releng.net    ansible_ssh_host=172.24.233.2
>
>
> [router:vars]
>
>
>
> [request_router]
>
> [request_router:vars]
> process_identifier=log4j-dxad-web.xml
>
> [request_router:children]
> router
>
>
>
> [memcached_router]
>
>
> [memcached_router:vars]
> process_identifier=log4j-memcached-router.xml
>
> [memcached_router:children]
> router
>
>
>
> [matcher]
> matcher.releng.net    ansible_ssh_host=172.24.233.3
>
>
> [matcher:children]
> ad_matcher
> memcached_matcher
>
>
>
> [ad_matcher]
>
> [ad_matcher:vars]
> process_identifier=log4j-admatcher.xml
>
>
> [memcached_matcher]
>
> [memcached_matcher:vars]
> process_identifier=log4j-memcached-matcher.xml
>
>
> (skytap_env)-bash-4.1$ ansible-playbook -v -i hosts ansible/kill.yml
>
> PLAY [request_router]
> *********************************************************
>
> GATHERING FACTS
> ***************************************************************
> ok: [router.releng.net]
>
> TASK: [Kill process if not stopped gracefully]
> ********************************
> failed: [router.releng.net] => {"changed": true, "cmd": "pgrep -f 
> *log4j-memcached-router.xml
> *&& (echo \"Killing\"; pkill -9 -f log4j-memcached-router.xml); ",
> "delta": "0:00:00.036037", "end": "2013-12-14 23:35:58.908763", "item": "",
> "rc": -9, "start": "2013-12-14 23:35:58.872726"}
> stdout: 26152
> Killing
> ...ignoring
>
> PLAY [memcached_router]
> *******************************************************
>
> TASK: [Kill process if not stopped gracefully]
> ********************************
> failed: [router.releng.net] => {"changed": true, "cmd": "pgrep -f 
> *log4j-memcached-router.xml
> *&& (echo \"Killing\"; pkill -9 -f log4j-memcached-router.xml); ",
> "delta": "0:00:00.026807", "end": "2013-12-14 23:36:04.260145", "item": "",
> "rc": -9, "start": "2013-12-14 23:36:04.233338"}
> stdout: 26185
> Killing
> ...ignoring
>
> PLAY RECAP
> ********************************************************************
> router.releng.net          : ok=3    changed=2    unreachable=0
>  failed=0
>
> Mike
>
> On Saturday, December 14, 2013 4:34:11 PM UTC-5, Michael DeHaan wrote:
>
>> So I am having trouble what children means here, this is not a playbook
>> keyword and the system will yell about that .. So a little confused.
>>
>> -- Michael
>>
>> On Dec 14, 2013, at 4:30 PM, Mike Cavedon <[email protected]> wrote:
>>
>> I have the following:
>>
>>   - name: router
>>   - name: request_router
>>     children: [router]
>>     vars:
>>       component_script: 'requestrouter.sh'
>>       process_identifier: 'log4j-dxad-web.xml'
>>   - name: memcached_router
>>     children: [router]
>>     vars:
>>       component_script: 'memcached-router.sh'
>>       process_identifier: 'log4j-memcached-router.xml'
>>
>> When the following executes component_script equals requestrouter.sh when
>> it should equal memcached-router.sh.
>>
>> - hosts: memcached_router
>>   user: root
>>   vars_files:
>>     - vars/globals.yml
>>   tasks:
>>      - include: task-to-execute.yml.
>>
>> How do I get component_script to be set as memcached-router.sh when using
>> hosts: memcached_router?
>>
>>  --
>> 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.
>>
>>  --
> 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