Website/.ansible-items/playbook.yml
shirito 4bb11f731c
All checks were successful
continuous-integration/drone/push Build is passing
feat: Add passphrase capabilities for SSH key (#11)
We can now use encrypted SSH keys in the pipeline.
The new secret is `deploy_ssh_key_passphrase`

The documentation has been updated accordingly

Co-authored-by: Ereshkigal <ereshkigal@noreply.dev.sp-tarkov.com>
Reviewed-on: SPT-AKI/Website#11
Co-authored-by: shirito <shirito@noreply.dev.sp-tarkov.com>
Co-committed-by: shirito <shirito@noreply.dev.sp-tarkov.com>
2021-11-04 01:21:44 +00:00

49 lines
1.5 KiB
YAML

---
- name: install and configure PHP8 and composer
hosts: sptarkov
tasks:
- name: Delete spt-items-api before adding everything again
file:
state: absent
path: "{{ lookup('env', 'SPT_ITEMS_PATH') }}"
- name: Copy the project
copy:
src: ../items/api/
dest: "{{ lookup('env', 'SPT_ITEMS_PATH') }}"
- name: Copy PHP .env file
template:
src: ./templates/.php-env.j2
dest: "{{ lookup('env', 'SPT_ITEMS_PATH') }}/.env"
- name: Get JS chunks name
shell:
cmd: find "{{ lookup('env', 'SPT_ITEMS_PATH') }}" -type f -name "*chunk.js" -printf "%f\n"
register: find_output
- name: Get file names from find output
set_fact:
chunk_list: "{{ find_output['stdout'].split('\n') }}"
- name: Copy app.blade.php file
template:
src: ./templates/app.blade.php.j2
dest: "{{ lookup('env', 'SPT_ITEMS_PATH') }}/resources/views/app.blade.php"
- name: Download and installs all composer libs and dependencies
community.general.composer:
command: install
working_dir: "{{ lookup('env', 'SPT_ITEMS_PATH') }}"
# Ensure the permissions
- name: Reset files permissions
file:
path: "{{ lookup('env', 'SPT_ITEMS_PATH') }}"
owner: "{{ lookup('env', 'DEPLOY_USER') }}"
group: "{{ lookup('env', 'DEPLOY_USER_GROUP') }}"
mode: 0774
recurse: yes
- name: Initialize database
uri:
url: "https://{{ lookup('env', 'SPT_ITEMS_HOSTNAME') }}/api/refresh"
method: GET
status_code: [200, 204]
timeout: 60