main.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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: Install v2 php dependencies
  13. ansible.builtin.shell: "{{ ansible_env.HOME }}/.local/bin/composer install"
  14. args:
  15. chdir: "{{ app_deploy_target }}"
  16. # - name: Install v2 nodejs dependencies
  17. # ansible.builtin.shell: npm install
  18. # args:
  19. # chdir: "{{ app_deploy_target }}"
  20. - name: Install v2 nodejs dependencies
  21. ansible.builtin.file:
  22. src: "/var/www/{{ inventory_hostname }}/node_modules/v2"
  23. dest: "{{ app_deploy_target }}/node_modules"
  24. state: link
  25. # TODO will remove in future
  26. - name: Install v1 php dependencies
  27. ansible.builtin.shell: "{{ ansible_env.HOME }}/.local/bin/composer install"
  28. args:
  29. chdir: "{{ app_deploy_target }}/public"
  30. # TODO will remove in future
  31. # - name: Install v1 nodejs dependencies
  32. # ansible.builtin.shell: npm install
  33. # args:
  34. # chdir: "{{ app_deploy_target }}/public"
  35. - name: Install v1 nodejs dependencies
  36. ansible.builtin.file:
  37. src: "/var/www/{{ inventory_hostname }}/node_modules/v1"
  38. dest: "{{ app_deploy_target }}/public/node_modules"
  39. state: link
  40. - name: Install tmp
  41. ansible.builtin.file:
  42. src: "/var/www/{{ inventory_hostname }}/tmp"
  43. dest: "{{ app_deploy_target }}/tmp"
  44. state: link
  45. - name: Install tmp
  46. ansible.builtin.file:
  47. src: "/var/www/{{ inventory_hostname }}/tmp"
  48. dest: "{{ app_deploy_target }}/public/tmp"
  49. state: link
  50. - name: .env(v2)
  51. become: true
  52. ansible.builtin.template:
  53. src: env-v2.j2
  54. dest: "{{ app_deploy_target }}/.env"
  55. owner: www-data
  56. group: www-data
  57. mode: '0400'
  58. # TODO will remove in future
  59. - name: config.php(v1)
  60. become: true
  61. ansible.builtin.template:
  62. src: config-v1.php.j2
  63. dest: "{{ app_deploy_target }}/public/app/config.php"
  64. owner: www-data
  65. group: www-data
  66. mode: '0400'
  67. # TODO will remove in future
  68. - name: config.js(v1)
  69. become: true
  70. ansible.builtin.template:
  71. src: config-v1.js.j2
  72. dest: "{{ app_deploy_target }}/public/app/config.js"
  73. owner: www-data
  74. group: www-data
  75. mode: '0400'
  76. # - name: Create a current link
  77. # ansible.builtin.file:
  78. # src: "{{ app_deploy_target }}"
  79. # dest: /var/www/{{ inventory_hostname }}/current
  80. # state: link