Skip to content
This repository was archived by the owner on Jan 30, 2021. It is now read-only.

Convert True/False values in strict_host_key_checking #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion library/ssh_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions test/roles/normal-user/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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