简体   繁体   中英

Ansible in Jenkins Ansible plugin, ignores SSH config

I'm struggling with an issue regarding SSH control paths in ansible when running with Jenkins using the ansible plugin. The issue is manifested when using long FQDNS for hosts in the inventory.

I've tried the following:

  • setting up short host names and control paths in the Jenkins user's SSH config file

  • setting SSH args in /etc/ansible/ansible.cfg setting, eg:

     [ssh_connection] ssh_args="-F /var/jenkins_home/.ssh/config -o ControlMaster=auto -o ControlPersist=30m -o ConnectTimeout=60 -o ControlPath=/tmp/ssh-%C" control_path="/tmp/ssh-%C" 
  • command line option --ssh-extra-args= in the Jenkins plugin dialogue

I can't seem to convince Ansible to use a short control path, like the following:

" /tmp/ssh-%C" 

I still get:

/var/jenkins_home/.ansible/cp/ansible-ssh-bastion-dev.westeurope.cloudapp.azure.com-22-jenkins.ivQ6vi6TPB3BrYta\\" too long for Unix domain socket

which does not correspond to the option I'm setting everywhere.

Anyone know how to convince the Ansible plugin to stop ignoring the SSH options?

Works fine for me with Ansible 2.2.1.0 and Jenkins ver. 2.32.1 Jenkins ver. 2.32.1 .

$ cat /etc/ansible/ansible.cfg
[ssh_connection]
control_path = /tmp/ssh-%%C

Note double percent sign in %%C (otherwise Ansible can't format it).

I'd recommend you to check build node (if you have jenkins slaves, you may change settings on master, but job executes on one of slaves) and run playbook with -vvvv additional flags to see what configuration files ansible uses.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM