From 1e9fd9a243619aedcbe285e750684efa9fe9cccc Mon Sep 17 00:00:00 2001 From: abhijit_onap Date: Wed, 20 May 2020 13:00:49 +0530 Subject: [PATCH] Added Roles for Kubeconfig file transfers. Three roles added 1. kubeconfig 2. mepkubeconfig 3. mepconfig Signed-off-by: abhijit_onap Change-Id: Iadf6114cc1175bfd1b868db0279d18a4d83c7b52 --- .../playbooks/roles/kubeconfig/tasks/install.yml | 33 ++++++++++++++++++++++ .../playbooks/roles/kubeconfig/tasks/main.yml | 21 ++++++++++++++ .../playbooks/roles/mepconfig/tasks/install.yml | 25 ++++++++++++++++ ocd/infra/playbooks/roles/mepconfig/tasks/main.yml | 21 ++++++++++++++ .../roles/mepkubeconfig/tasks/install.yml | 26 +++++++++++++++++ .../playbooks/roles/mepkubeconfig/tasks/main.yml | 18 ++++++++++++ 6 files changed, 144 insertions(+) create mode 100644 ocd/infra/playbooks/roles/kubeconfig/tasks/install.yml create mode 100644 ocd/infra/playbooks/roles/kubeconfig/tasks/main.yml create mode 100644 ocd/infra/playbooks/roles/mepconfig/tasks/install.yml create mode 100644 ocd/infra/playbooks/roles/mepconfig/tasks/main.yml create mode 100644 ocd/infra/playbooks/roles/mepkubeconfig/tasks/install.yml create mode 100644 ocd/infra/playbooks/roles/mepkubeconfig/tasks/main.yml diff --git a/ocd/infra/playbooks/roles/kubeconfig/tasks/install.yml b/ocd/infra/playbooks/roles/kubeconfig/tasks/install.yml new file mode 100644 index 0000000..149a776 --- /dev/null +++ b/ocd/infra/playbooks/roles/kubeconfig/tasks/install.yml @@ -0,0 +1,33 @@ +# Copyright 2020 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +# tasks file for k8s +- name: debug msg + debug: + msg: transfering config file to OCD Host + +- name: Fetch the file from the controller and edge nodes to ocd-host + run_once: yes + fetch: + src: /root/.kube/config + dest: /root/.kube/config-{{ ansible_host }} + flat: yes + +- name: Fetch the file from the edge nodes to ocd-host + run_once: yes + fetch: + src: /root/.kube/config + dest: /root/.kube/kubeconfig/{{ ansible_host }} + flat: yes diff --git a/ocd/infra/playbooks/roles/kubeconfig/tasks/main.yml b/ocd/infra/playbooks/roles/kubeconfig/tasks/main.yml new file mode 100644 index 0000000..a3fc9af --- /dev/null +++ b/ocd/infra/playbooks/roles/kubeconfig/tasks/main.yml @@ -0,0 +1,21 @@ +# Copyright 2020 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +# tasks file for kubeconfig transfer +- include: "install.yml" + when: operation == 'install' + +#- include: "uninstall.yml" + #when: operation == 'uninstall' diff --git a/ocd/infra/playbooks/roles/mepconfig/tasks/install.yml b/ocd/infra/playbooks/roles/mepconfig/tasks/install.yml new file mode 100644 index 0000000..7055f9d --- /dev/null +++ b/ocd/infra/playbooks/roles/mepconfig/tasks/install.yml @@ -0,0 +1,25 @@ +# Copyright 2020 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +# tasks file for k8s +- name: debug msg + debug: + msg: transfering MEP kubeconfig files to MECM Server + +- name: Transfer kubeconfig files from all MEP Nodes to MEP Server + run_once: yes + copy: + src: /root/.kube/kubeconfig + dest: / diff --git a/ocd/infra/playbooks/roles/mepconfig/tasks/main.yml b/ocd/infra/playbooks/roles/mepconfig/tasks/main.yml new file mode 100644 index 0000000..a3fc9af --- /dev/null +++ b/ocd/infra/playbooks/roles/mepconfig/tasks/main.yml @@ -0,0 +1,21 @@ +# Copyright 2020 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +# tasks file for kubeconfig transfer +- include: "install.yml" + when: operation == 'install' + +#- include: "uninstall.yml" + #when: operation == 'uninstall' diff --git a/ocd/infra/playbooks/roles/mepkubeconfig/tasks/install.yml b/ocd/infra/playbooks/roles/mepkubeconfig/tasks/install.yml new file mode 100644 index 0000000..334a9e4 --- /dev/null +++ b/ocd/infra/playbooks/roles/mepkubeconfig/tasks/install.yml @@ -0,0 +1,26 @@ +# Copyright 2020 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +# tasks file for k8s +- name: debug msg + debug: + msg: transfering mep config file to OCD Host + +- name: Fetch the file from the mep edge nodes to ocd-host + run_once: yes + fetch: + src: /root/.kube/config + dest: /root/.kube/kubeconfig/{{ ansible_host }} + flat: yes diff --git a/ocd/infra/playbooks/roles/mepkubeconfig/tasks/main.yml b/ocd/infra/playbooks/roles/mepkubeconfig/tasks/main.yml new file mode 100644 index 0000000..1f281b4 --- /dev/null +++ b/ocd/infra/playbooks/roles/mepkubeconfig/tasks/main.yml @@ -0,0 +1,18 @@ +# Copyright 2020 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +# tasks file for kubeconfig transfer +- include: "install.yml" + when: operation == 'install' -- 2.16.6