2023-07-30 00:19:36 +00:00
|
|
|
---
|
|
|
|
- name: Avoid running as root
|
|
|
|
ansible.builtin.pause:
|
|
|
|
prompt: "Please run this role as a regular user with sudo/doas privileges. Or press enter to continue anyway (not recommended)."
|
|
|
|
when: ansible_user_id == 'root'
|
|
|
|
|
|
|
|
- name: Clone git repository
|
|
|
|
ansible.builtin.git:
|
|
|
|
repo: https://github.com/hoytech/strfry.git
|
|
|
|
dest: "{{ ansible_env.HOME }}/src/strfry"
|
|
|
|
version: "{{ strfry_version }}"
|
|
|
|
force: yes # required to avoid weird error when updating submodules via Ansible
|
|
|
|
register: git_repository
|
|
|
|
|
|
|
|
- name: Update git submodule (golpe)
|
|
|
|
ansible.builtin.command:
|
|
|
|
cmd: git submodule update --init
|
|
|
|
chdir: "{{ ansible_env.HOME }}/src/strfry"
|
2023-09-25 15:03:34 +00:00
|
|
|
when: git_repository.changed
|
2023-08-03 15:49:38 +00:00
|
|
|
changed_when: git_repository.changed
|
2023-07-30 00:19:36 +00:00
|
|
|
|
|
|
|
- name: Run make setup-golpe
|
|
|
|
ansible.builtin.command:
|
|
|
|
cmd: make setup-golpe
|
|
|
|
chdir: "{{ ansible_env.HOME }}/src/strfry"
|
2023-09-25 15:03:34 +00:00
|
|
|
when: git_repository.changed
|
2023-08-03 15:49:38 +00:00
|
|
|
changed_when: git_repository.changed
|
2023-07-30 00:19:36 +00:00
|
|
|
|
|
|
|
- name: Build strfry
|
|
|
|
ansible.builtin.command:
|
|
|
|
cmd: "make -j{{ strfry_make_jobs|default(1) }}"
|
|
|
|
chdir: "{{ ansible_env.HOME }}/src/strfry"
|
2023-09-25 15:03:34 +00:00
|
|
|
when: git_repository.changed
|
|
|
|
changed_when: git_repository.changed
|
|
|
|
|
2024-06-08 19:39:29 +00:00
|
|
|
- name: Check if strfry data path exists
|
|
|
|
ansible.builtin.stat:
|
2024-10-29 21:48:10 +00:00
|
|
|
path: "{{ strfry_data_path }}/{{ strfry_db }}/data.mdb"
|
2024-06-08 19:39:29 +00:00
|
|
|
register: strfry_data_path_stat
|
2024-10-29 21:48:10 +00:00
|
|
|
failed_when: false
|
2024-06-08 19:39:29 +00:00
|
|
|
|
2023-09-25 15:03:34 +00:00
|
|
|
- name: Backup existing strfry-db
|
|
|
|
ansible.builtin.shell:
|
|
|
|
cmd: strfry export > backup.jsonl
|
2024-06-08 19:39:29 +00:00
|
|
|
chdir: "{{ strfry_data_path }}"
|
2023-09-25 15:03:34 +00:00
|
|
|
become: yes
|
|
|
|
become_user: "{{ strfry_system_user }}"
|
2024-06-08 19:39:29 +00:00
|
|
|
when: git_repository.changed and strfry_data_path_stat.stat.exists
|
2023-08-03 15:49:38 +00:00
|
|
|
changed_when: git_repository.changed
|