Commit graph

14 commits

Author SHA1 Message Date
Leo Antunes
d54905ecee Allow multiple keys per host + minor improvements (#716)
* known_hosts: clarify key format in documentation

Add a small clarification to the documentation about the format of the
"key" parameter.
Should make #664 less of a issue for newcomers.

* known_hosts: normalize key entry to simplify input

Keys are normalized before comparing input with present keys. This
should make it easier to deal with some corner cases, such as having a
hashed entry for some host and trying to add it as non-hashed.

* known_hosts: allow multiple entries per host

In order to support multiple key types and allow the installed ssh
version to decide which is more secure, the module now only overwrites
an existing entry in known_hosts if the provided key is of the same
type.
Old keys of different types must be explicitly removed. Setting
state to "absent" and providing no key will remove all entries for the
host.
2016-05-23 10:33:52 -04:00
Michael Scherer
557d37d3f1 Use type='path' rather than str, so path is expanded correctly 2016-05-08 11:33:54 +02:00
Brian Coca
9fb6054500 avoid index error on empty list, key being true means its not None nor []
fixes #13009
2015-11-02 21:50:31 -05:00
Michael Scherer
162f257412 Use the parameter 'name' everywhere for consistency
Fix https://github.com/ansible/ansible/issues/11395
2015-07-25 14:11:03 +02:00
Greg DeKoenigsberg
004dedba8a Changes to author formatting, remove emails 2015-06-16 14:32:39 -04:00
Brian Coca
08445418aa more string corrections 2015-05-14 10:45:32 -04:00
Greg DeKoenigsberg
3d4477ab07 Adding author's github id 2015-05-14 01:04:45 -04:00
Sterling Windmill
7c675705f3 Allow for specifying name instead of host as per the documentation at http://docs.ansible.com/known_hosts_module.html 2015-05-04 15:57:40 -04:00
Brian Coca
2535a49284 fixed 2.4 compatibility 2015-04-18 21:50:06 -04:00
Brian Coca
89284bcce0 now also captrure OSErrors on temp file
fixes #360
2015-04-01 20:44:28 -04:00
Matthew Vernon
30cf73e83a Fix for issue #353 (handle change in ssh-keygen behaviour)
Prior to openssh 6.4, ssh-keygen -F returned 0 (and no output) when no
host was found. After then, it instead returned 1 and no output. This
revised code behaves correctly with either behaviour. There is
currently no other code path that results in exit(1) and no output.
2015-03-31 17:20:48 +01:00
Tyler Kellen
c08ce5b30d correct version_added for known_hosts
It was added in 1.9, not 1.6.
2015-03-28 13:20:30 -06:00
Matthew Vernon
7a9e6aee90 Changes from Brian Coca's review of this module
These are all the code changes from Brian's review:
* change #! line
* rename "host" to "name" [keep as alias]
* make documentation clearer
* imports 1 per line
* use get_bin_path to find ssh-keygen
* key not actually required when removing host
2015-03-06 18:24:32 +00:00
Matthew Vernon
d821a39131 known_hosts: manage ssh known_hosts files with ansible.
The known_hosts module lets you add or remove a host from the
known_hosts file. This is useful if you're going to want to use the
git module over ssh, for example. If you have a very large number of
host keys to manage, you will find the template module more useful.

This was pull request 7840 from the old ansible repo, which was
accepted-in-principle but not yet merged. The mailing list thread
reading it is:

https://groups.google.com/forum/#!topic/ansible-devel/_e7H_VT6UJE/discussion
2015-03-06 18:24:32 +00:00