Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANSIBLE_SSH_ARGS not applied to hosts created with add_host #70437

Closed
samdoran opened this issue Jul 2, 2020 · 1 comment · Fixed by #70438
Closed

ANSIBLE_SSH_ARGS not applied to hosts created with add_host #70437

samdoran opened this issue Jul 2, 2020 · 1 comment · Fixed by #70438
Labels
affects_2.11 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@samdoran
Copy link
Contributor

samdoran commented Jul 2, 2020

SUMMARY

The settings in ANSIBLE_SSH_ARGS are not applied to any host created with add_host resulting in incorrect connection to those hosts.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

lib/ansible/plugins/connection/ssh.py

ANSIBLE VERSION
ansible 2.11.0.dev0
  config file = /Users/sdoran/.ansible.cfg
  configured module search path = ['/usr/local/share/ansible/library']
  ansible python module location = /Users/sdoran/Source/ansible/lib/ansible
  ansible collection location = /Users/sdoran/.ansible/collections:/usr/local/share/ansible/collections
  executable location = /Users/sdoran/Source/ansible/bin/ansible
  python version = 3.8.2 (default, May 12 2020, 12:11:39) [Clang 11.0.3 (clang-1103.0.32.59)]

CONFIGURATION
DEFAULT_LOG_PATH(env: ANSIBLE_LOG_PATH) = /Users/sdoran/.ansible/ansible.log
DEFAULT_VAULT_PASSWORD_FILE(env: ANSIBLE_VAULT_PASSWORD_FILE) = /Users/sdoran/bin/getvaultkey.sh
DEVEL_WARNING(env: ANSIBLE_DEVEL_WARNING) = False
OS / ENVIRONMENT
STEPS TO REPRODUCE

Run the following playbook passing ANSIBLE_SSH_ARGS as an environment variable

env ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null' ansible-playbook playbook.yml -vvv
- hosts: localhost
  gather_facts: no
  tasks:
    - add_host:
        name: delegatetome
        ansible_host: 127.0.0.1

- name: Play against added host
  hosts: delegatetome
  tasks:
    - ping:
EXPECTED RESULTS

ANSIBLE_SSH_ARGS are applied to the host created with add_host and used during connection.

(output truncated)

...
PLAY [Play against added host] ****************************************************************************************

TASK [Gathering Facts] ************************************************************************************************
<127.0.0.1> SSH: EXEC ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o...
...
ACTUAL RESULTS

Missing ANSIBLE_SSH_ARGS.

...
PLAY [Play against added host] ****************************************************************************************
META: ran handlers

TASK [ping] ***********************************************************************************************************
task path: /Users/sdoran/Projects/Vagrant/Ansible Lab/test-local.yml:16
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: None
<127.0.0.1> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s...
...
@ansibot
Copy link
Contributor

ansibot commented Jul 2, 2020

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.11 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Jul 2, 2020
@sivel sivel removed the needs_triage Needs a first human triage before being processed. label Jul 6, 2020
@ansible ansible locked and limited conversation to collaborators Jul 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.11 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants