54 lines
1.5 KiB
YAML
54 lines
1.5 KiB
YAML
---
|
|
|
|
- name: Install dependencies
|
|
ansible.builtin.package:
|
|
name: "python3-venv"
|
|
state: present
|
|
|
|
- name: Check if .gitignore contains "{{ path_yealink_utilities }}"
|
|
ansible.builtin.command: grep "directory = {{ path_yealink_utilities }}" /root/.gitconfig
|
|
register: gitignore_check
|
|
ignore_errors: true
|
|
|
|
- name: "Patch /root/.gitconfig"
|
|
ansible.builtin.command: |-
|
|
git config --global --add safe.directory {{ path_yealink_utilities }}
|
|
when: gitignore_check.rc != 0
|
|
|
|
- name: Clone Yealink Utilities
|
|
ansible.builtin.git: # noqa: latest
|
|
repo: "{{ repo_utilities }}"
|
|
dest: "{{ path_yealink_utilities }}"
|
|
force: true
|
|
accept_hostkey: true
|
|
key_file: "{{ deploy_key_file }}"
|
|
|
|
- name: Ensure directory permissions
|
|
ansible.builtin.file:
|
|
path: "{{ path_yealink_utilities }}"
|
|
state: directory
|
|
recurse: true
|
|
owner: "{{ asterisk_user }}"
|
|
group: "{{ asterisk_group }}"
|
|
|
|
- name: Install specified python requirements in indicated (virtualenv)
|
|
ansible.builtin.pip:
|
|
requirements: "{{ path_yealink_utilities }}/requirements.txt"
|
|
virtualenv: "{{ path_yealink_utilities }}/.venv"
|
|
virtualenv_command: 'python3 -m venv'
|
|
|
|
- name: Install systemd unit
|
|
ansible.builtin.template:
|
|
src: yealink-utilities.service.j2
|
|
dest: /etc/systemd/system/yealink-utilities.service
|
|
mode: "0644"
|
|
notify:
|
|
- Reload systemd
|
|
- Restart yealink-utilities
|
|
|
|
- name: Enable yealink-utilities
|
|
ansible.builtin.service:
|
|
name: yealink-utilities
|
|
state: started
|
|
enabled: true
|