main.yml 894 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. - include: setup-FreeBSD.yml
  17. when: ansible_os_family == 'FreeBSD'
  18. # Vhost configuration.
  19. - include: vhosts.yml
  20. # Nginx setup.
  21. - name: Copy nginx configuration in place.
  22. template:
  23. src: nginx.conf.j2
  24. dest: "{{ nginx_conf_file_path }}"
  25. owner: root
  26. group: "{{ root_group }}"
  27. mode: 0644
  28. notify:
  29. - reload nginx
  30. - name: Ensure nginx is started and enabled to start at boot.
  31. service: name=nginx state=started enabled=yes