forked from dockerizeme/dockerizeme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vagrant.yml
130 lines (106 loc) · 2.99 KB
/
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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
# An Ansible playbook for configuring the local vagrant machine
- name: Configure DockerizeMe
hosts: all
vars:
node_gpg_key: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
node_repo: deb https://deb.nodesource.com/node_10.x xenial main
apt_packages:
- nodejs
- docker.io
- python
- python-pip
python_packages:
- docker
dockerizeme_path: /vagrant
dockerizeme_bin_path: /usr/bin/dockerizeme
# Not inside {{ dockerizeme_path }}/neo4j because neo4j can't get a lock on rsynced directory
neo4j_image: neo4j:3.5
neo4j_data_path: /neo4j
neo4j_backup_path: "{{ dockerizeme_path }}/neo4j"
neo4j_backup_name: neo4j.dump
tasks:
- name: Add NodeJS Repo GPG Key
become: yes
apt_key:
url: "{{ node_gpg_key }}"
state: present
- name: Add NodeJS Repo
become: yes
apt_repository:
repo: "{{ node_repo }}"
state: present
update_cache: yes
- name: Install APT Packages
become: yes
apt:
name: "{{ apt_packages }}"
state: present
- name: Install Python Packages
become: yes
pip:
name: "{{ python_packages }}"
state: latest
- name: Install DockerizeMe CLI Dependencies
npm:
path: "{{ dockerizeme_path }}"
state: present
- name: Check For DockerizeMe
stat:
path: "{{ dockerizeme_bin_path }}"
register: dockerizeme_bin
- name: Run NPM Link
become: yes
command: npm link {{ dockerizeme_path }}
when: not dockerizeme_bin.stat.exists
- name: Enable Docker
become: yes
service:
name: docker
state: started
enabled: yes
- name: Check for Neo4j Database
stat:
path: "{{ neo4j_data_path }}/databases"
register: neo4j_databases
- name: Create Neo4J Database If Absent
when: not neo4j_databases.stat.exists
block:
- name: Ensure Neo4J is Stopped
become: yes
docker_container:
name: "{{ neo4j_image }}"
state: absent
- name: Create Neo4J Data Directory
become: yes
file:
path: "{{ neo4j_data_path }}"
state: directory
- name: Copy Backup File Locally
become: yes
copy:
remote_src: yes
src: "{{ neo4j_backup_path }}/{{ neo4j_backup_name }}"
dest: "{{ neo4j_data_path }}/{{ neo4j_backup_name }}"
- name: Create Neo4J Databases Directory
become: yes
file:
path: "{{ neo4j_data_path }}/databases"
state: directory
- name: Create Neo4j Database From Backup
become: yes
command: docker run --rm -v "{{ neo4j_data_path }}:/data" "{{ neo4j_image }}" neo4j-admin load --from=/data/{{ neo4j_backup_name }}
- name: Run Neo4J
become: yes
docker_container:
name: neo4j
image: "{{ neo4j_image }}"
restart_policy: always
state: started
ports:
- 7474:7474
- 7687:7687
volumes:
- "{{ neo4j_data_path }}:/data"
env:
NEO4J_AUTH: "none"