main.yml 734 B

123456789101112131415161718192021222324252627282930313233
  1. ---
  2. # Variable setup.
  3. - name: Include OS-specific variables.
  4. include_vars: "{{ ansible_os_family }}.yml"
  5. - name: Define nginx_user.
  6. set_fact:
  7. nginx_user: "{{ __nginx_user }}"
  8. when: nginx_user is not defined
  9. # Setup/install tasks.
  10. - include: setup-RedHat.yml
  11. when: ansible_os_family == 'RedHat'
  12. - include: setup-Debian.yml
  13. when: ansible_os_family == 'Debian'
  14. # Vhost configuration.
  15. - include: vhosts.yml
  16. # Nginx setup.
  17. - name: Copy nginx configuration in place.
  18. template:
  19. src: nginx.conf.j2
  20. dest: /etc/nginx/nginx.conf
  21. owner: root
  22. group: root
  23. mode: 0644
  24. notify:
  25. - reload nginx
  26. - name: Ensure nginx is started and enabled to start at boot.
  27. service: name=nginx state=started enabled=yes