mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
ssh_config: Add AddressFamily (#11968)
* Add support for AddressFamily parameter in ssh_config. * Added changelog fragment. * Update changelog fragment with PR link placeholder * Fixed formatting. * Fixed format of changelog fragment. * Add PR number to changelog fragment. * Incorporated review findings. * Typo fix. Co-authored-by: Felix Fontein <felix@fontein.de> * Limit to allowed values. --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
minor_changes:
|
||||||
|
- "ssh_config - add support for the ``AddressFamily`` option (https://github.com/ansible-collections/community.general/pull/11968)."
|
||||||
@@ -143,6 +143,12 @@ options:
|
|||||||
- The values must be strings. Other values are rejected.
|
- The values must be strings. Other values are rejected.
|
||||||
type: dict
|
type: dict
|
||||||
version_added: 10.4.0
|
version_added: 10.4.0
|
||||||
|
address_family:
|
||||||
|
description:
|
||||||
|
- Sets the C(AddressFamily) option.
|
||||||
|
choices: ['any', 'inet', 'inet6']
|
||||||
|
type: str
|
||||||
|
version_added: 13.0.0
|
||||||
requirements:
|
requirements:
|
||||||
- paramiko
|
- paramiko
|
||||||
"""
|
"""
|
||||||
@@ -296,6 +302,7 @@ class SSHConfig:
|
|||||||
controlpath=self.params.get("controlpath"),
|
controlpath=self.params.get("controlpath"),
|
||||||
controlpersist=fix_bool_str(self.params.get("controlpersist")),
|
controlpersist=fix_bool_str(self.params.get("controlpersist")),
|
||||||
dynamicforward=self.params.get("dynamicforward"),
|
dynamicforward=self.params.get("dynamicforward"),
|
||||||
|
address_family=self.params.get("address_family"),
|
||||||
)
|
)
|
||||||
if self.params.get("other_options"):
|
if self.params.get("other_options"):
|
||||||
for key, value in self.params.get("other_options").items():
|
for key, value in self.params.get("other_options").items():
|
||||||
@@ -415,6 +422,7 @@ def main():
|
|||||||
dynamicforward=dict(type="str"),
|
dynamicforward=dict(type="str"),
|
||||||
user=dict(type="str"),
|
user=dict(type="str"),
|
||||||
user_known_hosts_file=dict(type="str"),
|
user_known_hosts_file=dict(type="str"),
|
||||||
|
address_family=dict(type="str", choices=["any", "inet", "inet6"]),
|
||||||
),
|
),
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
mutually_exclusive=[
|
mutually_exclusive=[
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
dynamicforward: '10080'
|
dynamicforward: '10080'
|
||||||
other_options:
|
other_options:
|
||||||
serveraliveinterval: '30'
|
serveraliveinterval: '30'
|
||||||
|
address_family: "inet"
|
||||||
state: present
|
state: present
|
||||||
register: options_add
|
register: options_add
|
||||||
check_mode: true
|
check_mode: true
|
||||||
@@ -61,6 +62,7 @@
|
|||||||
dynamicforward: '10080'
|
dynamicforward: '10080'
|
||||||
other_options:
|
other_options:
|
||||||
serveraliveinterval: '30'
|
serveraliveinterval: '30'
|
||||||
|
address_family: "inet"
|
||||||
state: present
|
state: present
|
||||||
register: options_add
|
register: options_add
|
||||||
|
|
||||||
@@ -87,6 +89,7 @@
|
|||||||
dynamicforward: '10080'
|
dynamicforward: '10080'
|
||||||
other_options:
|
other_options:
|
||||||
serveraliveinterval: '30'
|
serveraliveinterval: '30'
|
||||||
|
address_family: "inet"
|
||||||
state: present
|
state: present
|
||||||
register: options_add_again
|
register: options_add_again
|
||||||
|
|
||||||
@@ -116,6 +119,7 @@
|
|||||||
- "'controlpersist yes' in slurp_ssh_config['content'] | b64decode"
|
- "'controlpersist yes' in slurp_ssh_config['content'] | b64decode"
|
||||||
- "'dynamicforward 10080' in slurp_ssh_config['content'] | b64decode"
|
- "'dynamicforward 10080' in slurp_ssh_config['content'] | b64decode"
|
||||||
- "'serveraliveinterval 30' in slurp_ssh_config['content'] | b64decode"
|
- "'serveraliveinterval 30' in slurp_ssh_config['content'] | b64decode"
|
||||||
|
- "'addressfamily inet' in slurp_ssh_config['content'] | b64decode"
|
||||||
|
|
||||||
- name: Options - Update host
|
- name: Options - Update host
|
||||||
community.general.ssh_config:
|
community.general.ssh_config:
|
||||||
@@ -132,6 +136,7 @@
|
|||||||
dynamicforward: '11080'
|
dynamicforward: '11080'
|
||||||
other_options:
|
other_options:
|
||||||
serveraliveinterval: '30'
|
serveraliveinterval: '30'
|
||||||
|
address_family: "inet6"
|
||||||
state: present
|
state: present
|
||||||
register: options_update
|
register: options_update
|
||||||
|
|
||||||
@@ -160,6 +165,7 @@
|
|||||||
dynamicforward: '11080'
|
dynamicforward: '11080'
|
||||||
other_options:
|
other_options:
|
||||||
serveraliveinterval: '30'
|
serveraliveinterval: '30'
|
||||||
|
address_family: "inet6"
|
||||||
state: present
|
state: present
|
||||||
register: options_update
|
register: options_update
|
||||||
|
|
||||||
@@ -190,6 +196,7 @@
|
|||||||
- "'controlpersist 600' in slurp_ssh_config['content'] | b64decode"
|
- "'controlpersist 600' in slurp_ssh_config['content'] | b64decode"
|
||||||
- "'dynamicforward 11080' in slurp_ssh_config['content'] | b64decode"
|
- "'dynamicforward 11080' in slurp_ssh_config['content'] | b64decode"
|
||||||
- "'serveraliveinterval 30' in slurp_ssh_config['content'] | b64decode"
|
- "'serveraliveinterval 30' in slurp_ssh_config['content'] | b64decode"
|
||||||
|
- "'addressfamily inet6' in slurp_ssh_config['content'] | b64decode"
|
||||||
|
|
||||||
- name: Options - Ensure no update in case option exist in ssh_config file but wasn't defined in playbook
|
- name: Options - Ensure no update in case option exist in ssh_config file but wasn't defined in playbook
|
||||||
community.general.ssh_config:
|
community.general.ssh_config:
|
||||||
@@ -225,6 +232,7 @@
|
|||||||
- "'controlpersist 600' in slurp_ssh_config['content'] | b64decode"
|
- "'controlpersist 600' in slurp_ssh_config['content'] | b64decode"
|
||||||
- "'dynamicforward 11080' in slurp_ssh_config['content'] | b64decode"
|
- "'dynamicforward 11080' in slurp_ssh_config['content'] | b64decode"
|
||||||
- "'serveraliveinterval 30' in slurp_ssh_config['content'] | b64decode"
|
- "'serveraliveinterval 30' in slurp_ssh_config['content'] | b64decode"
|
||||||
|
- "'addressfamily inet6' in slurp_ssh_config['content'] | b64decode"
|
||||||
|
|
||||||
- name: Debug
|
- name: Debug
|
||||||
debug:
|
debug:
|
||||||
@@ -278,6 +286,7 @@
|
|||||||
- "'controlpersist yes' not in slurp_ssh_config['content'] | b64decode"
|
- "'controlpersist yes' not in slurp_ssh_config['content'] | b64decode"
|
||||||
- "'dynamicforward 10080' not in slurp_ssh_config['content'] | b64decode"
|
- "'dynamicforward 10080' not in slurp_ssh_config['content'] | b64decode"
|
||||||
- "'serveraliveinterval 30' not in slurp_ssh_config['content'] | b64decode"
|
- "'serveraliveinterval 30' not in slurp_ssh_config['content'] | b64decode"
|
||||||
|
- "'addressfamily inet' not in slurp_ssh_config['content'] | b64decode"
|
||||||
|
|
||||||
# Proxycommand and ProxyJump are mutually exclusive.
|
# Proxycommand and ProxyJump are mutually exclusive.
|
||||||
# Reset ssh_config before testing options with proxyjump
|
# Reset ssh_config before testing options with proxyjump
|
||||||
@@ -302,6 +311,7 @@
|
|||||||
dynamicforward: '10080'
|
dynamicforward: '10080'
|
||||||
other_options:
|
other_options:
|
||||||
serveraliveinterval: '30'
|
serveraliveinterval: '30'
|
||||||
|
address_family: "inet"
|
||||||
state: present
|
state: present
|
||||||
register: options_add
|
register: options_add
|
||||||
check_mode: true
|
check_mode: true
|
||||||
@@ -339,6 +349,7 @@
|
|||||||
dynamicforward: '10080'
|
dynamicforward: '10080'
|
||||||
other_options:
|
other_options:
|
||||||
serveraliveinterval: '30'
|
serveraliveinterval: '30'
|
||||||
|
address_family: "inet"
|
||||||
state: present
|
state: present
|
||||||
register: options_add
|
register: options_add
|
||||||
|
|
||||||
@@ -365,6 +376,7 @@
|
|||||||
dynamicforward: '10080'
|
dynamicforward: '10080'
|
||||||
other_options:
|
other_options:
|
||||||
serveraliveinterval: '30'
|
serveraliveinterval: '30'
|
||||||
|
address_family: "inet"
|
||||||
state: present
|
state: present
|
||||||
register: options_add_again
|
register: options_add_again
|
||||||
|
|
||||||
@@ -394,6 +406,7 @@
|
|||||||
- "'controlpersist yes' in slurp_ssh_config['content'] | b64decode"
|
- "'controlpersist yes' in slurp_ssh_config['content'] | b64decode"
|
||||||
- "'dynamicforward 10080' in slurp_ssh_config['content'] | b64decode"
|
- "'dynamicforward 10080' in slurp_ssh_config['content'] | b64decode"
|
||||||
- "'serveraliveinterval 30' in slurp_ssh_config['content'] | b64decode"
|
- "'serveraliveinterval 30' in slurp_ssh_config['content'] | b64decode"
|
||||||
|
- "'addressfamily inet' in slurp_ssh_config['content'] | b64decode"
|
||||||
|
|
||||||
- name: Options - Update host
|
- name: Options - Update host
|
||||||
community.general.ssh_config:
|
community.general.ssh_config:
|
||||||
@@ -410,6 +423,7 @@
|
|||||||
dynamicforward: '11080'
|
dynamicforward: '11080'
|
||||||
other_options:
|
other_options:
|
||||||
serveraliveinterval: '30'
|
serveraliveinterval: '30'
|
||||||
|
address_family: "inet6"
|
||||||
state: present
|
state: present
|
||||||
register: options_update
|
register: options_update
|
||||||
|
|
||||||
@@ -438,6 +452,7 @@
|
|||||||
dynamicforward: '11080'
|
dynamicforward: '11080'
|
||||||
other_options:
|
other_options:
|
||||||
serveraliveinterval: '30'
|
serveraliveinterval: '30'
|
||||||
|
address_family: "inet6"
|
||||||
state: present
|
state: present
|
||||||
register: options_update
|
register: options_update
|
||||||
|
|
||||||
@@ -468,6 +483,7 @@
|
|||||||
- "'controlpersist 600' in slurp_ssh_config['content'] | b64decode"
|
- "'controlpersist 600' in slurp_ssh_config['content'] | b64decode"
|
||||||
- "'dynamicforward 11080' in slurp_ssh_config['content'] | b64decode"
|
- "'dynamicforward 11080' in slurp_ssh_config['content'] | b64decode"
|
||||||
- "'serveraliveinterval 30' in slurp_ssh_config['content'] | b64decode"
|
- "'serveraliveinterval 30' in slurp_ssh_config['content'] | b64decode"
|
||||||
|
- "'addressfamily inet6' in slurp_ssh_config['content'] | b64decode"
|
||||||
|
|
||||||
- name: Options - Ensure no update in case option exist in ssh_config file but wasn't defined in playbook
|
- name: Options - Ensure no update in case option exist in ssh_config file but wasn't defined in playbook
|
||||||
community.general.ssh_config:
|
community.general.ssh_config:
|
||||||
@@ -503,6 +519,7 @@
|
|||||||
- "'controlpersist 600' in slurp_ssh_config['content'] | b64decode"
|
- "'controlpersist 600' in slurp_ssh_config['content'] | b64decode"
|
||||||
- "'dynamicforward 11080' in slurp_ssh_config['content'] | b64decode"
|
- "'dynamicforward 11080' in slurp_ssh_config['content'] | b64decode"
|
||||||
- "'serveraliveinterval 30' in slurp_ssh_config['content'] | b64decode"
|
- "'serveraliveinterval 30' in slurp_ssh_config['content'] | b64decode"
|
||||||
|
- "'addressfamily inet6' in slurp_ssh_config['content'] | b64decode"
|
||||||
|
|
||||||
- name: Debug
|
- name: Debug
|
||||||
debug:
|
debug:
|
||||||
@@ -556,3 +573,4 @@
|
|||||||
- "'controlpersist yes' not in slurp_ssh_config['content'] | b64decode"
|
- "'controlpersist yes' not in slurp_ssh_config['content'] | b64decode"
|
||||||
- "'dynamicforward 10080' not in slurp_ssh_config['content'] | b64decode"
|
- "'dynamicforward 10080' not in slurp_ssh_config['content'] | b64decode"
|
||||||
- "'serveraliveinterval 30' not in slurp_ssh_config['content'] | b64decode"
|
- "'serveraliveinterval 30' not in slurp_ssh_config['content'] | b64decode"
|
||||||
|
- "'addressfamily inet' not in slurp_ssh_config['content'] | b64decode"
|
||||||
|
|||||||
Reference in New Issue
Block a user