diff options
author | Manuel Buil <mbuil@suse.com> | 2018-10-03 18:18:05 +0200 |
---|---|---|
committer | Manuel Buil <mbuil@suse.com> | 2018-10-03 19:44:03 +0200 |
commit | f54c78e2c36d7db53260bc868b5b538cb8e9d911 (patch) | |
tree | f4a7954c1e283a55eb051df3043aa82efc479713 /xci/playbooks/roles/create-nodes/tasks/main.yml | |
parent | 6158af2f83842e3d6bdcba8c7ba93b4116b405ae (diff) |
[Baremetal] - Change roles and playbooks names
A few playbooks and the create-vm-nodes role should change the name to
reflect the new reality once the baremetal patches are merged. The
playbooks that must change the name are:
- xci-prepare-virtual.yml
- xci-create-virtual.yml
Change-Id: Iaed1f93561fa9d39c7916e0643a5445cdddf4f97
Signed-off-by: Manuel Buil <mbuil@suse.com>
Diffstat (limited to 'xci/playbooks/roles/create-nodes/tasks/main.yml')
-rw-r--r-- | xci/playbooks/roles/create-nodes/tasks/main.yml | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/xci/playbooks/roles/create-nodes/tasks/main.yml b/xci/playbooks/roles/create-nodes/tasks/main.yml new file mode 100644 index 00000000..64857d80 --- /dev/null +++ b/xci/playbooks/roles/create-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_indexed_items: "{{ [opnfv_vm_pdf] + 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 != "" |