main.yml 963 B

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