Ansible 101 : Simple overview of Ansible and the ad-hoc commands
Ansible uses Yaml language for its configuration files.
These configurations are sent from the controller server to the managed nodes.
The controller can talk or send commands to its node through SSH connections using the below:
- Ad-hoc simple commands
Playbooks use Yaml.
Ansible runs on the controller node only. We use the controller node to issue our commands to the managed nodes.
The controller node has a database of the managed hosts called inventory.
The managed nodes don't need any special software to communicate with the controller node. The communication is done using SSH.
Playbooks include plays which represent the tasks to be run on the managed nodes.
Ansible is very modular, we could enhance its capabilities using third party modules.
All the managed nodes are part of the inventory which is usually /etc/ansible/hosts.
Because the controller node and the managed nodes communicate via SSH, the password of the controller's account needs to be available on the controller node, and be set up with SSH keys, to allow the controller to connect to the managed nodes.
Below is an example of ad-hoc commands using the Ansible ping module that will run on all the managed nodes that are in the inventory /etc/ansible/hosts.
The below command issue a ping on the Linux1 and Linux2 manages nodes: