YAML is a simple markup language that can be used to represent structured data. (Yet Another Markup Language)
A playbook is basically a plan for defining and orchestrating tasks to be executed on managed nodes. It allows you to automate repetitive tasks, authorize system arrangements, and manage infrastructure efficiently.
---
- name: install httpd
hosts: node2
tasks:
- name: install httpd
yum: name=httpd
- name: enable apache
service: name=httpd state=true state=started
- name: content
copy:
content: "welcome to webserver"
dest: /var/www/html/index.html
mode: "0644"
- name: open firewall port
firewalld:
service: httpd
permanent: yes
state: enabled---
- name: install httpd
hosts: node2
tasks:
- name: install httpd
yum: name=httpd
- name: enable apache
service: name=httpd state=true state=started
- name: content
copy:
content: "welcome to webserver"
dest: /var/www/html/index.html
mode: "0644"
- name: open firewall port
firewalld:
service: httpd
permanent: yes
state: enabled