Add more tasks
This commit is contained in:
parent
49d9ab242e
commit
27a88a719f
4 changed files with 133 additions and 0 deletions
74
roles/transip_client/tasks/main.yml
Normal file
74
roles/transip_client/tasks/main.yml
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
- name: load OS specific vars
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- files:
|
||||
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_release|lower }}.yml"
|
||||
- "{{ ansible_distribution|lower }}.yml"
|
||||
- "{{ ansible_os_family|lower }}.yml"
|
||||
paths:
|
||||
- "{{ role_path }}/vars"
|
||||
|
||||
- name: install packages
|
||||
become: true
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
loop: "{{ packages }}"
|
||||
|
||||
- name: clone project
|
||||
git:
|
||||
repo: "{{ app_url }}"
|
||||
dest: "{{ app_dir }}"
|
||||
version: "{{ app_branch }}"
|
||||
update: yes
|
||||
|
||||
- name: include poetry tasks
|
||||
include_role:
|
||||
name: common
|
||||
tasks_from: "poetry.yml"
|
||||
vars:
|
||||
poetry_user: "{{ ansible_user_id }}"
|
||||
poetry_dir: "{{ ansible_env.HOME }}/.poetry"
|
||||
|
||||
- name: run poetry tasks
|
||||
block:
|
||||
- name: retrieve user $PATH
|
||||
shell: "echo $PATH"
|
||||
register: path_stats
|
||||
|
||||
- name: set poetry user variables
|
||||
set_fact:
|
||||
poetry_user_path: "{{ path_stats.stdout }}"
|
||||
|
||||
- name: set default venv python version
|
||||
command: "poetry env use python3.7"
|
||||
args:
|
||||
chdir: "{{ app_dir }}"
|
||||
environment:
|
||||
PATH: "/home/{{ app_user }}/.local/bin:{{ poetry_user_path }}"
|
||||
|
||||
- name: install project dependencies
|
||||
command:
|
||||
argv:
|
||||
- "poetry install"
|
||||
- "--no-dev"
|
||||
args:
|
||||
chdir: "{{ app_dir }}"
|
||||
environment:
|
||||
PATH: "/home/{{ app_user }}/.local/bin:{{ poetry_user_path }}"
|
||||
|
||||
# TODO add service/timer
|
||||
- name: copy systemd templates
|
||||
template:
|
||||
loop:
|
||||
- {
|
||||
src: "timer.j2",
|
||||
dest: "{{ systemd_dir }}/transip_client.timer",
|
||||
mode: "0644",
|
||||
}
|
||||
- {
|
||||
src: "service.j2",
|
||||
dest: "{{ systemd_dir }}/transip_client.service",
|
||||
mode: "0644",
|
||||
}
|
||||
notify: enable transip_client timer
|
||||
Reference in a new issue