A playbook is a yaml file which list a set of action to run, and in which order. You can create your own tasks in a playbook, but most of the time, you'll just assign roles to hosts, or group of host in a playbook.

You can create your playbooks where you want, for example, in a playbook subdirectory

mkdir playbooks
vim playbooks/fws.yml

Here's a real world example

- name: Deploy outbound proxy server
    - repo_base
    - squid

- name: Deploy AD DC
  hosts: fws_dc
    - system_proxy
    - repo_base
    - samba
    - letsencrypt

- name: Deploy common profiles
  hosts: fws
    - common
    - backup
    - filebeat

- name: Deploy Proxmox hosts
  hosts: fws_pve
    - pve

- name: Deploy databases servers
    - mysql_server
    - postgresql_server

In this example, if the playbook is ran, it'll do the following :

  • On the host, it will deploy the roles repo_base and squid
  • On the hosts members of group fws_dc, it'll deploy the roles system_proxy, repo_base, samba and letsencrypt
  • On all the hosts members of the group fws, it'll deploy the roles common, backup and filebeat
  • etc.

So, you have to define your playbook with what you want to do

  • ansible/basic/playbooks.txt
  • Dernière modification: 12/02/2021 17:04
  • de dani