Playbooks to a new Lilik
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.0 KiB

8 years ago
8 years ago
8 years ago
8 years ago
  1. ---
  2. - include_role:
  3. name: service
  4. vars:
  5. service_name: nginx
  6. service_packages:
  7. - nginx
  8. - name: disable nginx default configuration
  9. file:
  10. path: /etc/nginx/sites-enabled/default
  11. state: absent
  12. notify: restart nginx
  13. - name: create nginx location configuration directory
  14. file:
  15. path: '{{ item }}'
  16. state: directory
  17. mode: 0755
  18. owner: www-data
  19. group: www-data
  20. with_items:
  21. - /etc/nginx/locations/
  22. - '/etc/nginx/locations/{{ server_fqdn }}/'
  23. - name: upload nginx configuration
  24. template:
  25. src: base.j2
  26. dest: "/etc/nginx/sites-available/{{ server_fqdn }}.conf"
  27. notify:
  28. - restart nginx
  29. - name: create Diffie Hellman exchange parameters
  30. command: openssl dhparam -out /etc/nginx/dhparam.pem 2048
  31. args:
  32. creates: /etc/nginx/dhparam.pem
  33. notify: restart nginx
  34. - name: enable nginx configurations
  35. file:
  36. src: "/etc/nginx/sites-available/{{ server_fqdn }}.conf"
  37. dest: "/etc/nginx/sites-enabled/{{ server_fqdn }}.conf"
  38. state: link
  39. notify: restart nginx