Skip to content

Defaults hostblock ignored when non-default hostblock is used #92

@skwde

Description

@skwde

The defaults host block is ignored when another host block is given.

Here is a playbook to reproduce the issue:

- name: Test
  hosts: rhel7
  gather_facts: false
  tasks:
    - name: Handle ssh_config for RHEL7
      ansible.builtin.import_role:
        name: fedora.linux_system_roles.ssh
      vars:
        ssh_config_file: '~/src/tests/ssh_config_test'
        ssh_skip_defaults: false
        ssh:
          Host:
            - Condition: '*.abc'
              PubkeyAuthentication: 'yes'

The output is the following:

#
# Ansible managed
#
# system_role:ssh

Host *.abc
  PubkeyAuthentication yes

while I would expect also the defaults to appear next to what I specify

#
# Ansible managed
#
# system_role:ssh

Host *
  ForwardX11Trusted yes
  GSSAPIAuthentication yes
  SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
  SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
  SendEnv LC_IDENTIFICATION LC_ALL LANGUAGE
  SendEnv XMODIFIERS
Host *.abc
  PubkeyAuthentication yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions