summaryrefslogtreecommitdiffstats
path: root/xci/playbooks/roles/create-vm-nodes/tasks/main.yml
diff options
context:
space:
mode:
authorManuel Buil <mbuil@suse.com>2018-06-25 10:57:02 +0100
committerMarkos Chandras <mchandras@suse.de>2018-06-26 16:29:05 +0100
commit92fc2a3c43305532b885ef70201f363204b69a3b (patch)
tree721d8fdbfb21ed641c005f725bbd3eda5453ce24 /xci/playbooks/roles/create-vm-nodes/tasks/main.yml
parentf6b2b8c16982b47570cadca36bce9c8906630776 (diff)
xci: roles: create-vm-nodes: Add role for creating XCI VM nodes
Add a new role based on the bifrost one to create nodes for the bifrost virtual deployments. This role will install and configure libvirt on the host, download a prebuilt OPNFV VM image and deploy the OPNFV VM using that image. Moreover, it will create the rest of the nodes for the virtual deployment which will be configured by bifrost later on. Change-Id: I9fbd084261351d3b53ae373060f43df046191c5e Co-Authored-by: Markos Chandras <mchandras@suse.de> Signed-off-by: Manuel Buil <mbuil@suse.com>
Diffstat (limited to 'xci/playbooks/roles/create-vm-nodes/tasks/main.yml')
-rw-r--r--xci/playbooks/roles/create-vm-nodes/tasks/main.yml49
1 files changed, 49 insertions, 0 deletions
diff --git a/xci/playbooks/roles/create-vm-nodes/tasks/main.yml b/xci/playbooks/roles/create-vm-nodes/tasks/main.yml
new file mode 100644
index 00000000..7e0090e4
--- /dev/null
+++ b/xci/playbooks/roles/create-vm-nodes/tasks/main.yml
@@ -0,0 +1,49 @@
+---
+# baremetal_json_file could be the file coming from pdf/idf
+
+- name: "Load distribution defaults"
+ include_vars: "{{ ansible_os_family | lower }}.yml"
+
+# From the previous list
+- name: "Install required packages"
+ package:
+ name: "{{ required_packages }}"
+
+- include_tasks: prepare_libvirt.yml
+- include_tasks: download_opnfvimage.yml
+
+- name: create placeholder var for vm entries in JSON format
+ set_fact:
+ nodes_json_data: {}
+
+# First we create the opnfv_vm
+- include_tasks: create_vm.yml
+ with_items: "{{ [opnfv_vm] + nodes }}"
+
+- name: Start the opnfv vm
+ virt:
+ command: start
+ name: opnfv
+
+- name: remove previous baremetal data file
+ file:
+ state: absent
+ path: "{{ baremetal_json_file }}"
+
+# We got nodes_json_data from the create_vm playbook
+- name: write to baremetal json file
+ copy:
+ dest: "{{ baremetal_json_file }}"
+ content: "{{ nodes_json_data | to_nice_json }}"
+
+- debug: var=nodes_json_data
+
+- name: >
+ "Set file permissions such that the baremetal data file
+ can be read by the user executing Ansible"
+ file:
+ path: "{{ baremetal_json_file }}"
+ owner: "{{ ansible_env.SUDO_USER }}"
+ when: >
+ ansible_env.SUDO_USER is defined and
+ baremetal_json_file != ""