Ansible is a very popular management tool for all sorts of systems. Linux servers, Windows systems, networking equipment, and more can all be managed and provisioned on mass using Ansible.
I had to investigate some more with Ansible for work, and I wanted to share some of those findings.
The video covers the basic install, host setup, ping, and running a sample playbook. The playbooks are really the most important tool, because by using a simple yaml file, administrators can perform routine provisioning or updates to dozens to thousands of servers with a single command.
The sample below shows how to create a file on all of the managed devices, run a package manager update, and even install and application (openjdk is used as an example, but any valid package would work).
The reference file is located here.
Troubleshooting:
In the making of the video, because I installed Ansible on a somewhat older host for demo purposes, the version 2.5.1 wanted to use Python 2, but the clients default to Python 3. To work around this the Group Variables need to add the below line in the hosts file. I've not seen this using newer versions 2.9, but something to watch for.
ansible_python_interpreter=/usr/bin/python3
Also important is that the ssh keys of the clients need to be in the host running Ansible. That can be most easily setup by connecting to the clients over ssh. If there is a lot of hosts, good key management can also allow for the keys to all be exported and updated into the ssh known_hosts file.
No comments:
Post a Comment