From c9eb0a1133ed9baf1bfa29c92d875a08b60756c8 Mon Sep 17 00:00:00 2001 From: donal <donalspring@gmail.com> Date: Tue, 17 Apr 2018 19:16:50 +0200 Subject: [PATCH] UPDATE - new playbook layout based on the discussions with Global team --- inventory/hosts | 10 ++++- /dev/null | 10 ----- inventory/group_vars/ci-cd-tooling.yml | 5 ++ params/project-requests-ci-cd | 4 +- inventory/group_vars/projects-and-policies.yml | 11 +++++ apply.yml | 10 +++++ README.md | 12 ++++-- 7 files changed, 44 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 509a8f5..aca5c82 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,13 @@ ```bash ansible-galaxy install -r requirements.yml --roles-path=roles ``` -1. Run the play book using +1. Run the play book using this to create projects and roles ```bash -ansible-playbook roles/openshift-applier/playbooks/openshift-cluster-seed.yml -i inventory/ +ansible-playbook apply.yml -i inventory/ -e target=bootstrap +``` +1. Run the play book using this to create projects and roles +```bash +ansible-playbook apply.yml -i inventory/ -e target=tools ``` ## Running a Subset of the Inventory @@ -21,7 +25,7 @@ 2. The only required tag to deploy objects within the inventory is **projects**, all other tags are *optional* 2. Here is an example that runs the tags that provision projects, ci, and jenkins objects: ```bash -ansible-playbook roles/openshift-applier/playbooks/openshift-cluster-seed.yml \ +ansible-playbook apply.yml -e target=tools \ -i inventory/ \ - -e="filter_tags=jenkins,ci,projects" + -e "filter_tags=jenkins,ci,projects" ``` diff --git a/apply.yml b/apply.yml new file mode 100644 index 0000000..168b118 --- /dev/null +++ b/apply.yml @@ -0,0 +1,10 @@ +--- +- name: Deploy {{ target }} + hosts: "{{ target }}" + vars: + ci_cd_namespace: <YOUR_NAME>-ci-cd + dev_namespace: <YOUR_NAME>-dev + test_namespace: <YOUR_NAME>-test + tasks: + - include_role: + name: openshift-applier/roles/openshift-applier diff --git a/inventory/group_vars/all.yml b/inventory/group_vars/all.yml deleted file mode 100644 index 3c3d3d6..0000000 --- a/inventory/group_vars/all.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -openshift_cluster_content: -- object: projectrequest - content: - - name: ci-cd - template: "{{ inventory_dir }}/../templates/project-requests.yml" - template_action: create - params: "{{ inventory_dir }}/../params/project-requests-ci-cd" - tags: - - projects diff --git a/inventory/group_vars/ci-cd-tooling.yml b/inventory/group_vars/ci-cd-tooling.yml new file mode 100644 index 0000000..d2f58b4 --- /dev/null +++ b/inventory/group_vars/ci-cd-tooling.yml @@ -0,0 +1,5 @@ +--- +ansible_connection: local +openshift_cluster_content: +- object: ci-cd-tooling + content: diff --git a/inventory/group_vars/projects-and-policies.yml b/inventory/group_vars/projects-and-policies.yml new file mode 100644 index 0000000..ca7a145 --- /dev/null +++ b/inventory/group_vars/projects-and-policies.yml @@ -0,0 +1,11 @@ +--- +ansible_connection: local +openshift_cluster_content: +- object: projectrequest + content: + - name: {{ ci_cd_namespace }} + template: "{{ playbook_dir }}/templates/project-requests.yml" + template_action: create + params: "{{ playbook_dir }}/params/project-requests-ci-cd" + tags: + - projects diff --git a/inventory/hosts b/inventory/hosts index 7f325c4..8eab5b5 100644 --- a/inventory/hosts +++ b/inventory/hosts @@ -1,2 +1,8 @@ -[seed-hosts] -localhost ansible_connection=local +#[seed-hosts] +#localhost ansible_connection=local + +[bootstrap] +projects-and-policies + +[tools] +ci-cd-tooling \ No newline at end of file diff --git a/params/project-requests-ci-cd b/params/project-requests-ci-cd index 96df92f..e38b7eb 100644 --- a/params/project-requests-ci-cd +++ b/params/project-requests-ci-cd @@ -1,2 +1,2 @@ -NAMESPACE=<your name or initials>-ci-cd -NAMESPACE_DISPLAY_NAME=<your name or initials> Labs CI/CD +NAMESPACE=<YOUR_NAME>-ci-cd +NAMESPACE_DISPLAY_NAME=<YOUR_NAME> Labs CI/CD -- Gitblit v1.9.3