ansible/test/integration/non_destructive.yml
Marius Gedminas 2efb692cc4 known_hosts: support --diff (#20349)
* known_hosts: support --diff

* known_hosts: support --diff also without --check

* Add unit tests and fix incorrect diff in one corner case

Tests are good!

* Refactor for readability

* Python 3 compat

* More Python 3 compat

* Add an integration test for known_hosts

* Handle ssh-keygen -HF returning non-zero exit code

AFAICT this is a bug in ssh-keygen in some newer OpenSSH versions
(>= 6.4 probably; see commit dd9d5cc670):
when you invoke ssh-keygen with -H and -F <host> options, it always
returns exit code 1.  This is because in ssh-keygen.c there's a function
do_known_hosts() which calls

  exit (find_host && !ctx.found_key);

at the end, and find_host is 1 (because we passed -F on the command line),
but ctx.found_key is always 0.  Why is found_key always 0?  Because the
callback passed to hostkeys_foreach(), which is known_hosts_hash(),
never bothers to set found_key to 1.

* This test does not need root

* Avoid ssh-ed25519 keys in sample known_hosts file

Older versions of OpenSSH do not like them and ssh-keygen -HF
aborts with an error when it sees such keys:

  line 5 invalid key: example.net...
  /root/ansible_testing/known_hosts is not a valid known_hosts file.

* Fix Python 3 errors

Specifically, the default mode of tempfile.NamedTemporaryFile is 'w+b',
which means Python 3 wants us to write bytes objects to it -- but the
keys we have are all unicode strings.
2017-02-08 09:56:03 -05:00

38 lines
1.8 KiB
YAML

- hosts: testhost
gather_facts: yes
roles:
- { role: ping, tags: test_ping }
- { role: special_vars, tags: test_special_vars }
- { role: ignore_errors, tags: test_ignore_errors }
- { role: conditionals, tags: test_conditionals }
- { role: iterators, tags: test_iterators }
- { role: lookups, tags: test_lookups }
- { role: changed_when, tags: test_changed_when }
- { role: failed_when, tags: test_failed_when }
- { role: until, tags: test_until }
- { role: copy, tags: test_copy }
- { role: stat, tags: test_stat }
- { role: template, tags: test_template }
- { role: file, tags: test_file }
- { role: fetch, tags: test_fetch }
- { role: synchronize, tags: test_synchronize }
- { role: assemble, tags: test_assemble }
- { role: subversion, tags: test_subversion }
- { role: hg, tags: test_hg }
- { role: lineinfile, tags: test_lineinfile }
- { role: unarchive, tags: test_unarchive }
- { role: filters, tags: test_filters }
- { role: facts_d, tags: test_facts_d }
- { role: async, tags: [test_async, test_async_status, test_async_wrapper] }
- { role: command_shell, tags: [test_command_shell, test_command, test_shell] }
- { role: task_ordering, tags: test_task_ordering }
- { role: script, tags: test_script }
- { role: authorized_key, tags: test_authorized_key }
- { role: embedded_module, tags: test_embedded_module }
- { role: add_host, tags: test_add_host }
- { role: binary, tags: test_binary }
- { role: loops, tags: test_loops }
- { role: mount, tags: [test_mount, needs_root, needs_privileged]}
- { role: include_vars, tags: test_include_vars }
- { role: sefcontext, tags: [test_sefcontext, needs_root]}
- { role: known_hosts, tags: test_known_hosts }