main.yml 574 B

1234567891011121314151617181920212223242526
  1. ---
  2. - name: Dependencies installed
  3. community.general.pkgng:
  4. name: nginx
  5. state: latest
  6. - name: Nginx enabled
  7. shell: sysrc nginx_enable="YES"
  8. - name: Nginx locations folder exists
  9. file: path=/usr/local/etc/nginx/locations/ state=directory
  10. - name: Nginx sites folder exists
  11. file: path=/usr/local/etc/nginx/sites/ state=directory
  12. - name: Nginx config installed
  13. template:
  14. src: nginx.conf.j2
  15. dest: /usr/local/etc/nginx/nginx.conf
  16. mode: 0644
  17. notify: Nginx restarted
  18. - name: Ensure nginx is running
  19. service:
  20. name: nginx
  21. state: started