summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorOpenShift Bot <eparis+openshiftbot@redhat.com>2017-03-17 17:22:19 -0500
committerGitHub <noreply@github.com>2017-03-17 17:22:19 -0500
commitcd56448dae931dc5c270f8090b7ba25cc6833805 (patch)
tree56117b1a1ec98487a65024e1ba3aabe78279e310 /roles
parent3e8d87beaa2adc2d6f8a9e1bcc0c6cba1090acbe (diff)
parent94251afea2f1f58aabf0ae0f3ca544dd8f1dd368 (diff)
downloadopenshift-cd56448dae931dc5c270f8090b7ba25cc6833805.tar.gz
openshift-cd56448dae931dc5c270f8090b7ba25cc6833805.tar.bz2
openshift-cd56448dae931dc5c270f8090b7ba25cc6833805.tar.xz
openshift-cd56448dae931dc5c270f8090b7ba25cc6833805.zip
Merge pull request #3656 from mtnbikenc/refactor-openshift_projects
Merged by openshift-bot
Diffstat (limited to 'roles')
-rw-r--r--roles/openshift_hosted/meta/main.yml2
-rw-r--r--roles/openshift_hosted/tasks/main.yml7
-rw-r--r--roles/openshift_hosted/vars/main.yml10
-rw-r--r--roles/openshift_projects/meta/main.yml15
-rw-r--r--roles/openshift_projects/tasks/main.yml47
-rw-r--r--roles/openshift_projects/vars/main.yml2
6 files changed, 17 insertions, 66 deletions
diff --git a/roles/openshift_hosted/meta/main.yml b/roles/openshift_hosted/meta/main.yml
index bbbb76414..9626c23c1 100644
--- a/roles/openshift_hosted/meta/main.yml
+++ b/roles/openshift_hosted/meta/main.yml
@@ -15,5 +15,3 @@ dependencies:
- role: openshift_cli
- role: openshift_hosted_facts
- role: lib_openshift
-- role: openshift_projects
- openshift_projects: "{{ openshift_additional_projects | default({}) | oo_merge_dicts({'default':{'default_node_selector':''},'openshift-infra':{'default_node_selector':''},'logging':{'default_node_selector':''}}) }}"
diff --git a/roles/openshift_hosted/tasks/main.yml b/roles/openshift_hosted/tasks/main.yml
index fe254f72d..6efe2f63c 100644
--- a/roles/openshift_hosted/tasks/main.yml
+++ b/roles/openshift_hosted/tasks/main.yml
@@ -1,4 +1,11 @@
---
+- name: Create projects
+ oc_project:
+ name: "{{ item.key }}"
+ node_selector:
+ - "{{ item.value.default_node_selector }}"
+ with_dict: "{{ openshift_projects }}"
+
- include: router/router.yml
when: openshift_hosted_manage_router | default(true) | bool
diff --git a/roles/openshift_hosted/vars/main.yml b/roles/openshift_hosted/vars/main.yml
index 521578cd0..0821d0e7e 100644
--- a/roles/openshift_hosted/vars/main.yml
+++ b/roles/openshift_hosted/vars/main.yml
@@ -1,3 +1,13 @@
---
openshift_master_config_dir: "{{ openshift.common.config_base }}/master"
registry_config_secret_name: registry-config
+
+openshift_default_projects:
+ default:
+ default_node_selector: ''
+ logging:
+ default_node_selector: ''
+ openshift-infra:
+ default_node_selector: ''
+
+openshift_projects: "{{ openshift_additional_projects | default({}) | oo_merge_dicts(openshift_default_projects) }}"
diff --git a/roles/openshift_projects/meta/main.yml b/roles/openshift_projects/meta/main.yml
deleted file mode 100644
index 107a70b83..000000000
--- a/roles/openshift_projects/meta/main.yml
+++ /dev/null
@@ -1,15 +0,0 @@
----
-galaxy_info:
- author: Jason DeTiberus
- description: OpenShift Projects
- company: Red Hat, Inc.
- license: Apache License, Version 2.0
- min_ansible_version: 1.9
- platforms:
- - name: EL
- versions:
- - 7
- categories:
- - cloud
-dependencies:
-- { role: openshift_facts }
diff --git a/roles/openshift_projects/tasks/main.yml b/roles/openshift_projects/tasks/main.yml
deleted file mode 100644
index 30d58afd3..000000000
--- a/roles/openshift_projects/tasks/main.yml
+++ /dev/null
@@ -1,47 +0,0 @@
----
-- name: Create temp directory for kubeconfig
- command: mktemp -d /tmp/openshift-ansible-XXXXXX
- register: mktemp
- changed_when: False
-
-- name: Copy the admin client config(s)
- command: >
- cp {{ openshift_master_config_dir }}/admin.kubeconfig {{ mktemp.stdout }}/admin.kubeconfig
- changed_when: False
-
-- name: Determine if projects exist
- command: >
- {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig
- get projects {{ item.key }} -o json
- with_dict: "{{ openshift_projects }}"
- failed_when: false
- changed_when: false
- register: project_test
-
-- name: Create projects
- command: >
- {{ openshift.common.client_binary }} adm --config={{ mktemp.stdout }}/admin.kubeconfig
- new-project {{ item.item.key }}
- {% if item.item.value.default_node_selector | default(none) != none %}
- {{ '--node-selector=' ~ item.item.value.default_node_selector }}
- {% endif %}
- when: item.rc == 1
- with_items:
- - "{{ project_test.results }}"
-
-- name: Update project default node selector if necessary
- command: >
- {{ openshift.common.client_binary }}
- --config={{ mktemp.stdout }}/admin.kubeconfig patch namespace {{ item.item.key }}
- -p '{"metadata": {"annotations": {"openshift.io/node-selector": "{{ item.item.value.default_node_selector }}"}}}'
- when: "{{ item.rc == 0 and item.item.value.default_node_selector | default(none) != none
- and item.item.value.default_node_selector | default(none) != (item.stdout | from_json).metadata.annotations['openshift.io/node-selector'] | default(none) }}"
- with_items:
- - "{{ project_test.results }}"
- register: annotate_project
-
-- name: Delete temp directory
- file:
- name: "{{ mktemp.stdout }}"
- state: absent
- changed_when: False
diff --git a/roles/openshift_projects/vars/main.yml b/roles/openshift_projects/vars/main.yml
deleted file mode 100644
index 9967e26f4..000000000
--- a/roles/openshift_projects/vars/main.yml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-openshift_master_config_dir: "{{ openshift.common.config_base }}/master"