-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
106 lines (101 loc) · 2.71 KB
/
.gitlab-ci.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
---
image: <redacted>
stages:
- test
after_script:
- |
for i in {1..4}; do
docker stop alstest${i}
docker rm alstest${i}
done
- docker stop alsvault-dev
- docker rm alsvault-dev
run_tests_vault:
stage: test
script:
- |
for i in {1..4}; do
docker rm alstest${i} || true
done
- docker rm alsvault-dev || true
- ssh-keygen -f tempkey -P ""
- PK=`base64 -w0 tempkey.pub`
- |
for i in {1..4}; do
docker run --name alstest${i} \
--env UBUNTU_SSH_PUBKEY=$PK \
--detach \
<redacted>:4567/docker-images/docker-ubuntu-1604-dummy:16.04
done
- |
docker run --name alsvault-dev \
--detach \
--env VAULT_DEV_ROOT_TOKEN_ID="blebleble" \
vault:0.9.5
- |
for i in {1..4}; do
export IP${i}=`docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' alstest${i}`
done
- VAULT_IP=`docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' alsvault-dev`
- |
cat > hosts << EOF
test1 ansible_ssh_host=$IP1
test2 ansible_ssh_host=$IP2
test3 ansible_ssh_host=$IP3
test4 ansible_ssh_host=$IP4
[all]
test1
test2
test3
test4
[subgroup1]
test2
test4
[subgroup2]
test1
test3
EOF
- cat hosts
- eval `ssh-agent`
- ssh-add tempkey
- echo "$VAULT_IP vault.sandbox.com vault" >> /etc/hosts
- export VAULT_ADDR=http://vault.sandbox.com:8200/
- export VAULT_TOKEN="blebleble"
- unset http_proxy
- unset https_proxy
- |
ansible-playbook --user ubuntu \
--inventory hosts \
--extra-vars ass_secret_store="vault" \
--extra-vars ass_vault_mount="secret" \
--extra-vars ass_vault_path="test" \
--extra-vars disable_ansible_log=false \
tests/test-vault.yml
run_tests_fs:
stage: test
script:
- |
cat > hosts << EOF
test1 ansible_ssh_host=1.2.3.4
test2 ansible_ssh_host=2.3.4.5
test3 ansible_ssh_host=3.4.5.6
test4 ansible_ssh_host=4.5.6.7
[all]
test1
test2
test3
test4
[subgroup1]
test2
test4
[subgroup2]
test1
test3
EOF
- |
ansible-playbook --user ubuntu \
--inventory hosts \
--extra-vars ass_secret_store="fs" \
--extra-vars ass_fs_path="/tmp" \
--extra-vars disable_ansible_log=false \
tests/test-fs.yml