56 lines
1.6 KiB
YAML
56 lines
1.6 KiB
YAML
---
|
|
- name: "Install | Check for latest version"
|
|
ansible.builtin.shell:
|
|
cmd: curl -sL "{{ dmarcsrg_github_api_url }}" | jq -r ".tag_name"
|
|
changed_when: false
|
|
register: latest_version
|
|
|
|
- name: "Install | Get download URL"
|
|
ansible.builtin.shell:
|
|
cmd: curl -sL "{{ dmarcsrg_github_api_url }}" | jq -r ".tarball_url"
|
|
changed_when: false
|
|
register: download_url
|
|
|
|
- name: "Install | Create directories"
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
mode: "0755"
|
|
loop:
|
|
- "{{ dmarcsrg_home }}"
|
|
- "{{ dmarcsrg_home }}/{{ latest_version.stdout }}"
|
|
- "{{ overrides_path }}"
|
|
|
|
- name: "Install | Download install files"
|
|
ansible.builtin.unarchive:
|
|
src: "{{ download_url.stdout }}"
|
|
dest: "{{ dmarcsrg_home }}/{{ latest_version.stdout }}"
|
|
remote_src: true
|
|
extra_opts:
|
|
- "--strip-components=1"
|
|
|
|
- name: "Install | Copy configuration file"
|
|
ansible.builtin.template:
|
|
src: conf.php.j2
|
|
dest: "{{ overrides_path }}/conf.php"
|
|
mode: "0640"
|
|
owner: "{{ dmarcsrg_user }}"
|
|
group: "{{ dmarcsrg_user }}"
|
|
|
|
- name: "Install | Link data"
|
|
ansible.builtin.file:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
state: link
|
|
loop:
|
|
- src: "{{ dmarcsrg_home }}/{{ latest_version.stdout }}"
|
|
dest: "{{ dmarcsrg_home }}/current"
|
|
- src: "{{ overrides_path }}/conf.php"
|
|
dest: "{{ dmarcsrg_home }}/{{ latest_version.stdout }}/config/conf.php"
|
|
|
|
- name: "Install | Initiate database"
|
|
ansible.builtin.command:
|
|
cmd: php utils/database_admin.php init
|
|
chdir: "{{ dmarcsrg_home }}/current"
|
|
become: true
|
|
become_user: "{{ dmarcsrg_user }}"
|