ansible_mitogen: Support ANSIBLE_SSH_VERBOSITY with Ansible >= 12
In vanilla Ansible >= 12 (ansible-core 2.19) - ssh connection plugin `verbosity` controls `ssh [-v[v[v]]]` - config option `DEFAULT_VERBOSITY` controls whether that output is displayed In vanilla Ansible <= 11 (ansible-core <= 2.18) - `DEFAULT_VERBOSITY` controls both `ssh` verbosity & display verbositty As of this change - Mitogen + Ansible >= 12 behaviour matches vanilla Ansible >= 12. - Mitogen + Ansible <= 11 behaviour remains unchanged - `DEFAULT_VERBOSITY` only controls display verbosity. - Mitogen + Ansible respect the Ansible variable `mitogen_ssh_debug_level` I've chosen not to retroactively replicate the old vanilla Ansible behaviour in Mitogen + Ansible <= 11 cases. I'm pretty sure it was an oversight, rather than a design choice, but Ansible+Mitogen with `ANSIBLE_VERBOSITY=3` is already very verbose. fixes #1282 See - https://docs.ansible.com/ansible/latest/reference_appendices/config.html#default-verbosity - https://docs.ansible.com/ansible/devel/collections/ansible/builtin/ssh_connection.html#parameter-verbositypull/1294/head
parent
4dc286371f
commit
c1296b5d75
@ -0,0 +1,41 @@
|
|||||||
|
# Ansible >= 12 (ansible-core >= 2.19) adds SSH connection `verbosity` property.
|
||||||
|
# Ansible <= 11 (ansible-core <= 2.18) applies ANSIBLE_VERBOSITY -> ssh.
|
||||||
|
|
||||||
|
- name: integration/ssh/verbosity.yml
|
||||||
|
hosts: test-targets
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- meta: end_play
|
||||||
|
when:
|
||||||
|
- ansible_version_major_minor is version('2.19', '<', strict=True)
|
||||||
|
|
||||||
|
- name: Exercise ssh verbosity
|
||||||
|
connection: local
|
||||||
|
environment:
|
||||||
|
ANSIBLE_CALLBACK_RESULT_FORMAT: json
|
||||||
|
ANSIBLE_LOAD_CALLBACK_PLUGINS: "false"
|
||||||
|
ANSIBLE_SSH_VERBOSITY: 3
|
||||||
|
ANSIBLE_STRATEGY: "{{ lookup('env', 'ANSIBLE_STRATEGY') | mandatory }}"
|
||||||
|
ANSIBLE_VERBOSITY: 3
|
||||||
|
vars:
|
||||||
|
ansible_python_interpreter: "{{ ansible_playbook_python }}"
|
||||||
|
command:
|
||||||
|
cmd:
|
||||||
|
ansible
|
||||||
|
{% for inv in ansible_inventory_sources %}
|
||||||
|
-i "{{ inv }}"
|
||||||
|
{% endfor %}
|
||||||
|
"{{ inventory_hostname }}"
|
||||||
|
-m ping
|
||||||
|
chdir: ../..
|
||||||
|
register: out
|
||||||
|
changed_when: false
|
||||||
|
check_mode: false
|
||||||
|
|
||||||
|
- name: Verify ssh -vvv output is included
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- >-
|
||||||
|
out.stdout is search('debug1: Reading configuration data')
|
||||||
|
fail_msg: |
|
||||||
|
out={{ out }}
|
||||||
Loading…
Reference in New Issue