---
- hosts: localhost
gather_facts: false
vars:
- a_var: derp
pre_tasks:
- name: pretask
debug: msg="a pre task"
changed_when: true
notify: say hi
roles:
- role: simple
derp: newval
tasks:
- name: task
debug: msg="a task"
changed_when: true
notify: say hi
post_tasks:
- name: posttask
debug: msg="a post task"
changed_when: true
notify: say hi
Example Playbook Code
---
- name: Update web servers
hosts: web
tasks:
- name: Install Apache in centos7
ansible.builtin.yum:
name: httpd
state: latest
- name: Copy index.html
ansible.builtin.copy:
src: index.html
dest: /var/www/html/index.html
- name: Starting a Apache Server
ansible.builtin.service:
name: httpd
state: started
Ansible Fundamental tutorial by Manish in 2020
Ansible Advance Tutorial for Beginners with Demo 2020 — By DevOpsSchool
Ansible with network module (Part 01) — By DevOpsSchool
Ansible with network module (Part 02) — By DevOpsSchool
Ansible with network module (Part 03) — By DevOpsSchool
Ansible with network module (Part 04) — By DevOpsSchool
Ansible with network module (Part 05) — By DevOpsSchool
Ansible with network module (Part 06) — By DevOpsSchool
Ansible with network module (Part 07) — By DevOpsSchool
Ansible with network module (Part 08) — By DevOpsSchool
Ansible with network module (Part 09) — By DevOpsSchool
Ansible with network module (Part 10) — By DevOpsSchool
Ansible with network module (Part 11) — By DevOpsSchool
Ansible with network module (Part 12) — By DevOpsSchool
Ansible with network module (Part 13) — By DevOpsSchool
Latest posts by Rajesh Kumar (see all)
- Network Security Group - March 19, 2024
- Azure Network Security Groups NSG - March 19, 2024
- An Overview of Azure Storage - March 19, 2024