From 0eae37acae92ec64d7afa58d26e692b3a6496267 Mon Sep 17 00:00:00 2001
From: Arie Peterson <arie@greenhost.nl>
Date: Wed, 27 Feb 2019 11:14:04 +0100
Subject: [PATCH] Generate keycloak password from ansible

---
 .gitignore                                      | 1 +
 .gitlab-ci.yml                                  | 1 -
 ansible/group_vars/cluster/settings.yml.example | 2 +-
 test/bootstrap.yml                              | 1 +
 test/ci-bootstrap.py                            | 2 +-
 test/roles                                      | 1 +
 6 files changed, 5 insertions(+), 3 deletions(-)
 create mode 120000 test/bootstrap.yml
 create mode 120000 test/roles

diff --git a/.gitignore b/.gitignore
index 5f48a8c13..26c584815 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@
 
 # Ignore files created during CI using test/ci-bootstrap.py
 /test/group_vars/
+/test/secrets/
 /test/inventory.yml
 
 # Etc
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 35c94f50a..36f15ba00 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -31,7 +31,6 @@ bootstrap:
     - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
     # - mkdir -p --mode 700 ~/.ssh
     - ANSIBLE_HOST_KEY_CHECKING=False python3 -u ./ci-bootstrap.py --create_droplet
-    - echo "import cosmos; cosmos.terminate_droplets_by_name(\"^ci-${CI_JOB_ID}\$\")"
     - python3 -c "import cosmos; cosmos.terminate_droplets_by_name(\"^ci-${CI_JOB_ID}\$\")"
   artifacts:
     paths:
diff --git a/ansible/group_vars/cluster/settings.yml.example b/ansible/group_vars/cluster/settings.yml.example
index c9f3248c2..57f70bd52 100644
--- a/ansible/group_vars/cluster/settings.yml.example
+++ b/ansible/group_vars/cluster/settings.yml.example
@@ -6,4 +6,4 @@ domain: "example.com"
 admin_email: "admin@example.com"
 # Label of this deployment.
 release_name: "test"
-keycloak_password: 'baevooPee9ahkah8hew6heer5gooNooc'
+keycloak_password: "{{ lookup('password', './secrets/keycloak_admin_password') }}"
diff --git a/test/bootstrap.yml b/test/bootstrap.yml
new file mode 120000
index 000000000..d29cf97c1
--- /dev/null
+++ b/test/bootstrap.yml
@@ -0,0 +1 @@
+../ansible/bootstrap.yml
\ No newline at end of file
diff --git a/test/ci-bootstrap.py b/test/ci-bootstrap.py
index c2bf958f1..176b868f8 100755
--- a/test/ci-bootstrap.py
+++ b/test/ci-bootstrap.py
@@ -189,7 +189,7 @@ if __name__ == "__main__":
     # Bootstrap
     # playbook path here is relative to private_data_dir/project, see
     # https://ansible-runner.readthedocs.io/en/latest/intro.html#inputdir
-    playbook='../ansible/bootstrap.yml'
+    playbook='./bootstrap.yml'
     ansible_playbook_cmd = 'ansible-playbook %s' % playbook
 
     log.info('Running %s', ansible_playbook_cmd)
diff --git a/test/roles b/test/roles
new file mode 120000
index 000000000..e4109d373
--- /dev/null
+++ b/test/roles
@@ -0,0 +1 @@
+../ansible/roles
\ No newline at end of file
-- 
GitLab