From 556f4ba31091a2baf70d4f6ac46717ff34dd48e1 Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Mon, 10 Feb 2020 16:54:04 -0700 Subject: [PATCH] Node import playbook Include an example playbook that does node import and introspection into ironic for the deployment. Change-Id: I40ef775178f8cc11e21e33e7da236055d5928a4f --- playbooks/README.md | 1 + playbooks/import-nodes.yml | 51 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 playbooks/import-nodes.yml diff --git a/playbooks/README.md b/playbooks/README.md index d2dd3d1..a4e5f7b 100644 --- a/playbooks/README.md +++ b/playbooks/README.md @@ -8,5 +8,6 @@ tailored to your specific requirements. Examples -------- +* `import-nodes.yml` - Baremetal node import and introspection playbook * `standalone.yml` - Standalone playbook for PoC * `undercloud.yml` - Undercloud installation playbook diff --git a/playbooks/import-nodes.yml b/playbooks/import-nodes.yml new file mode 100644 index 0000000..037e379 --- /dev/null +++ b/playbooks/import-nodes.yml @@ -0,0 +1,51 @@ +--- +############################################################################### +# Overcloud node import and introspection playbook +# +# Description: +# This is a basic playbook to import overcloud nodes and kick off node +# introspection. +# +############################################################################### +- hosts: undercloud + collections: + - tripleo.operator + vars: + node_debug: true + node_introspect: true + node_environment_source_json_file: environment.json + tasks: + - name: Gather the rpm package facts + package_facts: + + - name: Check if tripleoclient is installed + fail: + msg: >- + TripleO Client is not installed. Please make sure that the client + has been installed and the repositories are properly configured. + when: (ansible_facts.distribution_major_version|int <= 7 and not 'python2-tripleoclient' in ansible_facts.packages) or + (ansible_facts.distribution_major_version|int >= 8 and not 'python3-tripleoclient' in ansible_facts.packages) + + - name: Copy environment file to the undercloud + copy: + src: "{{ node_environment_source_json_file }}" + dest: "{{ ansible_env.HOME }}/environment.json" + owner: "{{ ansible_env.USER }}" + mode: "0600" + + - name: Run node import + include_role: + name: tripleo_overcloud_node_import + vars: + tripleo_overcloud_node_import_debug: "{{ node_debug }}" + tripleo_overcloud_node_import_environment_file: "{{ ansible_env.HOME }}/environment.json" + + # NOTE(mwhahaha): We can do these actions during import, not sure which is better. + - name: Run node introspection + include_role: + name: tripleo_overcloud_node_introspect + vars: + tripleo_overcloud_node_introspect_debug: "{{ node_debug }}" + tripleo_overcloud_node_introspect_all_manageable: true + tripleo_overcloud_node_introspect_provide: true + when: node_introspect|bool