Hello. Please advise me in the next problem. Environment:
Ansible host: CentOS 6.5 x86_64. Rpm package ansible 1.6.6.
I created a task to disable ipv6 on target host. Let's name this host: myhost. I created task file: disable-ipv6.yml. Contents:
=============================================================================
- hosts: myhost
roles:
- disable_ipv6
tags: disable_ipv6
=============================================================================
The hosts file contains [myhost] section with real host named myhost (DNS).
The roles/disable_ipv6/tasks/main.yml file contains:
=============================================================================
- name: disable ipv6
lineinfile: dest=/etc/sysctl.conf line="net.ipv6.conf.all.disable_ipv6 = 1"
- name: apply changes
shell: /sbin/sysctl -p /etc/sysctl.conf
=============================================================================
To login on myhost machine through ssh we using Win domain authentication, then executes administrative tasks under su if needed.
In this regard, I run playbook as:
ansible-playbook -vvvv -u my_domain_user --su --ask-su-pass -i hosts disable_ipv6.yml
Output looks like this:
SSH password: (entered domain user pass)
su password: (entered root pass)
PLAY [myhost] ***********************************************************
GATHERING FACTS ***************************************************************
<myhost> ESTABLISH CONNECTION FOR USER: my_domain_user on PORT 22 TO myhost
<myhost> REMOTE_MODULE setup
<myhost> EXEC /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1407992741.19-43707358624763 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1407992741.19-43707358624763 && echo $HOME/.ansible/tmp/ansible-tmp-1407992741.19-43707358624763'
<myhost> PUT /tmp/tmpIVoNRB TO /home/my_domain_user/.ansible/tmp/ansible-tmp-1407992741.19-43707358624763/setup
<myhost> EXEC /bin/sh -c 'su root /bin/sh -c '"'"'echo SUDO-SUCCESS-ixgpflqewxawyzdmzpegednnarlplthu; LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 /usr/bin/python /home/my_domain_user/.ansible/tmp/ansible-tmp-1407992741.19-43707358624763/setup; rm -rf /home/my_domain_user/.ansible/tmp/ansible-tmp-1407992741.19-43707358624763/ >/dev/null 2>&1'"'"''
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C
And then this process totally hangs. Ctrl-C not working, looks above. I typing right passwords! This works with manually establishing ssh connection under my_domain_user, then typing su and becoming root.
What I tried to resolve the problem:
1. Login to myhost under my_domain_user and execute last command from ansible debug output.
/bin/sh -c 'su root /bin/sh -c '"'"'echo SUDO-SUCCESS-ixgpflqewxawyzdmzpegednnarlplthu; LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 /usr/bin/python /home/my_domain_user/.ansible/tmp/ansible-tmp-1407992741.19-43707358624763/setup; rm -rf /home/my_domain_user/.ansible/tmp/ansible-tmp-1407992741.19-43707358624763/ >/dev/null 2>&1'"'"''
Enter root password on request and all works, had ansible python script output on the console.
2. Compiled latest openssh 6.6 and install it instead of default openssh 5.3 on the host myhost.
3. Disable iptables, selinux on myhost.
IMPORTANT:
This problem occurs on some hosts, not at all. I changed myhost to another host (we had 30+ linux servers in our network) and task run OK. But as I said, on several hosts this hangs on setup stage. All hosts setup the same regarding ssh authentication: first stage is domain authentication, then su to root.
Please advise, how to resolve this strange problem. Thanks!