nginx.yml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. - name: Install nginx package
  2. action: ${ansible_pkg_mgr} pkg=nginx state=installed update_cache=yes
  3. when_boolean: ${with_nginx}
  4. - name: Install nginx default file configuration
  5. action: template src=nginx/default.j2 dest=/etc/default/nginx owner=root group=root mode=0644
  6. notify:
  7. - Restart nginx
  8. when_boolean: ${with_nginx}
  9. - name: Install nginx configuration
  10. action: template src=nginx/nginx.conf.j2 dest=/etc/nginx/nginx.conf owner=root group=root mode=0644
  11. notify:
  12. - Restart nginx
  13. when_boolean: ${with_nginx}
  14. - name: Install additional nginx configuration params (conf.d/)
  15. action: template src=nginx/conf.d/${item}.conf.j2 dest=/etc/nginx/conf.d/${item}.conf owner=root group=root mode=0644
  16. with_items:
  17. - status
  18. notify:
  19. - Reload nginx
  20. when_boolean: ${with_nginx}
  21. - name: Install additional nginx configuration params (vhost_*)
  22. action: template src=nginx/vhost_${item}.j2 dest=/etc/nginx/vhost_${item} owner=root group=root mode=0644
  23. with_items:
  24. - all
  25. - expires
  26. - cache-fd
  27. - protect-files
  28. notify:
  29. - Reload nginx
  30. when_boolean: ${with_nginx}
  31. - name: Ensure nginx is running
  32. action: service name=nginx state=started
  33. when_boolean: ${with_nginx}