Class: Ansible::Ruby::Modules::Known_hosts
- Inherits:
-
Base
- Object
- Ansible::Ruby::Models::Base
- Base
- Ansible::Ruby::Modules::Known_hosts
- Defined in:
- lib/ansible/ruby/modules/generated/system/known_hosts.rb
Overview
The C(known_hosts) module lets you add or remove a host keys from the C(known_hosts) file. Starting at Ansible 2.2, multiple entries per host are allowed, but only one for each key type supported by ssh. This is useful if you’re going to want to use the M(git) module over ssh, for example. If you have a very large number of host keys to manage, you will find the M(template) module more useful.
Instance Method Summary collapse
-
#hash_host ⇒ :yes, ...
Hash the hostname in the known_hosts file.
-
#key ⇒ String?
The SSH public host key, as a string (required if state=present, optional when state=absent, in which case all keys for the host are removed).
-
#name ⇒ String
The host to add or remove (must match a host specified in key).
-
#path ⇒ String?
The known_hosts file to edit.
-
#state ⇒ :present, ...
I(present) to add the host key, I(absent) to remove it.
Methods inherited from Base
Methods inherited from Ansible::Ruby::Models::Base
attr_option, attr_options, attribute, fix_inclusion, #initialize, remove_existing_validations, #to_h, validates
Constructor Details
This class inherits a constructor from Ansible::Ruby::Models::Base
Instance Method Details
#hash_host ⇒ :yes, ...
Returns Hash the hostname in the known_hosts file.
26 |
# File 'lib/ansible/ruby/modules/generated/system/known_hosts.rb', line 26 attribute :hash_host |
#key ⇒ String?
Returns The SSH public host key, as a string (required if state=present, optional when state=absent, in which case all keys for the host are removed). The key must be in the right format for ssh (see sshd(8), section “SSH_KNOWN_HOSTS FILE FORMAT”).rnSpecifically, the key should not match the format that is found in an SSH pubkey file, but should rather have the hostname prepended to a line that includes the pubkey, the same way that it would appear in the known_hosts file. The value prepended to the line must also match the value of the name parameter.
18 |
# File 'lib/ansible/ruby/modules/generated/system/known_hosts.rb', line 18 attribute :key |
#name ⇒ String
Returns The host to add or remove (must match a host specified in key). It will be converted to lowercase so that ssh-keygen can find it.
14 |
# File 'lib/ansible/ruby/modules/generated/system/known_hosts.rb', line 14 attribute :name |
#path ⇒ String?
Returns The known_hosts file to edit.
22 |
# File 'lib/ansible/ruby/modules/generated/system/known_hosts.rb', line 22 attribute :path |
#state ⇒ :present, ...
Returns I(present) to add the host key, I(absent) to remove it.
30 |
# File 'lib/ansible/ruby/modules/generated/system/known_hosts.rb', line 30 attribute :state |