Using Ansible

Once you have Ansible set up, there are two ways to use it:

  • Ad-hoc commands: You can execute a command on the remote host using Ansible's command-line tool.
  • Using playbooks: You can write your own file configuration for all or specific hosts or host groups. For this task, you can use YAML configuration specification language.

YAML (https://yaml.org/) is the syntax used for Ansible playbooks and other files. The YAML documentation (https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html) contains the full specifications of the syntax.

YAML is a format for saving data objects within a tree structure. Normally, it is used to define configuration files, although it is also possible to serialize objects, that is, to write the structure of an object in text string mode so that later it can be recovered.

This could be the syntax with YAML format:

development:  
database: mysql
host: localhost
username: root
password: passwd
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset