You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 2022/Days/day64.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,18 +58,28 @@ However, remember I said you will need to have SSH available to enable Ansible t
58
58

59
59
60
60
I have now also started adding some additional hosts to our inventory, another name for this file as this is where you are going to define all of your devices, could be network devices, switches and routers for example also would be added here and grouped. In our hosts file though I have also added my credentials for accessing the Linux group of systems.
61
+
Troubleshooting: SSH Host Key Checking Error
62
+
If Ansible fails to connect and you see an error like:
63
+
64
+
`Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.
65
+
Please add this host's fingerprint to your known_hosts file to manage this host.`
66
+
67
+
This happens often in lab environments such as Vagrant where host keys frequently change.
68
+
To bypass host key checking temporarily (for testing only), run:
69
+
70
+
`export ANSIBLE_HOST_KEY_CHECKING=False`
61
71
62
72

63
73
64
-
Now if we run `ansible Linux -m ping` we get success as per below.
74
+
Now if we run `ansible linux -m ping` we get success as per below.
65
75
66
76

67
77
68
78
We then have the node requirements, these are the target systems you wish to automate the configuration on. We are not installing anything for Ansible on these (I mean we might be installing software but there is no client from Ansible we need) Ansible will make a connection over SSH and send anything over SFTP. (If you so desire though and you have SSH configured you could use SCP vs SFTP.)
69
79
70
80
### Ansible Commands
71
81
72
-
You saw that we were able to run `ansible Linux -m ping` against our Linux machine and get a response, basically, with Ansible we can run many ad-hoc commands. But you can run this against a group of systems and get that information back. [ad hoc commands](https://docs.ansible.com/ansible/latest/user_guide/intro_adhoc.html)
82
+
You saw that we were able to run `ansible linux -m ping` against our Linux machine and get a response, basically, with Ansible we can run many ad-hoc commands. But you can run this against a group of systems and get that information back. [ad hoc commands](https://docs.ansible.com/ansible/latest/user_guide/intro_adhoc.html)
73
83
74
84
If you find yourself repeating commands or even worse you are having to log into individual systems to run these commands then Ansible can help there. For example, the simple command below would give us the output of all the operating system details for all of the systems we add to our Linux group.
0 commit comments