2021-07-19 07:03:05 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: '[APT] - Install dependencies'
|
|
|
|
apt:
|
|
|
|
name: "{{ lacre_apt }}"
|
|
|
|
update_cache: yes
|
|
|
|
|
2022-05-09 23:43:14 +02:00
|
|
|
- name: '[Install] - Make sure Lacre home exists'
|
2021-07-19 07:03:05 +02:00
|
|
|
file:
|
|
|
|
path: '{{ lacre_homedir }}'
|
|
|
|
state: directory
|
|
|
|
owner: '{{ lacre_username }}'
|
|
|
|
group: '{{ lacre_group }}'
|
|
|
|
|
2022-05-09 23:43:14 +02:00
|
|
|
- name: '[Install] - Make sure Lacre .gnupg dir exists'
|
2021-07-19 07:03:05 +02:00
|
|
|
file:
|
|
|
|
path: '{{ lacre_homedir }}/.gnupg'
|
|
|
|
state: directory
|
|
|
|
owner: '{{ lacre_username }}'
|
|
|
|
group: '{{ lacre_group }}'
|
2022-05-09 23:43:14 +02:00
|
|
|
mode: '700'
|
2021-07-19 07:03:05 +02:00
|
|
|
|
2022-05-09 23:43:14 +02:00
|
|
|
- name: '[Install] - Make sure Lacre smime dir exists'
|
2021-07-19 07:03:05 +02:00
|
|
|
file:
|
|
|
|
path: '{{ lacre_homedir }}/smime'
|
|
|
|
state: directory
|
|
|
|
owner: '{{ lacre_username }}'
|
|
|
|
group: '{{ lacre_group }}'
|
2022-05-09 23:43:14 +02:00
|
|
|
mode: '700'
|
2023-09-25 21:53:33 +02:00
|
|
|
|
|
|
|
- name: '[Install] - Create a symbolic link to python binary'
|
|
|
|
file:
|
2024-02-19 00:02:00 +01:00
|
|
|
src: '/usr/bin/python{{ lacre_python_version }}'
|
2023-09-25 21:53:33 +02:00
|
|
|
dest: '/usr/bin/python'
|
|
|
|
state: 'link'
|
|
|
|
|
|
|
|
- name: '[INSTALL] - Install lacre backend requirenments'
|
|
|
|
pip:
|
|
|
|
requirements: "{{ lacre_app_dir }}/requirements.txt"
|
2024-02-19 00:02:00 +01:00
|
|
|
virtualenv: '{{ lacre_homedir }}/venv'
|
|
|
|
virtualenv_site_packages: yes
|
2021-07-19 07:03:05 +02:00
|
|
|
|
2022-05-09 23:43:14 +02:00
|
|
|
- name: '[Install] - Link GnuPG Lacre to global python modules'
|
2021-07-19 07:03:05 +02:00
|
|
|
file:
|
|
|
|
src: '{{ lacre_app_dir }}/GnuPG'
|
2024-02-19 00:02:00 +01:00
|
|
|
dest: '{{ lacre_homedir }}/venv/lib/python{{ lacre_python_version }}/site-packages/GnuPG'
|
2021-07-19 07:03:05 +02:00
|
|
|
state: link
|
|
|
|
|
2022-05-14 08:41:36 +02:00
|
|
|
|
|
|
|
- name: '[Install] - Link Lacre module to global python modules'
|
|
|
|
file:
|
|
|
|
src: '{{ lacre_app_dir }}/lacre'
|
2024-02-19 00:02:00 +01:00
|
|
|
dest: '{{ lacre_homedir }}/venv/lib/python{{ lacre_python_version }}/site-packages/lacre'
|
2022-05-14 08:41:36 +02:00
|
|
|
state: link
|
2022-10-18 13:30:40 +02:00
|
|
|
|
|
|
|
- name: '[INSTALL] - Set cron file permission'
|
|
|
|
file:
|
|
|
|
path: '{{ lacre_app_dir }}/webgate-cron.py'
|
|
|
|
state: 'file'
|
|
|
|
mode: 'a+x'
|
|
|
|
owner: '{{ lacre_username }}'
|
|
|
|
group: '{{ lacre_group }}'
|
|
|
|
when: lacre_webgate_cron == 'true'
|
|
|
|
|
|
|
|
- name: '[INSTALL] - Set cron'
|
|
|
|
cron:
|
|
|
|
name: "Lacre-webgate cronjob"
|
|
|
|
state: present
|
|
|
|
minute: "*/3"
|
|
|
|
hour: "*"
|
|
|
|
day: "*"
|
|
|
|
month: "*"
|
|
|
|
weekday: "*"
|
|
|
|
user: "{{ lacre_username }}"
|
|
|
|
job: '{{ lacre_app_dir }}/webgate-cron.py > /dev/null'
|
|
|
|
when: lacre_webgate_cron == 'true'
|
2024-02-19 00:02:00 +01:00
|
|
|
|
|
|
|
- name: Check if the database exists
|
|
|
|
shell:
|
|
|
|
cmd: mysql -h {{ lacre_db_host }} -u {{ lacre_db_username }} -p{{ lacre_db_password }} {{ lacre_db_name }} -se "SHOW TABLES";
|
|
|
|
register: lacre_db_info
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
## Temporary tasks for deploying db
|
|
|
|
- name: '[INSTALL] - Copy script with dbschema'
|
|
|
|
copy:
|
|
|
|
src: files/temp_dbschema.py
|
|
|
|
dest: '/tmp/temp_dbschema.py'
|
|
|
|
|
|
|
|
- name: '[INSTALL] - Run dbschema'
|
|
|
|
shell:
|
|
|
|
cmd: '{{ lacre_homedir }}/venv/bin/python{{ lacre_python_version }} /tmp/temp_dbschema.py'
|
|
|
|
become: 'yes'
|
|
|
|
become_user: '{{ lacre_username }}'
|
|
|
|
|
|
|
|
#####
|