diff --git a/library/ssh_config.py b/library/ssh_config.py index 7ff3a3b..d0b9909 100755 --- a/library/ssh_config.py +++ b/library/ssh_config.py @@ -641,6 +641,10 @@ def dump(self): key, value_ ) host_item_content += sub_content + elif value is True: + host_item_content += " {0} yes\n".format(key) + elif value is False: + host_item_content += " {0} no\n".format(key) else: host_item_content += " {0} {1}\n".format( key, value @@ -707,7 +711,7 @@ def main(): proxycommand=dict(default=None, type='str'), strict_host_key_checking=dict( default=None, - choices=['yes', 'no', 'ask'] + choices=['yes', 'no', 'ask', True, False] ), ), supports_check_mode=True diff --git a/test/roles/normal-user/tasks/main.yml b/test/roles/normal-user/tasks/main.yml index 568887d..b15b2c9 100644 --- a/test/roles/normal-user/tasks/main.yml +++ b/test/roles/normal-user/tasks/main.yml @@ -66,3 +66,24 @@ host=example.com strict_host_key_checking=yes - include: _assert.yml option=stricthostkeychecking value=yes + +- name: Test host key checking with lax config + ssh_config: + user: vagrant + host: example.com + strict_host_key_checking: true +- include: _assert.yml option=stricthostkeychecking value=yes + +- name: Test no host key checking with lax config + ssh_config: + user: vagrant + host: example.com + strict_host_key_checking: false +- include: _assert.yml option=stricthostkeychecking value=no + +- name: Test ask host key checking with lax config + ssh_config: + user: vagrant + host: example.com + strict_host_key_checking: ask +- include: _assert.yml option=stricthostkeychecking value=ask