Playbook to add hosts to the known hosts list - Ansible

0 votes
How do I write Ansible Playbook to add hosts to the known host list?
Mar 25, 2019 in Ansible by Kiran
571 views

1 answer to this question.

0 votes

Hey @Kiran, try something like this:

- name: Add EC2 instances as known hosts
  known_hosts:
    name: "{{ item.public_ip }}"
    key: "{{ lookup('pipe', 'ssh-keyscan -t rsa ' + item.public_ip) }}"
  with_items: "{{ ec2_instances.tagged_instances }}"
answered Mar 25, 2019 by Haider

Related Questions In Ansible

0 votes
1 answer

Configuring SSH Access to the Ansible Hosts

Hey @Shakira, follow these steps: Execute the following ...READ MORE

answered Jan 17, 2019 in Ansible by Sam
191 views
0 votes
1 answer
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,420 points
497 views
0 votes
1 answer
0 votes
1 answer
+1 vote
3 answers