eusebium / ansible-role-ssh_keys Goto Github PK
View Code? Open in Web Editor NEWConfigures all hosts in the current play to allow password-free (pubkey based) SSH authentication amongst themselves.
Configures all hosts in the current play to allow password-free (pubkey based) SSH authentication amongst themselves.
Hi,
I've got an error caused by the defaults/main.yml
ssh_keys_ssh_keyscan_hosts:
- "{{ ansible_fqdn }}"
- "{{ ansible_hostname }}"
- "{{ ansible_default_ipv4.address }}"
- "{{ ansible_eth1.ipv4.address | default(omit) }}" <--- Causes Error
I've implemeted an workaround like this:
# When updating known_hosts select how you will reach the ssh server (ip or hostname).
# Default is all.
ssh_keys_ssh_keyscan_common_hosts:
- "{{ ansible_fqdn }}"
- "{{ ansible_hostname }}"
- "{{ ansible_default_ipv4.address }}"
ssh_keys_ssh_keyscan_hosts: "{{ (ssh_keys_ssh_keyscan_common_hosts +\
[ ansible_eth1.ipv4.address ]) if ansible_eth1.ipv4.address is defined else ssh_keys_ssh_keyscan_common_hosts }}"
Maybe you'll implement that, else I'm setting the variable ssh_keys_ssh_keyscan_hosts
in group_vars
.
Thanks for publishing the role.
Josef
$ ansible --version
ansible 2.9.13
config file = /home/admin/swarm-cluster/ansible.cfg
configured module search path = ['/home/admin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.8.2 (default, Jul 16 2020, 14:00:26) [GCC 9.3.0]
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
$ ip addr | grep "inet "
inet 127.0.0.1/8 scope host lo
inet 192.168.1.201/24 brd 192.168.1.255 scope global dynamic ens192
TASK [eusebium.ssh_keys : SSH gather host keys] ******************************************************************************************************
task path: /home/admin/swarm-cluster/roles/eusebium.ssh_keys/tasks/main.yml:84
failed: [swarm2 -> swarm2] (item=__omit_place_holder__f35f1a15d9edae6ae7c3e2c9e3789e5047a8d0cb) => {
"ansible_loop_var": "item",
"changed": false,
"cmd": [
"ssh-keyscan",
"__omit_place_holder__f35f1a15d9edae6ae7c3e2c9e3789e5047a8d0cb"
],
"delta": "0:00:05.040866",
"end": "2020-10-02 16:19:12.998494",
"item": "__omit_place_holder__f35f1a15d9edae6ae7c3e2c9e3789e5047a8d0cb",
"rc": 1,
"start": "2020-10-02 16:19:07.957628"
}
MSG:
non-zero return code
failed: [swarm1 -> swarm1] (item=__omit_place_holder__f35f1a15d9edae6ae7c3e2c9e3789e5047a8d0cb) => {
"ansible_loop_var": "item",
"changed": false,
"cmd": [
"ssh-keyscan",
"__omit_place_holder__f35f1a15d9edae6ae7c3e2c9e3789e5047a8d0cb"
],
"delta": "0:00:05.060103",
"end": "2020-10-02 16:19:12.998428",
"item": "__omit_place_holder__f35f1a15d9edae6ae7c3e2c9e3789e5047a8d0cb",
"rc": 1,
"start": "2020-10-02 16:19:07.938325"
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.