main.yml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. - name: Creates deploy directory
  2. become: true
  3. file:
  4. path: "/var/www/{{ inventory_hostname }}"
  5. state: directory
  6. owner: "{{ ansible_user }}"
  7. - name: Git checkout source code
  8. ansible.builtin.git:
  9. repo: 'https://github.com/iapt-platform/mint.git'
  10. dest: "{{ app_deploy_target }}"
  11. version: laravel
  12. - name: Setup storage folder
  13. become: true
  14. ansible.builtin.file:
  15. path: "{{ app_deploy_target }}/storage"
  16. state: directory
  17. recurse: true
  18. owner: www-data
  19. group: www-data
  20. - name: Install v2 php dependencies
  21. ansible.builtin.shell: "php{{ app_php_version }} {{ ansible_env.HOME }}/.local/bin/composer install"
  22. args:
  23. chdir: "{{ app_deploy_target }}"
  24. - name: Install v2 nodejs dependencies
  25. # ansible.builtin.file:
  26. # src: "/var/www/{{ inventory_hostname }}/node_modules/v2"
  27. # dest: "{{ app_deploy_target }}/node_modules"
  28. # state: link
  29. ansible.builtin.shell: npm install
  30. args:
  31. chdir: "{{ app_deploy_target }}"
  32. # TODO will remove in future
  33. - name: Install v1 php dependencies
  34. ansible.builtin.shell: "php{{ app_php_version }} {{ ansible_env.HOME }}/.local/bin/composer install"
  35. args:
  36. chdir: "{{ app_deploy_target }}/public"
  37. # TODO will remove in future
  38. - name: Install v1 nodejs dependencies
  39. # ansible.builtin.file:
  40. # src: "/var/www/{{ inventory_hostname }}/node_modules/v1"
  41. # dest: "{{ app_deploy_target }}/public/node_modules"
  42. # state: link
  43. ansible.builtin.shell: npm install
  44. args:
  45. chdir: "{{ app_deploy_target }}/public"
  46. # TODO will remove in future
  47. - name: Install v1 tmp
  48. ansible.builtin.file:
  49. src: "/var/www/{{ inventory_hostname }}/tmp"
  50. dest: "{{ app_deploy_target }}/public/tmp"
  51. state: link
  52. - name: .env(v2)
  53. become: true
  54. ansible.builtin.template:
  55. src: env-v2.j2
  56. dest: "{{ app_deploy_target }}/.env"
  57. owner: www-data
  58. group: www-data
  59. mode: '0400'
  60. # TODO will remove in future
  61. - name: config.php(v1)
  62. become: true
  63. ansible.builtin.template:
  64. src: config-v1.php.j2
  65. dest: "{{ app_deploy_target }}/public/app/config.php"
  66. owner: www-data
  67. group: www-data
  68. mode: '0400'
  69. # TODO will remove in future
  70. - name: config.js(v1)
  71. become: true
  72. ansible.builtin.template:
  73. src: config-v1.js.j2
  74. dest: "{{ app_deploy_target }}/public/app/config.js"
  75. owner: www-data
  76. group: www-data
  77. mode: '0400'
  78. - name: Create a current link
  79. ansible.builtin.file:
  80. src: "{{ app_deploy_target }}"
  81. dest: /var/www/{{ inventory_hostname }}/current
  82. state: link