ansible/example_playbook
2021-04-09 13:09:38 -07:00

28 lines
635 B
Plaintext

---
- hosts: webserver
gather_facts: yes
become: yes
tasks:
- name: Install apache
apt: pkg=apache2 state=latest
notify:
- restart apache2
- name: Enable apache2 during boot
service: name=apache2 state=started enabled=yes
handlers:
- name: restart apache2
service: name=apache2 state=restarted
- hosts: loadbalancer
become: yes
tasks:
- name: Install nginx
apt: pkg=nginx state=latest
notify:
- restart nginx
- name: Enable nginx during boot
service: name=nginx state=started enabled=yes
handlers:
- name: restart nginx
service: name=nginx state=restarted