error while creaing Big IP pool ussing anisble yaml script

15 views
Skip to first unread message

santu chaitu

unread,
Nov 22, 2016, 5:14:27 PM11/22/16
to Ansible Project

I am trying to create a pool using YAML as below (Note: I tried to executed the script as root user and as non-rrot user) IN both cases i am getting two
different errors.




inventory file


webl22-p1.gain.tcprod.local ansible_ssh_host=10.30.81.30


[webservers]
webl22-p1.gain.tcprod.local


[datacenter:children]
webservers

[datacenter:vars]
ansible_ssh_user=schaitanya
ansible_ssh_pass=**********


below is roles/loadbalancer/tasks/main.yaml

---
- name: Create pool
  bigip_pool:
    
      validate_certs: false
      server: 10.30.81.30
      user: "schaitanya"
      password: "********"
      state: "present"
      name: "my-pool"
      partition: "Common"
      lb_method: "least_connection_member"
      slow_ramp_time: 120
  delegate_to: localhost




loadbalancer.yaml


---
- hosts: webservers
  sudo: yes
  gather_facts: yes
  roles:
    - loadbalancer




ansible-playbook loadbalancer.yaml

Below is my the error messages when I run it as root user

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

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

TASK [setup] *******************************************************************
Using module file /usr/lib/python2.6/site-packages/ansible-2.2.0.0-py2.6.egg/ansible/modules/core/system/setup.py
<10.30.81.30> ESTABLISH SSH CONNECTION FOR USER: schaitanya
<10.30.81.30> SSH: EXEC sshpass -d12 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o User=schaitanya -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r 10.30.81.30 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1479840370.43-195652439608771 `" && echo ansible-tmp-1479840370.43-195652439608771="` echo $HOME/.ansible/tmp/ansible-tmp-1479840370.43-195652439608771 `" ) && sleep 0'"'"''
<10.30.81.30> PUT /tmp/tmpehCACd TO /home/tcprod/schaitanya/.ansible/tmp/ansible-tmp-1479840370.43-195652439608771/setup.py
<10.30.81.30> SSH: EXEC sshpass -d12 sftp -o BatchMode=no -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o User=schaitanya -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r '[10.30.81.30]'
<10.30.81.30> ESTABLISH SSH CONNECTION FOR USER: schaitanya
<10.30.81.30> SSH: EXEC sshpass -d12 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o User=schaitanya -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r 10.30.81.30 '/bin/sh -c '"'"'chmod u+x /home/tcprod/schaitanya/.ansible/tmp/ansible-tmp-1479840370.43-195652439608771/ /home/tcprod/schaitanya/.ansible/tmp/ansible-tmp-1479840370.43-195652439608771/setup.py && sleep 0'"'"''
<10.30.81.30> ESTABLISH SSH CONNECTION FOR USER: schaitanya
<10.30.81.30> SSH: EXEC sshpass -d12 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o User=schaitanya -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r -tt 10.30.81.30 '/bin/sh -c '"'"'/usr/bin/python /home/tcprod/schaitanya/.ansible/tmp/ansible-tmp-1479840370.43-195652439608771/setup.py && sleep 0'"'"''
<10.30.81.30> ESTABLISH SSH CONNECTION FOR USER: schaitanya
<10.30.81.30> SSH: EXEC sshpass -d12 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o User=schaitanya -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r 10.30.81.30 '/bin/sh -c '"'"'rm -f -r /home/tcprod/schaitanya/.ansible/tmp/ansible-tmp-1479840370.43-195652439608771/ > /dev/null 2>&1 && sleep 0'"'"''
ok: [webl22-p1.gain.tcprod.local]

TASK [loadbalancer : Create pool] **********************************************
task path: /home/tcprod/schaitanya/exercise_7.1/roles/loadbalancer/tasks/main.yaml:2
Using module file /usr/lib/python2.6/site-packages/ansible-2.2.0.0-py2.6.egg/ansible/modules/extras/network/f5/bigip_pool.py
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1479840372.68-1035408260113 `" && echo ansible-tmp-1479840372.68-1035408260113="` echo $HOME/.ansible/tmp/ansible-tmp-1479840372.68-1035408260113 `" ) && sleep 0'
<localhost> PUT /tmp/tmpehCACd TO /root/.ansible/tmp/ansible-tmp-1479840372.68-1035408260113/bigip_pool.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1479840372.68-1035408260113/ /root/.ansible/tmp/ansible-tmp-1479840372.68-1035408260113/bigip_pool.py && sleep 0'
<localhost> EXEC /bin/sh -c 'sudo -H -S -n -u schaitanya /bin/sh -c '"'"'echo BECOME-SUCCESS-roswvllfiupzccxltwhalgahxcszlkqc; /usr/bin/python2.6 /root/.ansible/tmp/ansible-tmp-1479840372.68-1035408260113/bigip_pool.py'"'"' && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1479840372.68-1035408260113/ > /dev/null 2>&1 && sleep 0'
fatal: [webl22-p1.gain.tcprod.local -> localhost]: FAILED! => {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_name": "bigip_pool"
    },
    "module_stderr": "/usr/bin/python2.6: can't open file '/root/.ansible/tmp/ansible-tmp-1479840372.68-1035408260113/bigip_pool.py': [Errno 13] Permission denied\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE"
}
        to retry, use: --limit @/home/tcprod/schaitanya/exercise_7.1/loadbalancer.retry

