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

Regression: limit option for playbooks causes mitogen to mix connection args between hosts #902

Open
polski-g opened this issue Feb 15, 2022 · 1 comment · May be fixed by #903
Open

Regression: limit option for playbooks causes mitogen to mix connection args between hosts #902

polski-g opened this issue Feb 15, 2022 · 1 comment · May be fixed by #903
Labels
affects-0.3 Issues related to 0.3.X Mitogen releases bug Code feature that hinders desired execution outcome

Comments

@polski-g
Copy link

If you run a playbook with delegation and limit the hosts to use, the SSH connection parameters seems to be mixed together between hosts.

In case of execution run 2 (see below), you will see that the ssh arguments created by mitogen will be attempting to use those assigned for remote1 for the nagios1 host. You will see the ProxyCommand arguments in your ssh execution for nagios1. This is the bug. You should only see ProxyCommand being used for the connection to remote1

I unfortunately cannot provide exact logs; the execution environment is very isolated.

Versions

ansible 2.12.2
mitogen 0.3.2

Minimum test bed

hosts

[myhosts]
nagios1   ansible_host=10.1.1.1    ansible_port=22   ansible_user=root ansible_ssh_private_key_file=./nagios1.key
remote1   ansible_host=23.23.23.23 ansible_port=2233 ansible_user=lord ansible_ssh_private_key_file=./remote1.key ansible_ssh_common_args="-o ProxyCommand=\"nc -x 10.2.2.2:1080 -X 4 %h %p\""

playbook1.yml

---
- hosts: all
  tasks:
    - ping:
       delegate_to: nagios1
    - ping:

Run cases

_local_py=$( python -c 'import sys; print("\n".join(sys.path))' | grep site-packages | head -n1 )
export ANSIBLE_STRATEGY_PLUGINS="${_local_py}/ansible_mitogen/plugins/strategy"

# (1) this will work
export ANSIBLE_STRATEGY=linear
ansible-playbook -i hosts playbook1.yml -vvv -l remote1

# (2) this will FAIL
export ANSIBLE_STRATEGY=mitogen_linear
ansible-playbook -i hosts playbook1.yml -vvv -l remote1

@polski-g polski-g added affects-0.3 Issues related to 0.3.X Mitogen releases bug Code feature that hinders desired execution outcome labels Feb 15, 2022
@moreati
Copy link
Member

moreati commented Apr 23, 2022

Sorry for the wait. This might have been fixed in master. I see the same output with linear, and mitogen_linear.

➜  mitogen2 git:(master) ✗ venv/bin/ansible-playbook -i hosts.ini issue902.yml

PLAY [issue902]

TASK [debug]
  ansible_ssh_common_args: VARIABLE IS NOT DEFINED!
ok: [host2] => 
  ansible_ssh_common_args: -x

TASK [debug]
ok: [host1 -> host2(1.2.3.4)] => 
  ansible_ssh_common_args: -x
ok: [host2] => 
  ansible_ssh_common_args: -x

PLAY RECAP
host1                      : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
host2                      : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

➜  mitogen2 git:(master) ✗ ANSIBLE_STRATEGY_PLUGINS=ansible_mitogen/plugins/strategy ANSIBLE_STRATEGY=mitogen_linear venv/bin/ansible-playbook -i hosts.ini issue902.yml

PLAY [issue902]

TASK [debug]
ok: [host1] => 
  ansible_ssh_common_args: VARIABLE IS NOT DEFINED!
ok: [host2] => 
  ansible_ssh_common_args: -x

TASK [debug]
ok: [host1 -> host2(1.2.3.4)] => 
  ansible_ssh_common_args: -x
ok: [host2] => 
  ansible_ssh_common_args: -x

PLAY RECAP
host1                      : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
host2                      : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

➜  mitogen2 git:(master) ✗ venv/bin/ansible-playbook --version
ansible-playbook [core 2.12.4]
  config file = /Users/alex/.ansible.cfg
  configured module search path = ['/Users/alex/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/alex/src/mitogen2/venv/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/alex/.ansible/collections:/usr/share/ansible/collections
  executable location = venv/bin/ansible-playbook
  python version = 3.10.2 (main, Feb  2 2022, 05:51:25) [Clang 13.0.0 (clang-1300.0.29.3)]
  jinja version = 3.1.1
  libyaml = True

Inventory, and playbook

[issue902]
host1   ansible_host=192.168.1.105 ansible_user=alex
host2   ansible_host=1.2.3.4 ansible_user=ubuntu ansible_ssh_common_args=-x
- hosts: issue902
  gather_facts: false
  tasks:
    - debug:
        var: ansible_ssh_common_args
    - debug:
        var: ansible_ssh_common_args
      delegate_to: host2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-0.3 Issues related to 0.3.X Mitogen releases bug Code feature that hinders desired execution outcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants