-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.yml
116 lines (114 loc) · 3.67 KB
/
setup.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
- name: Setup the environment for development
hosts: localhost
vars_files:
- vars.yml
tasks:
- name: Copy in template .env
template:
src: env.j2
dest: .env
- name: Create data directory
ansible.builtin.file:
path: data
state: directory
mode: '0755'
- name: Create isochrone directory
ansible.builtin.file:
path: data/isochrone
state: directory
mode: '0755'
- name: Create places json
template:
src: places.json.j2
dest: data/isochrone/places.json
- name: Install open streetmap tools
become: false
yay:
name: 'osmctools'
state: present
with_items:
- 'osmctools'
- name: Enable docker service
become: true
systemd:
name: docker
enabled: yes
state: started
- name: Start geo jupyter
become: true
docker_container:
name: geo-jupyter
hostname: geo-jupyter
image: gboeing/osmnx
state: started
container_default_behavior: compatibility
user: root
env:
TZ: 'America/Edmonton'
NB_USER: ipreston
NB_UID: '1001'
NB_GID: '1002'
CHOWN_HOME: 'yes'
volumes:
- ./data:/home/jovyan/work/data
- ./notebooks:/home/jovyan/work/notebooks
published_ports:
- 8888:8888
command:
"jupyter lab --ip='0.0.0.0' --port=8888 --no-browser
--NotebookApp.token='' --NotebookApp.password='' --allow-root"
- name: Create crontab for daily mls run
become: true
become_user: ipreston
ansible.builtin.cron:
name: 'mls_scrape'
minute: '15'
hour: '1'
job:
"/usr/bin/env bash -c 'source /home/ipreston/git/wheretolive/.venv/bin/activate && python
/home/ipreston/git/wheretolive/scripts/daily_mls.py' > /dev/null 2>&1"
- name: Create crontab for daily rentfaster run
become: true
become_user: ipreston
ansible.builtin.cron:
name: 'rentfaster_scrape'
minute: '30'
hour: '1'
job:
'/home/ipreston/git/wheretolive/.venv/bin/python
/home/ipreston/git/wheretolive/scripts/daily_rfaster.py'
- name: Setup the hosted environment
hosts: mars
vars_files:
- vars.yml
tasks:
- name: Create where to live docker network
become: true
community.general.docker_network:
name: 'wheretolive_network'
- name: Start postgis container
become: true
docker_container:
name: wheretolive-postgis
hostname: wheretolive-postgis
image: postgis/postgis
user: 1000:1000
networks:
- name: 'wheretolive_network'
network_mode: 'wheretolive_network'
state: started
container_default_behavior: compatibility
env:
TZ: 'America/Edmonton'
PGID: '1000'
PUID: '1000'
UMASK_SET: '022'
POSTGRES_PASSWORD: '{{ env_vars.POSTGIS_PASS }}'
restart_policy: unless-stopped
volumes:
- '/home/ansible/docker_conf/wheretolive_postgis:/var/lib/postgresql/data'
published_ports:
- 5432:5432
labels:
com.centurylinklabs.watchtower.enable: 'true'