Last active
March 31, 2018 15:28
-
-
Save mansurali901/f07db3a74da26e8fdbf2bcedbcdeb989 to your computer and use it in GitHub Desktop.
Ansible playbook to setup Nginx webserver with PHP and PHP-FPM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: vms | |
tasks: | |
- name: Add Nginx Repository PPA | |
apt_repository: repo='ppa:nginx/stable' state=present | |
register: ppastable | |
- name: Install Nginx | |
apt: pkg=nginx state=present update_cache=true | |
when: ppastable|success | |
register: nginxinstalled | |
notify: | |
- Start Ngnix | |
- name: Install PHP | |
apt: pkg=php state=present update_cache=true | |
- name: Install PHP FPM | |
apt: pkg=php-fpm state=present update_cache=true | |
when: nginxinstalled|success | |
notify: | |
- Restart Nginx | |
handlers: | |
- name: Start Ngnix | |
service: name=nginx state=started | |
- name: Restart Nginx | |
service: name=nginx state=restarted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment