Add more tasks
This commit is contained in:
parent
49d9ab242e
commit
27a88a719f
4 changed files with 133 additions and 0 deletions
4
roles/requirements.yml
Normal file
4
roles/requirements.yml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
- src: git+https://git.fudiggity.nl/ansible/common.git
|
||||
name: common
|
||||
version: master
|
||||
scm: git
|
||||
50
roles/transip_client/defaults/main.yml
Normal file
50
roles/transip_client/defaults/main.yml
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
app_url: "https://git.fudiggity.nl/sonny/transip_client.git"
|
||||
app_branch: "0.2"
|
||||
app_dir: "{{ ansible_env.HOME }}/apps/transip_client"
|
||||
|
||||
app_token: !vault |
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
32373336636130626631343966643630343134393631326466656161393235383337303561323064
|
||||
3236616338666666323835343163363531653465653137640a633963356439373963356165306131
|
||||
66313766343835396637303363653466353339616161326663623731326534333636323565643332
|
||||
6533333562653338390a393435353064383563623561646632303830346262386263636431653164
|
||||
31316434656139663262666539656530386634636433366539376333363734316133643635616666
|
||||
65663637303664346630356336616662653939303961666230376266656534386430383931643533
|
||||
39383031653861613231343133393632613236646365656365316436393034333536383237623032
|
||||
38393463316661643934663433653030383338306338383434653066383339343565343031636132
|
||||
37333363346538613161396636366539356432323862396337363963343866643366313331646365
|
||||
31653130346431323163393132353661383639393565353239643965653037633737303763336131
|
||||
39336633626432343537656332353461653130633431363035373130653066306663323934383532
|
||||
32353363383965666635646337343237636666623265393138393836366233643334373463306230
|
||||
64353636363931306130633733393631633134333030393735366565636439663630656435313234
|
||||
39623333356136623235373963323561656364353363316263343137643566346139653035653164
|
||||
37376462613038326666616563613738393432373539386636323165663464653664316164613664
|
||||
65313363343366366531316564313832623166376165353330323930613132616234313633333133
|
||||
38323366336634653661333964373633396438316630656263656532623864373738393965303936
|
||||
65303238396238323538613664363931306663313436623837633631353434626436616261653462
|
||||
33383665373636613738396361306166653132343733663230303661613263643538653732356630
|
||||
36333961383835376133333532393163303939356238323162666436666661316636373961646162
|
||||
62633565653962373537383666356531323538386134363234373265363563366162343837376663
|
||||
65396132626435333035383937613066646430633130323261326466313036636631626535393634
|
||||
34613537326333633665363135633739393966383635313633626335366439333734333837353636
|
||||
34633531616536646336336138376334643963383863316537366163323030613239613737393939
|
||||
38633362633461363738343536306234343464646436313464633631316432333434343661343033
|
||||
35643033303664356437623334303130623666633262613536663533656564356137386537356237
|
||||
33636633653034346136383261653730393062616664336439303535386634393564333239613335
|
||||
62383563653662383565663739623635323836646133613065306632613436643332323935666334
|
||||
65353735633132356335343437656564383361393065643730393234623162626163346630633935
|
||||
34663336316230623963393432346331353438386238306166353333643366396562343561363635
|
||||
35383763323932616334643331613865626332306666316534666533613132386537343737363064
|
||||
39353864366438646563633731616136623431366362646134306634613665343965343237353261
|
||||
38393630396461386132613238306438643337306139393036373131356639326462646264326466
|
||||
66303630316266363466316533653037306636616135363061633432393166626433393664666361
|
||||
35663964633839353136643666653738343431353461623033643033666234343233333131316534
|
||||
33353665303363373734303165363438373431336365636530633163303730393830393464633466
|
||||
6239
|
||||
app_domains:
|
||||
- fudiggity.nl
|
||||
|
||||
systemd_dir: "{{ ansible_user_id }}/.config/systemd/user"
|
||||
|
||||
packages: []
|
||||
skip_common_setup: true
|
||||
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
|
||||
5
roles/transip_client/vars/debian-buster.yml
Normal file
5
roles/transip_client/vars/debian-buster.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
packages:
|
||||
- python3
|
||||
- python3-dev
|
||||
- python3-venv
|
||||
- dns-utils
|
||||
Reference in a new issue