PLAY RECAP *********************************************************************
webl22-p1.gain.tcprod.local : ok=1    changed=0    unreachable=0    failed=1




Below is my the error messages when I run it as non-root user


TASK [loadbalancer : Create pool] **********************************************
task path: /home/tcprod/schaitanya/exercise_7.1/roles/loadbalancer/tasks/main.yaml:2
Using module file /usr/lib/python2.6/site-packages/ansible-2.2.0.0-py2.6.egg/ansible/modules/extras/network/f5/bigip_pool.py
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: schaitanya
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1479840441.01-128200191619576 `" && echo ansible-tmp-1479840441.01-128200191619576="` echo $HOME/.ansible/tmp/ansible-tmp-1479840441.01-128200191619576 `" ) && sleep 0'
<localhost> PUT /tmp/tmpL8M8qD TO /home/tcprod/schaitanya/.ansible/tmp/ansible-tmp-1479840441.01-128200191619576/bigip_pool.py
<localhost> EXEC /bin/sh -c 'chmod u+x /home/tcprod/schaitanya/.ansible/tmp/ansible-tmp-1479840441.01-128200191619576/ /home/tcprod/schaitanya/.ansible/tmp/ansible-tmp-1479840441.01-128200191619576/bigip_pool.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python2.6 /home/tcprod/schaitanya/.ansible/tmp/ansible-tmp-1479840441.01-128200191619576/bigip_pool.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/tcprod/schaitanya/.ansible/tmp/ansible-tmp-1479840441.01-128200191619576/ > /dev/null 2>&1 && sleep 0'
fatal: [webl22-p1.gain.tcprod.local -> localhost]: FAILED! => {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_args": {
            "host": null,
            "lb_method": "least_connection_member",
            "monitor_type": null,
            "monitors": null,
            "name": "my-pool",
            "partition": "Common",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": null,
            "quorum": null,
            "reselect_tries": null,
            "server": "10.30.81.30",
            "server_port": 443,
            "service_down_action": null,
            "slow_ramp_time": 120,
            "state": "present",
            "user": "schaitanya",
            "validate_certs": false
        },
        "module_name": "bigip_pool"
    },
    "msg": "received exception: <urlopen error [Errno 111] Connection refused>"
}
        to retry, use: --limit @/home/tcprod/schaitanya/exercise_7.1/loadbalancer.retry

PLAY RECAP *********************************************************************
webl22-p1.gain.tcprod.local : ok=1    changed=0    unreachable=0    failed=1




I also tried to connect  using netconnect on port 22

nc -vz 10.30.81.30 22

and the connection goes well (Connection to 10.30.81.30 22 port [tcp/ssh] succeeded!)




Please let me know what I went wrong?

Tim

unread,
Nov 22, 2016, 5:25:20 PM11/22/16
to ansible...@googlegroups.com

For the second error, are you connecting to the bigips mgmt port? Or a self IP?

-tim


--
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+unsubscribe@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/7ff90a52-7a78-4f9d-98e5-e76f03a22d50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages