-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprovision_vagrant.yml
58 lines (51 loc) · 2.05 KB
/
provision_vagrant.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
---
- hosts: all
become: yes
tasks:
- name: link /mos -> /vagrant
file: src=/vagrant
dest=/mos
state=link
# update / install packages
- name: "Install packages"
apt:
update_cache: yes
cache_valid_time: 3600
name: "{{ item }}"
with_items:
- build-essential
- python3-pip
- locales
- name: "add locale de_DE.UTF-8"
locale_gen: name="de_DE.UTF-8" state=present
# install required python modules
- name: "Install python modules"
pip: requirements={{item}} executable=pip3
with_items:
- /vagrant/requirements.txt
- /vagrant/requirements-dev.txt
# check the existence of the secret_key.py file and create one if it does not exist
# a generated file should contain something like: SECRET_KEY='<KVPy@&pwCO[1KCz.O[]*mZ\+Q*CfTTm#;$1Bdd_17gq@9dzaG'
- stat: path=/mos/mos/settings/secret_key.py
register: st
- shell: echo "SECRET_KEY='`cat /dev/urandom | tr -dc 'a-z0-9!@#$%^&*(-_=+)' | head -c50`'" > /mos/mos/settings/secret_key.py
when: st.stat.exists == False
# prepare MOS itself
- stat: path=/mos/mos.sqlite
register: st_sqlite
- name: django syncdb
django_manage: app_path=/mos
command=syncdb
- name: django migrate
django_manage: app_path=/mos
command=migrate
- django_manage: app_path=/mos
command="createsuperuser --noinput --username=admin --email=admin@example.com"
when: st_sqlite.stat.exists == False
- name: django loaddata
django_manage: app_path=/mos
fixtures='core/fixtures/default_choices.json members/fixtures/default_choices.json members/fixtures/dummy_members.json cal/fixtures/events_2012-09-20.json'
command=loaddata
# set the default directory to /mos
- lineinfile: dest=/home/vagrant/.bashrc
line='cd /mos'