[ansible-project] per-host proxy setting

2018-01-23 Thread Sureshkumar Kaliannan
Hi,

Can https_proxy be set on a per-host basis for e.g,

[nodes]
NFL-00053.abc.com ansible_ssh_port=16385 ansible_ssh_host=localhost 
https_proxy=http://192.168.101.1:3128

This doesn't seem to work. 

The https_proxy looks like needs to be setup as an environment variable in 
a playbook.

  environment:
https_proxy: "{{ https_proxy }}"

But then this would apply to all hosts...

Can environment section be generated per-host from the inventory script?

I'm using ansible 2.3

thanks a lot for any guidance
Suresh

-- 
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/6500cecf-e538-45e0-8e03-2c847ac3b6d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ansible with forks > 1 doesn't work using ansible_ssh_host/ansible_ssh_port

2017-07-26 Thread Sureshkumar Kaliannan
Hi,

We are tunneling ssh through websocket..so the inventory looks something 
like this..

[nodes]
host1  ansible_ssh_host=localhost ansible_ssh_port=26532 
host2  ansible_ssh_host=localhost ansible_ssh_port=

[admin@nsm-dev2-suresh ~]$ ansible -vv -m ping nodes
Using /etc/ansible/ansible.cfg as config file
META: ran handlers
host2 | SUCCESS => {
"changed": false, 
"ping": "pong"
}
host1 | UNREACHABLE! => {
"changed": false, 
"msg": "Failed to connect to the host via ssh: Connection timed out 
during banner exchange\r\n", 
"unreachable": true
}
META: ran handlers
META: ran handlers

Manual ssh always works..and also keeping the fork=1 always works.


Always, the firsthost works fine and subsequent hosts fail. 
When the same command is tried again, firsthost uses the persistent 
connection and goes through and the second host establishes the new session 
and all subsequent hosts will fail. 
And the next try, first two hosts which uses persistent connection works 
fine, 3rd establishes new ssh session, and all subsequent hosts will fail.


So if I disable persistent connection by removing ControlPersist=, always 
only the firsthost works, and all subsequent hosts fail.

I tried increasing the timeout but that doesn't help.

Not sure where to start the debugging..- option all i get is, 

host1 | UNREACHABLE! => {
"changed": false, 
"msg": "Failed to connect to the host via ssh: OpenSSH_6.6.1, OpenSSL 
1.0.1e-fips 11 Feb 2013\r\ndebug1: Reading configuration data 
/etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 56: Applying 
options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: 
Control socket \"/home/admin/.ansible/cp/b9ebd9b1c9\" does not 
exist\r\ndebug2: ssh_connect: needpriv 0\r\ndebug1: Connecting to localhost 
[127.0.0.1] port 26532.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: fd 3 
clearing O_NONBLOCK\r\ndebug1: Connection established.\r\ndebug3: timeout: 
1 ms remain after connect\r\ndebug3: Incorrect RSA1 
identifier\r\ndebug3: Could not load \"/home/admin/.ssh/id_rsa\" as a RSA1 
public key\r\ndebug1: identity file /home/admin/.ssh/id_rsa type 
1\r\ndebug1: identity file /home/admin/.ssh/id_rsa-cert type -1\r\ndebug1: 
identity file /home/admin/.ssh/id_dsa type -1\r\ndebug1: identity file 
/home/admin/.ssh/id_dsa-cert type -1\r\ndebug1: identity file 
/home/admin/.ssh/id_ecdsa type -1\r\ndebug1: identity file 
/home/admin/.ssh/id_ecdsa-cert type -1\r\ndebug1: identity file 
/home/admin/.ssh/id_ed25519 type -1\r\ndebug1: identity file 
/home/admin/.ssh/id_ed25519-cert type -1\r\ndebug1: Enabling compatibility 
mode for protocol 2.0\r\ndebug1: Local version string 
SSH-2.0-OpenSSH_6.6.1\r\nConnection 
timed out during banner exchange\r\n", 
"unreachable": true
}

All are CentOS 7.3 hosts, with ansible 2.3.1.0 (even the earlier 2.2 
version has the same problem)

Any pointers to debug this problem ??

thanks
Suresh

-- 
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/c1a0e383-803b-4667-b9cf-5a85855b8099%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.