Hi all,

I am stuck with below strange issue that ansible halts or goes into sleep 
mode when  trying to start jboss as a root user using ansible on redhat 
machine1

Accordingly below are the details of the scripts that are on redhat machine1


*ansible.cfg*


[defaults]

host_key_checking = False
hostfile = inventory
deprecation_warnings = False
[privilege_escalation]
become = yes
become_user = root
become_method = sudo

*Inventory file*



host1  ansible_ssh_host=11.21.34.124

[webservers]
host1

[datacenter:children]
webservers


[datacenter:vars]
ansible_ssh_user=root
ansible_ssh_pass=password




*/roles/webserver/tasks/main.yaml*

---
- name: start jboss server
  remote_user: root
  command: sh /home/tcprod/schaitanya/first.sh


*webserver.yaml*

---
- hosts: webservers
  gather_facts: yes
  roles:
    - webserver


I used below command to execute

*ansible-playbook webserver.yaml*


On the remote machine(machine2) which is controlled by anisible I have 
below script in /home/xyz/user1/first.sh






*Below is the first.sh file for  scenario1*

#!/bin/bash
# My first script


/usr/jboss/bin/run.sh -c production -b 0.0.0.0


*output error message from ansible for secenario1*

Loading callback plugin default of type stdout, v2.0 from 
/usr/local/lib/python2.6/site-packages/ansible/plugins/callback/__init__.pyc

PLAYBOOK: webserver.yaml 
*******************************************************
1 plays in webserver.yaml

PLAY [webservers] 
**************************************************************

TASK [setup] 
*******************************************************************
Using module file 
/usr/local/lib/python2.6/site-packages/ansible/modules/core/system/setup.py
<10.30.24.154> ESTABLISH CONNECTION FOR USER: root on PORT 22 TO 
10.30.24.154
<10.30.24.154> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo 
$HOME/.ansible/tmp/ansible-tmp-1479929575.09-34276517590295 `" && echo 
ansible-tmp-1479929575.09-

34276517590295="` echo 
$HOME/.ansible/tmp/ansible-tmp-1479929575.09-34276517590295 `" ) && sleep 0'
<10.30.24.154> PUT /tmp/tmpeCDcCo TO 
/root/.ansible/tmp/ansible-tmp-1479929575.09-34276517590295/setup.py
<10.30.24.154> EXEC /bin/sh -c 'chmod u+x 
/root/.ansible/tmp/ansible-tmp-1479929575.09-34276517590295/ 
/root/.ansible/tmp/ansible-tmp-1479929575.09-

34276517590295/setup.py && sleep 0'
<10.30.24.154> EXEC /bin/sh -c '/usr/bin/python 
/root/.ansible/tmp/ansible-tmp-1479929575.09-34276517590295/setup.py; rm 
-rf "/root/.ansible/tmp/ansible-tmp-

1479929575.09-34276517590295/" > /dev/null 2>&1 && sleep 0'
ok: [apil21.gain.tcprod.local]

TASK [webserver : start jboss server] 
******************************************
task path: 
/home/tcprod/schaitanya/ansible_scripts/roles/webserver/tasks/main.yaml:5
Using module file 
/usr/local/lib/python2.6/site-packages/ansible/modules/core/commands/command.py
<10.30.24.154> ESTABLISH CONNECTION FOR USER: root on PORT 22 TO 
10.30.24.154
<10.30.24.154> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo 
$HOME/.ansible/tmp/ansible-tmp-1479929577.4-187865963670831 `" && echo 
ansible-tmp-1479929577.4-

187865963670831="` echo 
$HOME/.ansible/tmp/ansible-tmp-1479929577.4-187865963670831 `" ) && sleep 0'
<10.30.24.154> PUT /tmp/tmpeCDcCo TO 
/root/.ansible/tmp/ansible-tmp-1479929577.4-187865963670831/command.py
<10.30.24.154> EXEC /bin/sh -c 'chmod u+x 
/root/.ansible/tmp/ansible-tmp-1479929577.4-187865963670831/ 
/root/.ansible/tmp/ansible-tmp-1479929577.4-

187865963670831/command.py && sleep 0'
<10.30.24.154> EXEC /bin/sh -c '/usr/bin/python 
/root/.ansible/tmp/ansible-tmp-1479929577.4-187865963670831/command.py; rm 
-rf "/root/.ansible/tmp/ansible-tmp-

1479929577.4-187865963670831/" > /dev/null 2>&1 && sleep 0'







Below is the first.sh file for  scenario2 it executes perfectly and returns 
the output line (please refer below output)

#!/bin/bash
# My first script
echo "I am able to run as root user"







output message from ansible for secenario2

Loading callback plugin default of type stdout, v2.0 from 
/usr/local/lib/python2.6/site-packages/ansible/plugins/callback/__init__.pyc

PLAYBOOK: webserver.yaml 
*******************************************************
1 plays in webserver.yaml

PLAY [webservers] 
**************************************************************

TASK [setup] 
*******************************************************************
Using module file 
/usr/local/lib/python2.6/site-packages/ansible/modules/core/system/setup.py
<10.30.24.154> ESTABLISH CONNECTION FOR USER: root on PORT 22 TO 
10.30.24.154
<10.30.24.154> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo 
$HOME/.ansible/tmp/ansible-tmp-1479929622.23-106797790299177 `" && echo 
ansible-tmp-1479929622.23-

106797790299177="` echo 
$HOME/.ansible/tmp/ansible-tmp-1479929622.23-106797790299177 `" ) && sleep 
0'
<10.30.24.154> PUT /tmp/tmph1DN7W TO 
/root/.ansible/tmp/ansible-tmp-1479929622.23-106797790299177/setup.py
<10.30.24.154> EXEC /bin/sh -c 'chmod u+x 
/root/.ansible/tmp/ansible-tmp-1479929622.23-106797790299177/ 
/root/.ansible/tmp/ansible-tmp-1479929622.23-

106797790299177/setup.py && sleep 0'
<10.30.24.154> EXEC /bin/sh -c '/usr/bin/python 
/root/.ansible/tmp/ansible-tmp-1479929622.23-106797790299177/setup.py; rm 
-rf "/root/.ansible/tmp/ansible-tmp-

1479929622.23-106797790299177/" > /dev/null 2>&1 && sleep 0'
ok: [apil21.gain.tcprod.local]

TASK [webserver : start jboss server] 
******************************************
task path: 
/home/tcprod/schaitanya/ansible_scripts/roles/webserver/tasks/main.yaml:5
Using module file 
/usr/local/lib/python2.6/site-packages/ansible/modules/core/commands/command.py
<10.30.24.154> ESTABLISH CONNECTION FOR USER: root on PORT 22 TO 
10.30.24.154
<10.30.24.154> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo 
$HOME/.ansible/tmp/ansible-tmp-1479929624.42-73371273912103 `" && echo 
ansible-tmp-1479929624.42-

73371273912103="` echo 
$HOME/.ansible/tmp/ansible-tmp-1479929624.42-73371273912103 `" ) && sleep 0'
<10.30.24.154> PUT /tmp/tmph1DN7W TO 
/root/.ansible/tmp/ansible-tmp-1479929624.42-73371273912103/command.py
<10.30.24.154> EXEC /bin/sh -c 'chmod u+x 
/root/.ansible/tmp/ansible-tmp-1479929624.42-73371273912103/ 
/root/.ansible/tmp/ansible-tmp-1479929624.42-

73371273912103/command.py && sleep 0'
<10.30.24.154> EXEC /bin/sh -c '/usr/bin/python 
/root/.ansible/tmp/ansible-tmp-1479929624.42-73371273912103/command.py; rm 
-rf "/root/.ansible/tmp/ansible-tmp-

1479929624.42-73371273912103/" > /dev/null 2>&1 && sleep 0'

changed: [apil21.gain.tcprod.local] => {
    "changed": true,
    "cmd": [
        "sh",
        "/home/tcprod/schaitanya/first.sh"
    ],
    "delta": "0:00:00.003245",
    "end": "2016-11-23 13:33:46.108980",
    "invocation": {
        "module_args": {
            "_raw_params": "sh /home/tcprod/schaitanya/first.sh",
            "_uses_shell": false,
            "chdir": null,
            "creates": null,
            "executable": null,
            "removes": null,
            "warn": true
        },
        "module_name": "command"
    },
    "rc": 0,
    "start": "2016-11-23 13:33:46.105735",
    "stderr": "",
    "stdout": "I am able to run as root user",
    "stdout_lines": [
        "I am able to run as root user"
    ],
    "warnings": []
}

PLAY RECAP 
*********************************************************************
apil21.gain.tcprod.local   : ok=2    changed=1    unreachable=0    failed=0





Please provide me with some pointers/help in regards to this issue

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a785a3a1-2f57-46ae-b2dc-a47f208bc029%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to