main.yml 1019 B

1234567891011121314151617181920212223242526272829303132333435
  1. - name: Create nginx logs folder
  2. become: true
  3. ansible.builtin.file:
  4. path: "{{ app_deploy_target | dirname }}/logs/nginx"
  5. state: directory
  6. owner: www-data
  7. mode: "0755"
  8. - name: Upload nginx-fpm.sh
  9. become: true
  10. ansible.builtin.template:
  11. src: fpm.conf.j2
  12. dest: /etc/nginx/sites-enabled/php-fpm-{{ app_php_fpm_port }}.conf
  13. mode: "0644"
  14. force: false
  15. - name: Upload nginx.conf
  16. become: true
  17. ansible.builtin.template:
  18. src: nginx.conf.j2
  19. dest: /etc/nginx/sites-enabled/{{ app_domain }}.conf
  20. mode: "0644"
  21. force: false
  22. - name: Set document root
  23. become: true
  24. ansible.builtin.shell: sed -i '5s#.*#root {{ app_deploy_target }}/api-v8/public;#' /etc/nginx/sites-enabled/{{ app_domain }}.conf
  25. - name: Set dashboard alias
  26. become: true
  27. ansible.builtin.shell: sed -i '25s#.*#alias {{ app_deploy_target }}/dashboard-v4/dashboard/dist/;#' /etc/nginx/sites-enabled/{{ app_domain }}.conf
  28. - name: Reload nginx.conf
  29. become: true
  30. ansible.builtin.shell: nginx -s reload