main.yml 2.6 KB

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