diff options
author | Georg Kunz <georg.kunz@est.tech> | 2020-08-27 16:53:01 +0200 |
---|---|---|
committer | Rihab Banday <rihab.banday@ericsson.com> | 2020-09-22 10:28:50 +0000 |
commit | 539ca86edf00318aed36f0a75e3ecf4015dbfebe (patch) | |
tree | a3479e0f44f02d49da5ea4d87789c4baafba2acb | |
parent | d6b6f689cd9fe89542a1146f8ac316ae739d3679 (diff) |
Rendering BMRA inventory from IDF and PDF via ansible
This patch adds a simple playbook which renders the BMRA inventory
from the supplied set of PDF and IDF.
Signed-off-by: Georg Kunz <georg.kunz@est.tech>
Change-Id: I2cd555440ad51594d5a2b482bfad085769d0e4e0
Reviewed-on: https://gerrit.opnfv.org/gerrit/c/kuberef/+/70892
Tested-by: jenkins-ci <jenkins-opnfv-ci@opnfv.org>
Reviewed-by: Rihab Banday <rihab.banday@ericsson.com>
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | deploy.env | 2 | ||||
-rwxr-xr-x | deploy.sh | 6 | ||||
-rw-r--r-- | hw_config/ericsson-pod1/idf.yaml | 6 | ||||
-rw-r--r-- | hw_config/ericsson-pod2/idf.yaml | 14 | ||||
-rw-r--r-- | playbooks/bmra-config.yaml | 17 | ||||
-rw-r--r-- | playbooks/roles/bmra-config/tasks/main.yaml | 4 | ||||
-rw-r--r-- | playbooks/roles/bmra-config/templates/inventory.ini | 20 | ||||
-rw-r--r-- | sw_config/bmra/inventory.ini | 18 |
9 files changed, 59 insertions, 32 deletions
@@ -3,8 +3,8 @@ user-data *.swp **/.DS_Store **/._.DS_Store -kuberef/inventory/group_vars/all/idf.yaml -kuberef/inventory/group_vars/all/pdf.yaml +inventory/group_vars/all/idf.yaml +inventory/group_vars/all/pdf.yaml images workspace .tox @@ -1,6 +1,6 @@ # Define environment variables -export VENDOR=${VENDOR:-intel} +export VENDOR=${VENDOR:-ericsson-pod2} export INSTALLER=bmra # Name of host bridge to which the VM is connected to (used for PXE) @@ -43,6 +43,12 @@ ansible-playbook -i "$CURRENTPATH"/inventory/localhost.ini \ "$CURRENTPATH"/playbooks/jump-vm.yaml # --------------------------------------------------------------------- +# Create BMRA config based on IDF and PDF +# --------------------------------------------------------------------- +ansible-playbook -i "$CURRENTPATH"/inventory/localhost.ini \ + "$CURRENTPATH"/playbooks/bmra-config.yaml + +# --------------------------------------------------------------------- # Copy files needed by Infra engine & BMRA in the jumphost VM # --------------------------------------------------------------------- copy_files_jump diff --git a/hw_config/ericsson-pod1/idf.yaml b/hw_config/ericsson-pod1/idf.yaml index 4f04bdb..e3da857 100644 --- a/hw_config/ericsson-pod1/idf.yaml +++ b/hw_config/ericsson-pod1/idf.yaml @@ -31,15 +31,15 @@ idf: - 8.8.8.8 kubespray: &idf_kubespray nodes_roles: - node1: [k8s-cluster, kube-node, kube-master, etcd, vault] + node1: [k8s-cluster, kube-master, etcd, vault] node2: [k8s-cluster, kube-node] groups: k8s-cluster: - kube-node - kube-master hostnames: - node1: master0 - node2: node0 + node1: master1 + node2: node1 network: # network mapping network_mapping: diff --git a/hw_config/ericsson-pod2/idf.yaml b/hw_config/ericsson-pod2/idf.yaml index a0215f7..9aee186 100644 --- a/hw_config/ericsson-pod2/idf.yaml +++ b/hw_config/ericsson-pod2/idf.yaml @@ -18,7 +18,6 @@ idf: gateway: 10.0.20.1 mask: 24 dns: - - 192.168.1.200 - 8.8.8.8 public: interface: 1 @@ -27,11 +26,10 @@ idf: gateway: 100.64.201.1 mask: 24 dns: - - 192.168.1.200 - 8.8.8.8 kubespray: &idf_kubespray nodes_roles: - node1: [k8s-cluster, kube-node, kube-master, etcd, vault] + node1: [k8s-cluster, kube-master, etcd, vault] node2: [k8s-cluster, kube-node] node3: [k8s-cluster, kube-node] node4: [k8s-cluster, kube-node] @@ -41,11 +39,11 @@ idf: - kube-node - kube-master hostnames: - node1: master0 - node2: node0 - node3: node1 - node4: node2 - node5: node3 + node1: master1 + node2: node1 + node3: node2 + node4: node3 + node5: node4 network: # network mapping network_mapping: diff --git a/playbooks/bmra-config.yaml b/playbooks/bmra-config.yaml new file mode 100644 index 0000000..5b020f1 --- /dev/null +++ b/playbooks/bmra-config.yaml @@ -0,0 +1,17 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) Ericsson AB and others +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +- hosts: localhost + connection: local + gather_facts: false + become: false + + roles: + - role: bmra-config diff --git a/playbooks/roles/bmra-config/tasks/main.yaml b/playbooks/roles/bmra-config/tasks/main.yaml new file mode 100644 index 0000000..19b011a --- /dev/null +++ b/playbooks/roles/bmra-config/tasks/main.yaml @@ -0,0 +1,4 @@ +- name: write BMRA config + template: + src: "inventory.ini" + dest: "{{ kuberef_root }}/sw_config/bmra/inventory.ini" diff --git a/playbooks/roles/bmra-config/templates/inventory.ini b/playbooks/roles/bmra-config/templates/inventory.ini new file mode 100644 index 0000000..48ca5fd --- /dev/null +++ b/playbooks/roles/bmra-config/templates/inventory.ini @@ -0,0 +1,20 @@ +[all] +{% for node in nodes %} +{{ idf.kubespray.hostnames[node.name] }} ansible_host={{ node.interfaces[idf.net_config[engine.pxe_network].interface].address }} ip={{ node.interfaces[idf.net_config[engine.pxe_network].interface].address }} +{% endfor %} + +{% for role in ['kube-master', 'etcd', 'kube-node'] %} +[{{ role }}] +{% for node in nodes %} +{% if role in idf.kubespray.nodes_roles[node.name] %} +{{ idf.kubespray.hostnames[node.name] }} +{% endif %} +{% endfor %} + +{% endfor %} + +[k8s-cluster:children] +kube-master +kube-node + +[calico-rr] diff --git a/sw_config/bmra/inventory.ini b/sw_config/bmra/inventory.ini deleted file mode 100644 index 9fb9f41..0000000 --- a/sw_config/bmra/inventory.ini +++ /dev/null @@ -1,18 +0,0 @@ -[all] -master1 ansible_host=10.10.190.202 ip=10.10.190.202 -node1 ansible_host=10.10.190.203 ip=10.10.190.203 - -[kube-master] -master1 - -[etcd] -master1 - -[kube-node] -node1 - -[k8s-cluster:children] -kube-master -kube-node - -[calico-rr] |