This repository has been archived by the owner on Jul 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook.yml
77 lines (67 loc) · 1.8 KB
/
playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
- name: Configure backend with project
hosts: backend
vars:
extra_path: /home/vagrant/.local/bin
tasks:
- name: Install pip via pacman
become: true
community.general.pacman:
name:
- python-pip
- cmake
- gcc
- nano
- postgresql-libs
state: present
update_cache: yes
- name: Update pip via pip
pip:
name: pip
extra_args: --upgrade pip
- name: 'Add {{ extra_path }} if PATH does not exist'
lineinfile:
path: ~/.bashrc
line: 'export PATH=$PATH:"{{ extra_path }}"'
insertafter: EOF
when: lookup('file', '~/.bashrc') is not search('^\s*PATH\s*=')
- name: 'Add {{ extra_path }} to PATH'
lineinfile:
path: ~/.bashrc
regexp: 'export PATH=(["])((?!.*?{{ extra_path }}).*?)(["])$'
line: 'export PATH=\1\2:{{ extra_path }}\3'
backrefs: yes
when: lookup('file', '~/.bashrc') is search('^\s*PATH\s*=')
- name: Copy app module
copy:
src: ./app/
dest: ~/app
- name: Copy requirements.txt
copy:
src: ./requirements.txt
dest: ~/requirements.txt
- name: Copy gunicorn configuration
copy:
src: ./gunicorn_conf.py
dest: ~/gunicorn_conf.py
- name: Copy start.sh
copy:
src: ./start.sh
dest: ~/start.sh
mode: '0755'
- name: Copy service spec
become: true
copy:
src: ./skyo.service
dest: /etc/systemd/system/skyo.service
- name: Install requirements.txt
pip:
requirements: ~/requirements.txt
extra_args: --no-cache-dir
- name: Start service
become: true
ansible.builtin.systemd:
daemon_reload: yes
name: skyo
state: started
enabled: no