-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplaybook.yml
215 lines (162 loc) · 6.94 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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
---
- hosts: 127.0.0.1
connection: local
sudo: true
tasks:
- name: vim
yum: name=vim state=latest
#########################################
# zeromq #
#########################################
# setup zeromq and all the crap needed
# for installing pyzmq later
- name: zeromq dependencies
yum: name={{item}} state=latest
with_items:
- zeromq
- git
- svn
- cpp
- make
- autoconf
- automake
- patch
- cmake
- wget
- mlocate
- rpm-build
- gcc-c++
- uuid-devel
- pkgconfig
- libtool
- python-devel
- openpgm
#########################################
# Python - install and configure stuff #
# needed for running python #
# projects #
#########################################
# Python 2.7 is already installed in centos7, but pip is not:
- easy_install: name=pip
# # now setup all our required python dependencies:
- pip: requirements=/usr/local/src/python/requirements.txt
#######################################
# Golang - install and configure go #
# stuff need for running go #
# projects #
#######################################
# For reference purposes ...
# Some useful commands (used while building ansible script)...
#
# vagrant destroy
# vagrant up
# vagrant ssh
# cd /vagrant
# ansible-playbook playbook.yml
# The ./scratch directory is a working directory that gets deleted at the end of the
# playbook
- name : Make scratch dir
command : mkdir ./scratch
# Install Go
- name: Go download
command: wget -P ./scratch https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz
- name: Go Install Go
command: tar -C /usr/local -xzf ./scratch/go1.6.linux-amd64.tar.gz
- name: Add Go bin dir to path
lineinfile: dest=/etc/profile line="export PATH=$PATH:/usr/local/go/bin"
# Install libsodium library (curve dependency)
- name : Download libsodium
command : wget -P ./scratch https://github.com/jedisct1/libsodium/releases/download/1.0.8/libsodium-1.0.8.tar.gz
- name : Un-tar libsodium
command : tar -C ./scratch -xzf ./scratch/libsodium-1.0.8.tar.gz
- name : Configure libsodium
command : ./configure
args:
chdir: ./scratch/libsodium-1.0.8/
- name : Make libsodium
command : make
args:
chdir: ./scratch/libsodium-1.0.8/
- name : Make check libsodium
command : make check
args:
chdir: ./scratch/libsodium-1.0.8/
- name : Make install libsodium
command : make install
args:
chdir: ./scratch/libsodium-1.0.8/
# zmqlib installation (with libsodium)
- name: Download zmqlib
command: wget -P ./scratch http://download.zeromq.org/zeromq-4.1.4.tar.gz
- name: Un-tar zmqlib
command: tar -C ./scratch -xzf ./scratch/zeromq-4.1.4.tar.gz
- name : Autogen zmqlib
command : ./autogen.sh
args:
chdir: ./scratch/zeromq-4.1.4/
# The following section creates a buildzmqlib.sh script
# There may be a better way to create the script {with_items} but this will do for now
# The script sets environment variables needed to build the zmqlib
- name : Create buildzmqlib.sh script
shell: touch buildzmqlib.sh
args:
chdir: ./scratch/zeromq-4.1.4/
- name: Make buildzmqlib.sh script
lineinfile: dest=./scratch/zeromq-4.1.4/buildzmqlib.sh line='export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"'
- name: Make buildzmqlib.sh script (cont)
lineinfile: dest=./scratch/zeromq-4.1.4/buildzmqlib.sh line='export sodium_LIBS="-L/usr/local/lib"'
- name: Make buildzmqlib.sh script (cont)
lineinfile: dest=./scratch/zeromq-4.1.4/buildzmqlib.sh line='export CPATH=/usr/local/include'
- name: Make buildzmqlib.sh script (cont)
lineinfile: dest=./scratch/zeromq-4.1.4/buildzmqlib.sh line='export LIBRARY_PATH=/usr/local/lib'
- name: Make buildzmqlib.sh script (cont)
lineinfile: dest=./scratch/zeromq-4.1.4/buildzmqlib.sh line='export LD_RUN_PATH=/usr/local/lib'
- name: Make buildzmqlib.sh script (cont)
lineinfile: dest=./scratch/zeromq-4.1.4/buildzmqlib.sh line='export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig'
- name: Make buildzmqlib.sh script (cont)
lineinfile: dest=./scratch/zeromq-4.1.4/buildzmqlib.sh line='export CFLAGS=$(pkg-config --cflags libsodium)'
- name: Make buildzmqlib.sh script (cont)
lineinfile: dest=./scratch/zeromq-4.1.4/buildzmqlib.sh line='export LDFLAGS=$(pkg-config --libs libsodium)'
- name: Make buildzmqlib.sh script (cont)
lineinfile: dest=./scratch/zeromq-4.1.4/buildzmqlib.sh line='./configure --with-libsodium'
- name: Make buildzmqlib.sh script (cont)
lineinfile: dest=./scratch/zeromq-4.1.4/buildzmqlib.sh line='make clean'
- name: Make buildzmqlib.sh script (cont)
lineinfile: dest=./scratch/zeromq-4.1.4/buildzmqlib.sh line='make'
- name: Make buildzmqlib.sh script (cont)
lineinfile: dest=./scratch/zeromq-4.1.4/buildzmqlib.sh line='make install'
- name: Run build zmqlib
command: sh buildzmqlib.sh
args:
chdir: ./scratch/zeromq-4.1.4/
# The following section creates a build-go-artifacts.sh script
# This script has necesary environment variables set to build the
# Go project artifacts
- name : Create build-go-artifacts.sh script
shell: touch build-go-artifacts.sh
args:
chdir: ./scratch/
- name: Create build-go-artifacts.sh script (cont)
lineinfile: dest=./scratch/build-go-artifacts.sh line='export PATH=$PATH:/usr/local/go/bin'
- name: Create build-go-artifacts.sh script (cont)
lineinfile: dest=./scratch/build-go-artifacts.sh line='export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig'
- name: Create build-go-artifacts.sh script (cont)
lineinfile: dest=./scratch/build-go-artifacts.sh line='export GOPATH=/vagrant/src/go'
- name: Create build-go-artifacts.sh script (cont)
lineinfile: dest=./scratch/build-go-artifacts.sh line='cd /vagrant/src/go && make go-deps'
- name: Create build-go-artifacts.sh script (cont)
lineinfile: dest=./scratch/build-go-artifacts.sh line='cd /vagrant/src/go && make'
- name: Create build-go-artifacts.sh script (cont)
lineinfile: dest=./scratch/build-go-artifacts.sh line='touch /vagrant/src/go/src/github.com/redsofa/collector/main/config.json'
- name: Create build-go-artifacts.sh script (cont)
lineinfile: dest=./scratch/build-go-artifacts.sh line='touch /vagrant/src/go/src/github.com/redsofa/soundtouch/main/config.json'
- name: Run build-go-artifacts.sh
command: sh build-go-artifacts.sh
args:
chdir: ./scratch/
- name : Delete scratch directory
file: path=./scratch state=absent
- name: Add $PKG_CONFIG_PATH env var in /etc/profile
lineinfile: dest=/etc/profile line="export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig"
- name: Add GOPATH env var to /etc/profile
lineinfile: dest=/etc/profile line='export GOPATH=/vagrant/src/go'