1
0
forked from infra/ansible
infra/roles/heisenbridge/tasks/main.yml

57 lines
1.3 KiB
YAML
Raw Normal View History

2023-09-06 21:37:39 +02:00
---
- name: Install dependencies
apt:
name:
- python3-pip
- python3-venv
- name: Create group
group:
name: "{{ heisenbridge_group }}"
system: yes
- name: Create user
user:
name: "{{ heisenbridge_user }}"
group: "{{ heisenbridge_group }}"
system: yes
create_home: no
home: "{{ heisenbridge_directory }}"
- name: Create directory
file:
path: "{{ heisenbridge_directory }}"
state: directory
owner: "{{ heisenbridge_user }}"
group: "{{ heisenbridge_group }}"
mode: 0755
- name: Install heisenbridge
pip:
name: heisenbridge
virtualenv: "{{ heisenbridge_directory }}"
virtualenv_command: python3 -m venv
become: true
become_user: "{{ heisenbridge_user }}"
environment:
MULTIDICT_NO_EXTENSIONS: 1
YARL_NO_EXTENSIONS: 1
- name: Create configuration
command:
cmd: "{{ heisenbridge_directory }}/bin/heisenbridge -c {{ heisenbridge_config }} --generate"
creates: "{{ heisenbridge_config }}"
become: true
become_user: "{{ heisenbridge_user }}"
notify: Restart heisenbridge
- name: Install systemd unit
template: src=heisenbridge.service.j2 dest=/lib/systemd/system/heisenbridge.service
notify:
- Reload systemd
- Restart heisenbridge
- name: Enable heisenbridge
service: name=heisenbridge enabled=yes