summaryrefslogtreecommitdiff
path: root/roles/contexts
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@fretlink.com>2019-02-27 19:18:55 +0100
committerIsmaël Bouya <ismael.bouya@fretlink.com>2019-02-27 19:18:55 +0100
commitbf4da46633ce3682339ea01bf18c98562fa04c5d (patch)
tree40fa6cc283d38b704e3d5144d6822474cbcd2075 /roles/contexts
parente2e7cad558fda2d58d91a18c1ad074cb6da39828 (diff)
downloadAnsible-bf4da46633ce3682339ea01bf18c98562fa04c5d.tar.gz
Ansible-bf4da46633ce3682339ea01bf18c98562fa04c5d.tar.zst
Ansible-bf4da46633ce3682339ea01bf18c98562fa04c5d.zip
Fix a few strings and configurations, and add a fl_restoreDump script
Diffstat (limited to 'roles/contexts')
-rw-r--r--roles/contexts/fretlink/files/scripts/fl_restoreDump19
-rw-r--r--roles/contexts/fretlink/files/scripts/fl_tmux_dev10
-rw-r--r--roles/contexts/fretlink/tasks/main.yml1
-rw-r--r--roles/contexts/fretlink/templates/environment.j28
4 files changed, 33 insertions, 5 deletions
diff --git a/roles/contexts/fretlink/files/scripts/fl_restoreDump b/roles/contexts/fretlink/files/scripts/fl_restoreDump
new file mode 100644
index 0000000..c76406b
--- /dev/null
+++ b/roles/contexts/fretlink/files/scripts/fl_restoreDump
@@ -0,0 +1,19 @@
1#!/bin/bash
2
3if [ -z "$1" ]; then
4 echo "$(basename $0) zip-file-to-restore.zip"
5 exit 1
6fi
7
8file=$(pwd)/$1
9
10cd $HOME/workdir/app
11
12unzip "$file"
13
14source ../environment
15mongorestore --drop --uri $FRETLINK_MONGO_URI $(pwd)/.dump/
16
17if [ -e "../fixtures" ]; then
18 source ../fixtures
19fi
diff --git a/roles/contexts/fretlink/files/scripts/fl_tmux_dev b/roles/contexts/fretlink/files/scripts/fl_tmux_dev
index ca89e27..174c4a7 100644
--- a/roles/contexts/fretlink/files/scripts/fl_tmux_dev
+++ b/roles/contexts/fretlink/files/scripts/fl_tmux_dev
@@ -1,5 +1,9 @@
1#!/bin/bash 1#!/bin/bash
2 2
3tmux_conf() {
4 tmux -f $XDG_CONFIG_HOME/tmux/tmux.conf "$@"
5}
6
3type="${1:-bash}" 7type="${1:-bash}"
4if [ -n "$TMUX" ]; then 8if [ -n "$TMUX" ]; then
5 m=switch-client 9 m=switch-client
@@ -17,14 +21,14 @@ if tmux has-session -t "$type" 2>/dev/null; then
17 tmux $m -t "$type" 21 tmux $m -t "$type"
18else 22else
19 if [ "$type" = "remote" ]; then 23 if [ "$type" = "remote" ]; then
20 tmux new-session -d -c $start_dir -s "$type" mosh immae.eu \; \ 24 tmux_conf new-session -d -c $start_dir -s "$type" mosh immae.eu \; \
21 $m -t "$type" 25 $m -t "$type"
22 elif [ -n "$start_dir" ]; then 26 elif [ -n "$start_dir" ]; then
23 tmux new-session -d -c $start_dir -s "$type" \; \ 27 tmux_conf new-session -d -c $start_dir -s "$type" \; \
24 $m -t "$type" \; \ 28 $m -t "$type" \; \
25 new-window -c $start_dir 29 new-window -c $start_dir
26 elif [ -d "$HOME/workdir/$type" ]; then 30 elif [ -d "$HOME/workdir/$type" ]; then
27 tmux new-session -d -c "$HOME/workdir/$type" -s "$type" \; \ 31 tmux_conf new-session -d -c "$HOME/workdir/$type" -s "$type" \; \
28 $m -t "$type" \; \ 32 $m -t "$type" \; \
29 send-keys "../start" C-m \; \ 33 send-keys "../start" C-m \; \
30 rename-window "running" \; \ 34 rename-window "running" \; \
diff --git a/roles/contexts/fretlink/tasks/main.yml b/roles/contexts/fretlink/tasks/main.yml
index 0908eca..5b75f9b 100644
--- a/roles/contexts/fretlink/tasks/main.yml
+++ b/roles/contexts/fretlink/tasks/main.yml
@@ -100,6 +100,7 @@
100 - fl_tmux_dev 100 - fl_tmux_dev
101 - fl_vpn 101 - fl_vpn
102 - fl_getDump 102 - fl_getDump
103 - fl_restoreDump
103 - name: completion scripts 104 - name: completion scripts
104 copy: 105 copy:
105 src: "scripts/_{{ item }}" 106 src: "scripts/_{{ item }}"
diff --git a/roles/contexts/fretlink/templates/environment.j2 b/roles/contexts/fretlink/templates/environment.j2
index 36e4bfd..91a6f6a 100644
--- a/roles/contexts/fretlink/templates/environment.j2
+++ b/roles/contexts/fretlink/templates/environment.j2
@@ -58,7 +58,7 @@ FL_APP_URL="$FL_APPS_SCHEME://$FL_APPS_HOST:$FL_APP_PORT"
58FL_CARRIER_DIRECTORY_PORT=8082 58FL_CARRIER_DIRECTORY_PORT=8082
59FL_CARRIER_DIRECTORY_SECRET="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/CarrierDirectory subkey=Secret') }}" 59FL_CARRIER_DIRECTORY_SECRET="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/CarrierDirectory subkey=Secret') }}"
60FL_CARRIER_DIRECTORY_PRIVATE_KEY="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/CarrierDirectory subkey=PrivateKey') }}" 60FL_CARRIER_DIRECTORY_PRIVATE_KEY="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/CarrierDirectory subkey=PrivateKey') }}"
61FL_CARRIER_DIRECTORY_URL="$FL_APPS_SCHEME://$FL_APPS_HOST:$FL_CARRIER_DIRECTORY_PORT/api/" 61FL_CARRIER_DIRECTORY_URL="$FL_APPS_SCHEME://$FL_APPS_HOST:$FL_CARRIER_DIRECTORY_PORT/api"
62 62
63FL_NOTIFIER_PORT=8081 63FL_NOTIFIER_PORT=8081
64FL_NOTIFIER_SECRET="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/Notifier subkey=Secret') }}" 64FL_NOTIFIER_SECRET="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/Notifier subkey=Secret') }}"
@@ -149,14 +149,16 @@ if [ "$APP" = "app" ]; then
149 export FRETLINK_AMAZON_PUBLIC_KEY="password" 149 export FRETLINK_AMAZON_PUBLIC_KEY="password"
150 export FRETLINK_AMAZON_PRIVATE_KEY="password" 150 export FRETLINK_AMAZON_PRIVATE_KEY="password"
151 export FRETLINK_GMAPS_API_KEY="password" 151 export FRETLINK_GMAPS_API_KEY="password"
152 export FRETLINK_PASSWORD_REQUEST_SECRET="password"
152 153
153 # secret 154 # secret
154 export FRETLINK_MACAROON_SECRET=$FL_APP_SECRET 155 export FRETLINK_MACAROON_SECRET=$FL_APP_SECRET
155 156
156 # carrier directory 157 # carrier directory
157 export CARRIER_DIRECTORY_URI="$FL_CARRIER_DIRECTORY_URL" 158 export CARRIER_DIRECTORY_URI="$FL_CARRIER_DIRECTORY_URL/"
158 export FRETLINK_CARDIR_URL="$FL_CARRIER_DIRECTORY_URL" 159 export FRETLINK_CARDIR_URL="$FL_CARRIER_DIRECTORY_URL"
159 export FRETLINK_CARDIR_ENABLED="true" 160 export FRETLINK_CARDIR_ENABLED="true"
161 export FRETLINK_CARDIRV3_ACCESS_KEY="$(build_macaroon $FL_CARRIER_DIRECTORY_SECRET carrier-directory carrier-directory carrier-directory::read)"
160 162
161 # notifier 163 # notifier
162 export FRETLINK_NOTIFIER_API=$FL_NOTIFIER_URL 164 export FRETLINK_NOTIFIER_API=$FL_NOTIFIER_URL
@@ -183,6 +185,7 @@ if [ "$APP" = "app" ]; then
183 # geodata 185 # geodata
184 export FRETLINK_GEODATA_API="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/GeodataDev subkey=Url') }}" 186 export FRETLINK_GEODATA_API="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/GeodataDev subkey=Url') }}"
185 export FRETLINK_GEODATA_ACCESS_KEY="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/GeodataDev') }}" 187 export FRETLINK_GEODATA_ACCESS_KEY="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/GeodataDev') }}"
188 export GEODATA_URI="$FRETLINK_GEODATA_API"
186fi 189fi
187 190
188if [ "$APP" = "admin-root" ]; then 191if [ "$APP" = "admin-root" ]; then
@@ -199,6 +202,7 @@ fi
199 202
200if [ "$APP" = "carrier-directory" ]; then 203if [ "$APP" = "carrier-directory" ]; then
201 export ADMIN_BASE_URL=$FL_APP_URL 204 export ADMIN_BASE_URL=$FL_APP_URL
205 export ACCESS_KEY="$(build_macaroon $FL_CARRIER_DIRECTORY_SECRET carrier-directory carrier-directory carrier-directory::read)"
202fi 206fi
203 207
204if [ "$APP" = "notifier" ]; then 208if [ "$APP" = "notifier" ]; then