main.yml 706 B

12345678910111213141516171819202122232425262728293031
  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. # Nginx setup.
  15. - name: Copy nginx configuration in place.
  16. template:
  17. src: nginx.conf.j2
  18. dest: /etc/nginx/nginx.conf
  19. owner: root
  20. group: root
  21. mode: 0644
  22. notify: restart nginx
  23. - name: Ensure nginx is started and enabled to start at boot.
  24. service: name=nginx state=started enabled=yes
  25. - include: vhosts.yml