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_port variable is not evaluated #978

Closed
anxstj opened this issue Dec 15, 2022 · 2 comments · Fixed by #1145
Closed

ansible_port variable is not evaluated #978

anxstj opened this issue Dec 15, 2022 · 2 comments · Fixed by #1145
Labels
affects-0.3 Issues related to 0.3.X Mitogen releases bug Code feature that hinders desired execution outcome

Comments

@anxstj
Copy link

anxstj commented Dec 15, 2022

I pass a nested variable to Ansible to determine the connection port in a dynamic way. This has worked with Ansible-core 2.11 and mitogen and Ansible-core 2.13 without mitogen, but it doesn't work with Ansible-core 2.13 and mitogen.

  • Which version of Ansible are you running?
ansible [core 2.13.7]
  config file = /home/user/.ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/devenv-6/lib/python3.11/site-packages/ansible
  ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/devenv-6/bin/ansible
  python version = 3.11.0 (main, Oct 24 2022, 00:00:00) [GCC 12.2.1 20220819 (Red Hat 12.2.1-2)]
  jinja version = 3.0.3
  libyaml = False
  • Is your version of Ansible patched in any way?: No
  • Are you running with any custom modules, or module_utils loaded? No
  • Have you tried the latest master version from Git? Yes
  • Mention your host and target OS and versions: Host: Fedora 37; Target: Debian 11
  • Mention your host and target Python versions: see above

Playbook to reproduce the issue:

---
- hosts: all
  strategy: mitogen_linear

  vars:
    other_port: 22
    ansible_port: "{{ other_port }}"   # didn't work either: "{{ '22' }}"
  tasks:
    - debug: var=ansible_port

Command to reproduce the issue:

ansible-playbook -i myhost, playbook.yml

Actual output:

TASK [Gathering Facts] **********************************************************
[WARNING]: Unhandled error in Python interpreter discovery for host myhost: EOF on stream; last 100 lines received: Bad port '{{
other_port }}'
fatal: [myhost]: UNREACHABLE! => {"changed": false, "msg": "EOF on stream; last 100 lines received:\nBad port '{{ other_port }}'", "unreachable": true}

Expected output (as with strategy=linear):

TASK [Gathering Facts] *****************************************************************************
ok: [myhost]

TASK [debug] *************************************************************************************
ok: [myhost] => {
    "ansible_port": "22"
}
@anxstj anxstj added affects-0.3 Issues related to 0.3.X Mitogen releases bug Code feature that hinders desired execution outcome labels Dec 15, 2022
@sebhoss
Copy link

sebhoss commented Aug 7, 2023

I can confirm that this is happening with Mitogen commit 88f15a8 (current master)

@mrmeyers99
Copy link

I can confirm I see the same issue. It works fine with 2.12.10 and mitogen 0.3.4 and 2.13.13 without mitogen, but not 2.13.13 and mitogen 0.3.4, despite the docs saying that 0.3.4 supports 2.13.

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.

3 participants