Hello,
the term playbook stands for the yaml file itself.
One playbook (file) have one or more plays. Identified by name: and/or hosts:
Greetings
Andreas
Hello,
the term playbook stands for the yaml file itself.
One playbook (file) have one or more plays. Identified by name: and/or hosts:
Greetings
Andreas
Thank you for the quick response! cleared everything up.
Consider the following example:
# This is the run-me.yml playbook - name: This is the first play hosts: hostsA tasks: - name: Hello world debug: msg: 'Hello World' - name: This is the second play hosts: hostsB tasks: - name: Bye bye word debug: msg: 'Bye bye world!'
Hi @dennishart,
My mnemonic is that a playbook is a list of plays.
Once you get that, you realize why a playbook yaml file always has to start by a hyphen, introducing the first item of that list.
Most playbooks only have one play, which probably fuels your confusion. Yet, they are still a list (of 1 item) and they still require that initial hyphen though.
The reason why you would need several plays in one playbook is when you have to execute different tasks or roles to different sets of target systems. Indeed the key directive of a play is the hosts directive which sets the target systems for that play.
Good point about the hosts directive @littlebigfab
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.