Skip to content

ansible-config validate says valid section is invalid #86398

@Matthew-Jenkins

Description

@Matthew-Jenkins

Summary

I get this

$ ansible-config validate 
 [ERROR]: Found unknown section 'ssh_connection' in '/path/to/project/ansible.cfg.

Here is the relavent part of the project cfg.

$ grep -A5 ssh_connection ansible.cfg 
[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60s

but if I check the docs, it is both valid and what is in the config.

$ ansible-config list -t connection |grep -A10 ssh_args
      ssh_args:
        default: -C -o ControlMaster=auto -o ControlPersist=60s
        description: Arguments to pass to all SSH CLI tools.
        env:
        - name: ANSIBLE_SSH_ARGS
        ini:
        - key: ssh_args
          section: ssh_connection
        type: string
        vars:
        - name: ansible_ssh_args
          version_added: '2.7'

If I check, ansible is using the value despite ansible-config validate saying it is not valid

$ ansible-config dump -t connection --only-changed | grep ssh_args
ssh_args(/path/to/project/ansible.cfg) = -o ControlMaster=auto -o ControlPersist=60s

Issue Type

Bug Report

Component Name

ansible-config

Ansible Version

ansible [core 2.18.12]
  config file = /path/to/project/ansible.cfg
  configured module search path = ['/home/matthewjenkins/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.14/site-packages/ansible
  ansible collection location = /home/matthewjenkins/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.14.2 (main, Dec  5 2025, 00:00:00) [GCC 15.2.1 20251111 (Red Hat 15.2.1-4)] (/usr/bin/python3)
  jinja version = 3.1.6
  libyaml = True

Configuration

ANSIBLE_PIPELINING(/path/to/project/ansible.cfg) = True
CONFIG_FILE() = /path/to/project/ansible.cfg
DEFAULT_BECOME(/path/to/project/ansible.cfg) = True
DEFAULT_BECOME_METHOD(/path/to/project/ansible.cfg) = sudo
DEFAULT_LOAD_CALLBACK_PLUGINS(/path/to/project/ansible.cfg) = True
DEFAULT_PRIVATE_KEY_FILE(/path/to/project/ansible.cfg) = /home/matthewjenkins/.ssh/id_ansible_ed25519
DEFAULT_REMOTE_USER(/path/to/project/ansible.cfg) = ansible
DEFAULT_ROLES_PATH(/path/to/project/ansible.cfg) = ['/path/to/project/roles']
DEFAULT_VAULT_PASSWORD_FILE(/path/to/project/ansible.cfg) = /path/to/project/.vault_pass
EDITOR(env: EDITOR) = vim 
HOST_KEY_CHECKING(/path/to/project/ansible.cfg) = False
INTERPRETER_PYTHON(/path/to/project/ansible.cfg) = auto_silent
RETRY_FILES_ENABLED(/path/to/project/ansible.cfg) = False

GALAXY_SERVERS:


CONNECTION:
==========

local:
_____
pipelining(/path/to/project/ansible.cfg) = True

paramiko_ssh:
____________
host_key_checking(/path/to/project/ansible.cfg) = False
private_key_file(/path/to/project/ansible.cfg) = ~/.ssh/id_ansible_ed25519
remote_user(/path/to/project/ansible.cfg) = ansible

psrp:
____
pipelining(/path/to/project/ansible.cfg) = True

ssh:
___
host_key_checking(/path/to/project/ansible.cfg) = False
pipelining(/path/to/project/ansible.cfg) = True
private_key_file(/path/to/project/ansible.cfg) = ~/.ssh/id_ansible_ed25519
remote_user(/path/to/project/ansible.cfg) = ansible
ssh_args(/path/to/project/ansible.cfg) = -o ControlMaster=auto -o ControlPersist=60s

winrm:
_____
pipelining(/path/to/project/ansible.cfg) = True

OS / Environment

Fedora release 43 (Forty Three)

Steps to Reproduce

paste

[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60s

into ansible. then run
ansible-config validate

Expected Results

Should not fail validation

Actual Results

$ ansible-config validate -vvv
ansible-config [core 2.18.12]
  config file = /path/to/project/ansible.cfg
  configured module search path = ['/home/matthewjenkins/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.14/site-packages/ansible
  ansible collection location = /home/matthewjenkins/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible-config
  python version = 3.14.2 (main, Dec  5 2025, 00:00:00) [GCC 15.2.1 20251111 (Red Hat 15.2.1-4)] (/usr/bin/python3)
  jinja version = 3.1.6
  libyaml = True
Using /path/to/project/ansible.cfg as config file
 [ERROR]: Found unknown section 'ssh_connection' in '/path/to/project/ansible.cfg.

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects_2.18bugThis issue/PR relates to a bug.has_prThis issue has an associated PR.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions