Ansible Configuration - SomethingGeneric/sparkle.local GitHub Wiki
Install Ansible
- Install ansible on your controller (
mgmt2-sparklein this case)sudo apt install ansible sshpass python3-paramiko
Set up Ansible Directory
- Make directory
ansiblemkdir -p ansible
Create host files
- Within the
ansibledirectory make two hosts files, one for windows and one for linux. - Put all your VM's hostnames in their respective files
vi windows_hosts.txt
vi linux_hosts.txt
Create RSA Key pair on controller (mgmt2-sparkle)
- On the controller (
mgmt02-sparkle)ssh-keygen
Copy keys to linux nodes
ssh-copy-id sparkle-deployer@hostname- replace
hostnamewith node name (you will copy them to every nodes)
- replace
- do the command above for all the nodes
util-sparkledhcp1-razzledhcp2-dazzle
Add commands for passwordless SSH login
Make sure you re-run these commands everytime you come back to your machine!
eval $(ssh-agent)
ssh-add -t 14400
Ping Linux hosts
ansible all -m ping -i linux_hosts.txt
Ping Windows Hosts
OpenSSH will create SSH key on systems once it is install. This is why you don't need to copy the keys to the windows machine before you can ping them with anisble, all you have to do it have OpenSSH set up.
ansible windows -i windows_hosts.txt -m win_ping -u [email protected] --ask-pass