summaryrefslogtreecommitdiffstats
path: root/playbooks
diff options
context:
space:
mode:
authorGeorg Kunz <georg.kunz@est.tech>2020-08-27 16:53:01 +0200
committerRihab Banday <rihab.banday@ericsson.com>2020-09-22 10:28:50 +0000
commit539ca86edf00318aed36f0a75e3ecf4015dbfebe (patch)
treea3479e0f44f02d49da5ea4d87789c4baafba2acb /playbooks
parentd6b6f689cd9fe89542a1146f8ac316ae739d3679 (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>
Diffstat (limited to 'playbooks')
-rw-r--r--playbooks/bmra-config.yaml17
-rw-r--r--playbooks/roles/bmra-config/tasks/main.yaml4
-rw-r--r--playbooks/roles/bmra-config/templates/inventory.ini20
3 files changed, 41 insertions, 0 deletions
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]