Created
February 12, 2016 11:59
-
-
Save ianjuma/054eb73790981a6775aa to your computer and use it in GitHub Desktop.
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: autobay | |
| vars_files: | |
| - vars/main.yml | |
| remote_user: root | |
| tasks: | |
| - name: Add Nginx repository | |
| apt_repository: repo='ppa:nginx/stable' state=present | |
| register: ppastable | |
| - name: Install Nginx | |
| apt: pkg=nginx state=installed update_cache=true | |
| when: ppastable|success | |
| register: nginxinstalled | |
| notify: | |
| - Start Nginx | |
| - name: Ensure nginx is at the latest version | |
| apt: pkg=nginx state=latest update_cache=true | |
| - name: Write Nginx conf | |
| template: src=templates/nginx.j2 dest=/etc/nginx/nginx.conf | |
| notify: | |
| - Restart nginx | |
| - name: Ensure nginx is running | |
| service: name=nginx state=started | |
| handlers: | |
| - name: Restart nginx | |
| service: name=nginx state=restarted | |
| - name: Start Nginx | |
| service: name=nginx state=started |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment