summaryrefslogtreecommitdiffstats
path: root/roles/common/pre_tasks
diff options
context:
space:
mode:
authorØystein Bedin <bedin@redhat.com>2016-08-21 02:12:53 -0400
committerØystein Bedin <bedin@redhat.com>2016-08-21 02:12:53 -0400
commitc757fd690d24865ef3b5b9a1b536120299b39a6c (patch)
treee6e893eec0d0ea0c66eab3fe9192dad9ac270583 /roles/common/pre_tasks
parent3e3c7761068ed57b7cbee0329bd02d234b82e0e1 (diff)
downloadopenshift-c757fd690d24865ef3b5b9a1b536120299b39a6c.tar.gz
openshift-c757fd690d24865ef3b5b9a1b536120299b39a6c.tar.bz2
openshift-c757fd690d24865ef3b5b9a1b536120299b39a6c.tar.xz
openshift-c757fd690d24865ef3b5b9a1b536120299b39a6c.zip
Updated env_id to be a sub-domain + make the logic a bit more flexible
Diffstat (limited to 'roles/common/pre_tasks')
-rw-r--r--roles/common/pre_tasks/pre_tasks.yml21
1 files changed, 19 insertions, 2 deletions
diff --git a/roles/common/pre_tasks/pre_tasks.yml b/roles/common/pre_tasks/pre_tasks.yml
index ed57a2993..1ba1ea55d 100644
--- a/roles/common/pre_tasks/pre_tasks.yml
+++ b/roles/common/pre_tasks/pre_tasks.yml
@@ -1,4 +1,21 @@
---
- name: Generate Environment ID
- shell: echo "$(date +%s)"
- register: env_random_id
+ set_fact:
+ env_random_id: "{{ ansible_date_time.epoch }}"
+ run_once: true
+ delegate_to: localhost
+
+- name: Set default Environment ID
+ set_fact:
+ default_env_id: "casl-{{ lookup('env','OS_USERNAME') }}-{{ env_random_id }}"
+ delegate_to: localhost
+
+- name: Setting Common Facts
+ set_fact:
+ env_id: "{{ env_id | default(default_env_id) }}"
+ delegate_to: localhost
+
+- name: Updating DNS domain to include env_id (if not empty)
+ set_fact:
+ full_dns_domain: "{{ (env_id|trim == '') | ternary(dns_domain, env_id + '.' + dns_domain) }}"
+ delegate_to: localhost