Playbooks

Sample playbook/YAML file:

---
name: install and configure DB
hosts: testServer
become: yes
vars:
oracle_db_port_value: 1521
tasks:
-name: Install the Oracle DB
yum: <code to install the DB>
-name: Ensure the installed service is enabled and running
service:
name: <your service name>

Some general tags in YAML:

  • Name: Name of a playbook
  • Hosts: A mandatory field that specifies the list of hosts and the tasks that can be performed on the same machine or a different one
  • Vars: Defines the variables that we can use
  • Tasks: The list of actions that need to be performed contains the name of the task (a task is always linked to a module)
Comments