From 2f50f503e4eb15aea1790cbf106d114d68763a3d Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Sat, 5 Jun 2021 15:13:46 +0200 Subject: [PATCH] Apply fixes --- tasks.yml | 17 +++++++++++------ templates/service.j2 | 5 +---- templates/timer.j2 | 3 ++- vars/main.yml | 5 +++-- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/tasks.yml b/tasks.yml index 5eed820..5f95e36 100644 --- a/tasks.yml +++ b/tasks.yml @@ -38,12 +38,9 @@ PATH: '/home/{{ app_user }}/.local/bin:{{ poetry_user_path }}' - name: install project dependencies - command: - argv: - - 'poetry install' - - '--no-dev' - args: - chdir: '{{ app_dir }}' + command: 'poetry install --no-dev' + args: + chdir: '{{ app_dir }}' environment: PATH: '/home/{{ app_user }}/.local/bin:{{ poetry_user_path }}' @@ -53,8 +50,16 @@ dest: '{{ app_dir }}/.env' mode: 0600 +- name: create systemd user directory + file: + path: '{{ systemd_dir }}' + state: 'directory' + - name: copy systemd templates template: + src: '{{ item.src }}' + dest: '{{ item.dest }}' + mode: '{{ item.mode }}' loop: - { src: 'templates/timer.j2', diff --git a/templates/service.j2 b/templates/service.j2 index d696ce7..1cacd27 100644 --- a/templates/service.j2 +++ b/templates/service.j2 @@ -7,8 +7,5 @@ Description=Transip-client service [Service] EnvironmentFile={{ app_dir }}/.env WorkingDirectory={{ app_dir }} -ExecStart=poetry run listen +ExecStart={{ ansible_env.HOME }}/.local/bin/poetry run listen Type=oneshot - -[Install] -WantedBy=default.target diff --git a/templates/timer.j2 b/templates/timer.j2 index 9f07fb2..a8571ea 100644 --- a/templates/timer.j2 +++ b/templates/timer.j2 @@ -5,7 +5,8 @@ Description=Trans IP client timer [Timer] -OnCalendar=+5min +OnBootSec=15min +OnUnitActiveSec=5min Unit=transip-client.service Persistent=true diff --git a/vars/main.yml b/vars/main.yml index bebd0da..612111f 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,4 +1,5 @@ app_url: 'https://git.fudiggity.nl/sonny/transip_client.git' +app_user: 'sonny' app_branch: '0.3.1' app_dir: '{{ ansible_env.HOME }}/apps/transip_client' app_domains: @@ -44,7 +45,7 @@ app_token: !vault | 61353763326432313934363132353738323437366537383763313361636165353165353566396261 6237 -systemd_dir: '{{ ansible_user_id }}/.config/systemd/user' +systemd_dir: '{{ ansible_env.HOME }}/.config/systemd/user' sentry_dsn: !vault | $ANSIBLE_VAULT;1.1;AES256 @@ -60,4 +61,4 @@ packages: - python3 - python3-dev - python3-venv - - dns-utils + - getdns-utils