playbook
1. Playbook install apache
ansible-playbook install_apache.yaml --ask-become-pass
install_apache.yaml
---
- hosts: all
become: true
tasks:
- name: update repo
apt:
update_cache: true
- name: install apache
apt:
name: apache2
state: latest
2. Playbook remove apache
ansible-playbook remove_apache.yaml --ask-become-pass
remove_apache.yaml
---
- hosts: all
become: true
tasks:
- name: remove apache
apt:
name: apache2
state: absent