main.yml 804 B

123456789101112131415161718192021222324252627282930313233343536
  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-Ubuntu.yml
  13. when: ansible_distribution == 'Ubuntu'
  14. - include: setup-Debian.yml
  15. when: ansible_os_family == 'Debian'
  16. # Vhost configuration.
  17. - include: vhosts.yml
  18. # Nginx setup.
  19. - name: Copy nginx configuration in place.
  20. template:
  21. src: nginx.conf.j2
  22. dest: /etc/nginx/nginx.conf
  23. owner: root
  24. group: root
  25. mode: 0644
  26. notify:
  27. - reload nginx
  28. - name: Ensure nginx is started and enabled to start at boot.
  29. service: name=nginx state=started enabled=yes