From f64068a349d4e9bccc3f300c315f0a362309aece Mon Sep 17 00:00:00 2001 From: Wesley Hayutin Date: Tue, 3 May 2016 12:39:43 -0400 Subject: [PATCH 01/11] first commit --- .gitignore | 2 + .gitreview | 5 ++ README.md | 38 ++++++++++ defaults/main.yml | 2 + handlers/main.yml | 2 + meta/main.yml | 173 ++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 37 ++++++++++ setup.py | 19 +++++ tasks/main.yml | 2 + tests/inventory | 1 + tests/test.yml | 5 ++ vars/main.yml | 2 + 12 files changed, 288 insertions(+) create mode 100644 .gitignore create mode 100644 .gitreview create mode 100644 README.md create mode 100644 defaults/main.yml create mode 100644 handlers/main.yml create mode 100644 meta/main.yml create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 tasks/main.yml create mode 100644 tests/inventory create mode 100644 tests/test.yml create mode 100644 vars/main.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..7fdea582c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.pyc +*.egg-info diff --git a/.gitreview b/.gitreview new file mode 100644 index 000000000..5a6ba0a9d --- /dev/null +++ b/.gitreview @@ -0,0 +1,5 @@ +[gerrit] +host=review.gerrithub.io +port=29418 +project=redhat-openstack/ansible-role-tripleo-baremetal-undercloud.git +defaultbranch=master diff --git a/README.md b/README.md new file mode 100644 index 000000000..225dd44b9 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 000000000..f54291f60 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for ansible-role-tripleo-baremetal-undercloud diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 000000000..faa7d64b9 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for ansible-role-tripleo-baremetal-undercloud diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 000000000..c764a1304 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,173 @@ +galaxy_info: + author: your name + description: + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Some suggested licenses: + # - BSD (default) + # - MIT + # - GPLv2 + # - GPLv3 + # - Apache + # - CC-BY + license: license (GPLv2, CC-BY, etc) + + min_ansible_version: 1.2 + + # Optionally specify the branch Galaxy will use when accessing the GitHub + # repo for this role. During role install, if no tags are available, + # Galaxy will use this branch. During import Galaxy will access files on + # this branch. If travis integration is cofigured, only notification for this + # branch will be accepted. Otherwise, in all cases, the repo's default branch + # (usually master) will be used. + #github_branch: + + # + # Below are all platforms currently available. Just uncomment + # the ones that apply to your role. If you don't see your + # platform on this list, let us know and we'll get it added! + # + #platforms: + #- name: EL + # versions: + # - all + # - 5 + # - 6 + # - 7 + #- name: GenericUNIX + # versions: + # - all + # - any + #- name: Solaris + # versions: + # - all + # - 10 + # - 11.0 + # - 11.1 + # - 11.2 + # - 11.3 + #- name: Fedora + # versions: + # - all + # - 16 + # - 17 + # - 18 + # - 19 + # - 20 + # - 21 + # - 22 + # - 23 + #- name: opensuse + # versions: + # - all + # - 12.1 + # - 12.2 + # - 12.3 + # - 13.1 + # - 13.2 + #- name: IOS + # versions: + # - all + # - any + #- name: SmartOS + # versions: + # - all + # - any + #- name: eos + # versions: + # - all + # - Any + #- name: Windows + # versions: + # - all + # - 2012R2 + #- name: Amazon + # versions: + # - all + # - 2013.03 + # - 2013.09 + #- name: GenericBSD + # versions: + # - all + # - any + #- name: Junos + # versions: + # - all + # - any + #- name: FreeBSD + # versions: + # - all + # - 10.0 + # - 10.1 + # - 10.2 + # - 8.0 + # - 8.1 + # - 8.2 + # - 8.3 + # - 8.4 + # - 9.0 + # - 9.1 + # - 9.1 + # - 9.2 + # - 9.3 + #- name: Ubuntu + # versions: + # - all + # - lucid + # - maverick + # - natty + # - oneiric + # - precise + # - quantal + # - raring + # - saucy + # - trusty + # - utopic + # - vivid + # - wily + # - xenial + #- name: SLES + # versions: + # - all + # - 10SP3 + # - 10SP4 + # - 11 + # - 11SP1 + # - 11SP2 + # - 11SP3 + #- name: GenericLinux + # versions: + # - all + # - any + #- name: NXOS + # versions: + # - all + # - any + #- name: Debian + # versions: + # - all + # - etch + # - jessie + # - lenny + # - sid + # - squeeze + # - stretch + # - wheezy + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is + # a keyword that describes and categorizes the role. + # Users find roles by searching for tags. Be sure to + # remove the '[]' above if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of + # alphanumeric characters. Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. + # Be sure to remove the '[]' above if you add dependencies + # to this list. \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000..3d1243992 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,37 @@ +[metadata] +name = ansible-role-tripleo-baremetal-undercloud +summary = ansible-role-tripleo-baremetal-undercloud - A ansible role for deploying a tripleo overcloud +description-file = + README.md +author = RDO-CI Team +author-email = mbultel@redhat.com, whayutin@redhat.com +home-page = https://github.com/redhat-openstack/ansible-role-tripleo-baremetal-undercloud +classifier = + License :: OSI Approved :: Apache Software License + Development Status :: 4 - Beta + Intended Audience :: Developers + Intended Audience :: System Administrators + Intended Audience :: Information Technology + Topic :: Utilities + +[global] +setup-hooks = + pbr.hooks.setup_hook + +[files] +data_files = + usr/local/share/ansible-role-tripleo-baremetal-undercloud/defaults = ../ansible-role-tripleo-baremetal-undercloud/defaults/* + usr/local/share/ansible-role-tripleo-baremetal-undercloud/handlers = ../ansible-role-tripleo-baremetal-undercloud/handlers/* + usr/local/share/ansible-role-tripleo-baremetal-undercloud/meta = ../ansible-role-tripleo-baremetal-undercloud/meta/* + usr/local/share/ansible-role-tripleo-baremetal-undercloud/tasks = ../ansible-role-tripleo-baremetal-undercloud/tasks/* + usr/local/share/ansible-role-tripleo-baremetal-undercloud/templates = ../ansible-role-tripleo-baremetal-undercloud/templates/* + usr/local/share/ansible-role-tripleo-baremetal-undercloud/files = ../ansible-role-tripleo-baremetal-undercloud/files/* + usr/local/share/ansible-role-tripleo-baremetal-undercloud/tests = ../ansible-role-tripleo-baremetal-undercloud/tests/* + usr/local/share/ansible-role-tripleo-baremetal-undercloud/vars = ../ansible-role-tripleo-baremetal-undercloud/vars/* + +[wheel] +universal = 1 + +[pbr] +skip_authors = True +skip_changelog = True diff --git a/setup.py b/setup.py new file mode 100644 index 000000000..6a931a61c --- /dev/null +++ b/setup.py @@ -0,0 +1,19 @@ +# Copyright Red Hat, Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import setuptools + +setuptools.setup( + setup_requires=['pbr'], + pbr=True) diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 000000000..b7a76a4cf --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,2 @@ +--- +# tasks file for ansible-role-tripleo-baremetal-undercloud diff --git a/tests/inventory b/tests/inventory new file mode 100644 index 000000000..d18580b3c --- /dev/null +++ b/tests/inventory @@ -0,0 +1 @@ +localhost \ No newline at end of file diff --git a/tests/test.yml b/tests/test.yml new file mode 100644 index 000000000..3f3e5702b --- /dev/null +++ b/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - ansible-role-tripleo-baremetal-undercloud \ No newline at end of file diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 000000000..b1329957e --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for ansible-role-tripleo-baremetal-undercloud From 04a3e431bf04e8a1b56cb442dff17428cfea3f7c Mon Sep 17 00:00:00 2001 From: Raoul Scarazzini Date: Thu, 5 May 2016 12:00:04 -0400 Subject: [PATCH 02/11] Role creation This first version does a very similar sequence of operations to tripleo-quickstart undercloud installation. Omitting all the parts related to the virtual, treats virthost and undercloud as the same machine, uses a conditional on variable release for valuing STABLE_RELEASE and does these tasks: - Provide baremetal machine which will become both virthost/undercloud; - Prepare the undercloud copying all necessary files; - Execute the pre installation script; - Install the undercloud; - Take overcloud images; The baremetal-undercloud.yml inside the playbooks directory gives a way to invoke this role. For this role to work with all the others to get an environment ready to use these baremetal patches must be applied to the respective roles: - ansible-role-tripleo-inventory [1] - ansible-role-tripleo-undercloud-post [2] - ansible-role-tripleo-overcloud [3] [1] https://review.gerrithub.io/#/c/274491/ [2] https://review.gerrithub.io/#/c/275333/ [3] https://review.gerrithub.io/#/c/275011/ Change-Id: I773d0d2f36284c41c646410f47c357323262efc0 --- LICENSE | 202 +++++++++++++++ defaults/main.yml | 25 +- playbooks/baremetal-undercloud.yml | 48 ++++ setup.cfg | 21 +- tasks/machine-provisioning.yml | 4 + tasks/machine-setup.yml | 86 +++++++ tasks/main.yml | 28 +++ tasks/overcloud-images.yml | 4 + tasks/undercloud-install.yml | 4 + tasks/undercloud-pre-install.yml | 4 + tasks/undercloud-scripts.yml | 23 ++ templates/overcloud-images.sh.j2 | 17 ++ templates/undercloud-install.sh.j2 | 10 + templates/undercloud-pre-install.sh.j2 | 47 ++++ templates/undercloud.conf.j2 | 335 +++++++++++++++++++++++++ 15 files changed, 846 insertions(+), 12 deletions(-) create mode 100644 LICENSE create mode 100644 playbooks/baremetal-undercloud.yml create mode 100644 tasks/machine-provisioning.yml create mode 100644 tasks/machine-setup.yml create mode 100644 tasks/overcloud-images.yml create mode 100644 tasks/undercloud-install.yml create mode 100644 tasks/undercloud-pre-install.yml create mode 100644 tasks/undercloud-scripts.yml create mode 100644 templates/overcloud-images.sh.j2 create mode 100644 templates/undercloud-install.sh.j2 create mode 100644 templates/undercloud-pre-install.sh.j2 create mode 100644 templates/undercloud.conf.j2 diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..8f71f43fe --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/defaults/main.yml b/defaults/main.yml index f54291f60..a5fbce61d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,2 +1,23 @@ ---- -# defaults file for ansible-role-tripleo-baremetal-undercloud +working_dir: /home/stack + +non_root_user: stack +undercloud_key: "{{ local_working_dir }}/id_rsa_undercloud" + +baremetal_provisioning_log: "{{ local_working_dir }}/baremetal_provision.log" + +undercloud_config_file: undercloud.conf.j2 +undercloud_pre_install_script: undercloud-pre-install.sh.j2 +undercloud_install_script: undercloud-install.sh.j2 +undercloud_pre_install_log: "{{ working_dir }}/undercloud_pre_install.log" +undercloud_install_log: "{{ working_dir }}/undercloud_install.log" + +overcloud_images_script: overcloud-images.sh.j2 +overcloud_images_log: "{{ working_dir }}/overcloud_images.log" + +undercloud_local_interface: eth1 +undercloud_network_cidr: 192.0.2.0/24 + +step_provide_undercloud: true +step_prepare_undercloud: true +step_install_undercloud: true +step_overcloud_images: true diff --git a/playbooks/baremetal-undercloud.yml b/playbooks/baremetal-undercloud.yml new file mode 100644 index 000000000..1b1fdbec9 --- /dev/null +++ b/playbooks/baremetal-undercloud.yml @@ -0,0 +1,48 @@ +--- +- name: Baremetal undercloud install + hosts: localhost + roles: + - tripleo-baremetal-undercloud + tags: + - undercloud-bm-install + +- name: Inventory the undercloud + hosts: localhost + vars: + inventory: undercloud + roles: + - tripleo-inventory + tags: + - undercloud-inventory + +- name: Post undercloud install steps + hosts: undercloud + roles: + - tripleo-undercloud-post + tags: + - undercloud-post-install + +- name: Deploy the overcloud + hosts: undercloud + gather_facts: no + roles: + - tripleo-overcloud + tags: + - overcloud-deploy + +- name: Inventory the overcloud + hosts: undercloud + vars: + inventory: all + roles: + - tripleo-inventory + tags: + - overcloud-inventory + +- name: validate the overcloud + hosts: undercloud + gather_facts: no + roles: + - tripleo-overcloud-validate + tags: + - overcloud-validate diff --git a/setup.cfg b/setup.cfg index 3d1243992..7ef913802 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,10 +1,10 @@ [metadata] name = ansible-role-tripleo-baremetal-undercloud -summary = ansible-role-tripleo-baremetal-undercloud - A ansible role for deploying a tripleo overcloud +summary = ansible-role-tripleo-baremetal-undercloud - A ansible role for deploying a tripleo overcloud via baremetal undercloud description-file = README.md author = RDO-CI Team -author-email = mbultel@redhat.com, whayutin@redhat.com +author-email = rscarazz@redhat.com home-page = https://github.com/redhat-openstack/ansible-role-tripleo-baremetal-undercloud classifier = License :: OSI Approved :: Apache Software License @@ -20,14 +20,15 @@ setup-hooks = [files] data_files = - usr/local/share/ansible-role-tripleo-baremetal-undercloud/defaults = ../ansible-role-tripleo-baremetal-undercloud/defaults/* - usr/local/share/ansible-role-tripleo-baremetal-undercloud/handlers = ../ansible-role-tripleo-baremetal-undercloud/handlers/* - usr/local/share/ansible-role-tripleo-baremetal-undercloud/meta = ../ansible-role-tripleo-baremetal-undercloud/meta/* - usr/local/share/ansible-role-tripleo-baremetal-undercloud/tasks = ../ansible-role-tripleo-baremetal-undercloud/tasks/* - usr/local/share/ansible-role-tripleo-baremetal-undercloud/templates = ../ansible-role-tripleo-baremetal-undercloud/templates/* - usr/local/share/ansible-role-tripleo-baremetal-undercloud/files = ../ansible-role-tripleo-baremetal-undercloud/files/* - usr/local/share/ansible-role-tripleo-baremetal-undercloud/tests = ../ansible-role-tripleo-baremetal-undercloud/tests/* - usr/local/share/ansible-role-tripleo-baremetal-undercloud/vars = ../ansible-role-tripleo-baremetal-undercloud/vars/* + playbooks = playbooks/* + usr/local/share/ansible/roles/tripleo-baremetal-undercloud/defaults = defaults/* + usr/local/share/ansible/roles/tripleo-baremetal-undercloud/handlers = handlers/* + usr/local/share/ansible/roles/tripleo-baremetal-undercloud/meta = meta/* + usr/local/share/ansible/roles/tripleo-baremetal-undercloud/tasks = tasks/* + usr/local/share/ansible/roles/tripleo-baremetal-undercloud/templates = templates/* + usr/local/share/ansible/roles/tripleo-baremetal-undercloud/files = files/* + usr/local/share/ansible/roles/tripleo-baremetal-undercloud/tests = tests/* + usr/local/share/ansible/roles/tripleo-baremetal-undercloud/vars = vars/* [wheel] universal = 1 diff --git a/tasks/machine-provisioning.yml b/tasks/machine-provisioning.yml new file mode 100644 index 000000000..0283db9f4 --- /dev/null +++ b/tasks/machine-provisioning.yml @@ -0,0 +1,4 @@ +- name: Provision script execution + shell: > + {{ baremetal_provisioning_script }} > {{ baremetal_provisioning_log }} 2>&1 + when: step_provide_undercloud diff --git a/tasks/machine-setup.yml b/tasks/machine-setup.yml new file mode 100644 index 000000000..18c5dfb19 --- /dev/null +++ b/tasks/machine-setup.yml @@ -0,0 +1,86 @@ +- name: Check that virthost/undercloud is set + fail: + msg: "You need to set virthost/undercloud before running these playbooks." + when: virthost is not defined + +- name: Ensure local working dir exists + file: + path: "{{ local_working_dir }}" + state: directory + +- name: Create empty ssh config file + file: + path: "{{ local_working_dir }}/ssh.config.ansible" + state: touch + +- name: Add the virthost to the inventory + add_host: + name: "{{ virthost }}" + groups: "virthost" + ansible_fqdn: "{{ virthost }}" + ansible_user: "root" + ansible_host: "{{ virthost }}" + +- name: Create virthost/undercloud access key + command: > + ssh-keygen -f {{ undercloud_key }} -N '' + -C 'ansible_generated_virt_host' + -t rsa -b 4096 + args: + creates: "{{ undercloud_key }}" + +- name: Create non-root user on virthost/undercloud + delegate_to: "{{ virthost }}" + user: + name: "{{ non_root_user }}" + state: present + shell: /bin/bash + become: true + +- name: Configure non-root user authorized_keys on virthost/undercloud + delegate_to: "{{ virthost }}" + authorized_key: + user: "{{ non_root_user }}" + key: "{{ item }}" + with_file: + - "{{ undercloud_key }}.pub" + become: true + +- name: Grant sudo privileges to non-root user on virthost/undercloud + delegate_to: "{{ virthost }}" + copy: + content: | + {{ non_root_user }} ALL=(ALL) NOPASSWD:ALL + dest: /etc/sudoers.d/{{ non_root_user }} + owner: root + group: root + mode: 0440 + become: true + +- name: get undercloud ip + delegate_to: "{{ virthost }}" + shell: ip route get 1 | awk '{print $NF;exit}' + register: registered_undercloud_ip + +- name: Re-add the virthost to the inventory + add_host: + name: "{{ virthost }}" + groups: "virthost" + ansible_fqdn: "{{ virthost }}" + ansible_user: "{{ non_root_user }}" + ansible_host: "{{ virthost }}" + ansible_private_key_file: "{{ undercloud_key }}" + +# Add the undercloud to the in-memory inventory. +- name: Add undercloud machine to inventory + add_host: + name: undercloud + groups: undercloud + ansible_host: undercloud + ansible_fqdn: undercloud + ansible_user: stack + ansible_private_key_file: "{{ undercloud_key }}" + ansible_ssh_extra_args: '-F "{{local_working_dir}}/ssh.config.ansible"' + ansible_scp_extra_args: '-F "{{local_working_dir}}/ssh.config.ansible"' + ansible_sftp_extra_args: '-F "{{local_working_dir}}/ssh.config.ansible"' + undercloud_ip: "{{ registered_undercloud_ip.stdout }}" diff --git a/tasks/main.yml b/tasks/main.yml index b7a76a4cf..74f67645a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,2 +1,30 @@ --- # tasks file for ansible-role-tripleo-baremetal-undercloud + +- include: machine-provisioning.yml + tags: + - machine-provision + +- include: machine-setup.yml + tags: + - machine-setup + +- include: undercloud-scripts.yml + delegate_to: "{{ virthost }}" + tags: + - undercloud-scripts + +- include: undercloud-pre-install.yml + delegate_to: "{{ virthost }}" + tags: + - undercloud-pre-install + +- include: undercloud-install.yml + delegate_to: "{{ virthost }}" + tags: + - undercloud-install + +- include: overcloud-images.yml + delegate_to: "{{ virthost }}" + tags: + - overcloud-images diff --git a/tasks/overcloud-images.yml b/tasks/overcloud-images.yml new file mode 100644 index 000000000..da0f79d1c --- /dev/null +++ b/tasks/overcloud-images.yml @@ -0,0 +1,4 @@ +- name: Overcloud images + shell: > + {{ working_dir }}/overcloud-images.sh > {{ overcloud_images_log }} 2>&1 + when: step_overcloud_images diff --git a/tasks/undercloud-install.yml b/tasks/undercloud-install.yml new file mode 100644 index 000000000..c10f35aae --- /dev/null +++ b/tasks/undercloud-install.yml @@ -0,0 +1,4 @@ +- name: Install the undercloud + shell: > + {{ working_dir }}/undercloud-install.sh > {{ undercloud_install_log }} 2>&1 + when: step_install_undercloud diff --git a/tasks/undercloud-pre-install.yml b/tasks/undercloud-pre-install.yml new file mode 100644 index 000000000..d7e2f9575 --- /dev/null +++ b/tasks/undercloud-pre-install.yml @@ -0,0 +1,4 @@ +- name: Preparing machine for undercloud installation + shell: > + {{ working_dir }}/undercloud-pre-install.sh > {{ undercloud_pre_install_log }} 2>&1 + when: step_prepare_undercloud diff --git a/tasks/undercloud-scripts.yml b/tasks/undercloud-scripts.yml new file mode 100644 index 000000000..bfa44bcba --- /dev/null +++ b/tasks/undercloud-scripts.yml @@ -0,0 +1,23 @@ +- name: Create undercloud configuration + template: + src: "{{ undercloud_config_file }}" + dest: "./undercloud.conf" + mode: 0600 + +- name: Create undercloud pre-install script + template: + src: "{{ undercloud_pre_install_script }}" + dest: "{{ working_dir }}/undercloud-pre-install.sh" + mode: 0755 + +- name: Create undercloud install script + template: + src: "{{ undercloud_install_script }}" + dest: "{{ working_dir }}/undercloud-install.sh" + mode: 0755 + +- name: Create overcloud image generation script + template: + src: "{{ overcloud_images_script }}" + dest: "{{ working_dir }}/overcloud-images.sh" + mode: 0755 diff --git a/templates/overcloud-images.sh.j2 b/templates/overcloud-images.sh.j2 new file mode 100644 index 000000000..d505a805f --- /dev/null +++ b/templates/overcloud-images.sh.j2 @@ -0,0 +1,17 @@ +#!/bin/bash +# Prepare overcloud images + +set -eux + +# Retrieving images +curl -O "{{ overcloud_image_url }}" +curl -O "{{ ipa_image_url }}" +for i in *.tar; do +tar xvfp $i +done + +# Checking libvirtd" +sudo systemctl restart libvirtd + +# Changing root password of the overcloud +virt-customize -a overcloud-full.qcow2 --root-password password:redhat diff --git a/templates/undercloud-install.sh.j2 b/templates/undercloud-install.sh.j2 new file mode 100644 index 000000000..41abd794a --- /dev/null +++ b/templates/undercloud-install.sh.j2 @@ -0,0 +1,10 @@ +#!/bin/bash +# Run the undercloud install + +set -eux + +{% for var in (undercloud_env_vars|default([])) %} +export {{ var }} +{% endfor %} + +openstack undercloud install diff --git a/templates/undercloud-pre-install.sh.j2 b/templates/undercloud-pre-install.sh.j2 new file mode 100644 index 000000000..8d4e88e19 --- /dev/null +++ b/templates/undercloud-pre-install.sh.j2 @@ -0,0 +1,47 @@ +#!/bin/bash +# Prepare undercloud repos + +set -eux + +# Adding static hostname into /etc/hosts +sudo sh -c 'echo "{{ registered_undercloud_ip.stdout }} $(hostname -f)" >> /etc/hosts' + +# SELinux +sudo setenforce 0 +sudo sed -i -e 's/^SELINUX.*/SELINUX=permissive/g' /etc/sysconfig/selinux + +# Firewall +sudo systemctl disable firewalld + +# Packages +sudo yum install -y ntp vim tmux openssl wget ntp ntpdate bind-utils net-tools tmux vim git lftp libguestfs-tools + +# Time +sudo yum erase -y chrony +sudo rm -f /etc/chrony* +sudo sed -i s'/^server.*//' /etc/ntp.conf +sudo sh -c 'echo "server clock.redhat.com iburst" >> /etc/ntp.conf' +sudo sh -c 'echo clock.redhat.com > /etc/ntp/step-tickers' +sudo sh -c 'echo "SYNC_HWCLOCK=yes" >> /etc/sysconfig/ntpdate' +sudo systemctl enable ntpdate +sudo systemctl enable ntpd + +# Repos +#sudo curl -o /etc/yum.repos.d/delorean.repo http://trunk.rdoproject.org/centos7-{{ release }}/current-passed-ci/delorean.repo +sudo curl -o /etc/yum.repos.d/delorean.repo http://buildlogs.centos.org/centos/7/cloud/x86_64/rdo-trunk-{{ release }}-tested/delorean.repo +sudo curl -o /etc/yum.repos.d/delorean-deps.repo http://trunk.rdoproject.org/centos7-{{ release }}/delorean-deps.repo + +{% if release == 'liberty' %} +# (trown) Install ironic-python-agent from mitaka delorean for LIO support. +# We either need to do that or include tgt from EPEL, and upstream +# ironic-python-agent project does not actually even gate the stable branch. +# I am working on getting them to remove the stable branch, which will give us +# LIO support in liberty delorean. +sudo yum install -y http://trunk.rdoproject.org/centos7/55/17/5517b8e9aea3ded1052209384b4194d2caa97541_673a78a2/openstack-ironic-python-agent-1.1.1-dev6.el7.centos.noarch.rpm http://trunk.rdoproject.org/centos7/55/17/5517b8e9aea3ded1052209384b4194d2caa97541_673a78a2/python2-ironic-python-agent-1.1.1-dev6.el7.centos.noarch.rpm +{% endif %} + +sudo yum update -y + +# Tripleo packages +sudo yum install -y yum-plugin-priorities +sudo yum install -y python-tripleoclient diff --git a/templates/undercloud.conf.j2 b/templates/undercloud.conf.j2 new file mode 100644 index 000000000..7cb0e694a --- /dev/null +++ b/templates/undercloud.conf.j2 @@ -0,0 +1,335 @@ +[DEFAULT] + +# +# From instack-undercloud +# + +# Local file path to the necessary images. The path should be a +# directory readable by the current user that contains the full set of +# images. (string value) +{% if undercloud_image_path is defined %} +image_path = {{undercloud_image_path}} +{% else %} +#image_path = . +{% endif %} + +# Fully qualified hostname (including domain) to set on the +# Undercloud. If left unset, the current hostname will be used, but +# the user is responsible for configuring all system hostname settings +# appropriately. If set, the undercloud install will configure all +# system hostname settings. (string value) +{% if undercloud_undercloud_hostname is defined %} +undercloud_hostname = {{undercloud_undercloud_hostname}} +{% else %} +#undercloud_hostname = +{% endif %} + +# Network CIDR for the Neutron-managed network for Overcloud +# instances. This should be the subnet used for PXE booting. (string +# value) +network_cidr = {{undercloud_network_cidr}} + +# IP information for the interface on the Undercloud that will be +# handling the PXE boots and DHCP for Overcloud instances. The IP +# portion of the value will be assigned to the network interface +# defined by local_interface, with the netmask defined by the prefix +# portion of the value. (string value) +local_ip = {{undercloud_local_ip|default( + '%s/%s' % (undercloud_network_cidr|nthhost(1), + undercloud_network_cidr.split('/').1))}} + +# Network gateway for the Neutron-managed network for Overcloud +# instances. This should match the local_ip above when using +# masquerading. (string value) +network_gateway = {{undercloud_network_gateway|default( + undercloud_network_cidr|nthhost(1))}} + +# Virtual IP address to use for the public endpoints of Undercloud +# services. Only used if undercloud_service_certficate is set. +# (string value) +{% if undercloud_undercloud_public_vip is defined %} +undercloud_public_vip = {{undercloud_undercloud_public_vip}} +{% else %} +#undercloud_public_vip = 192.0.2.2 +{% endif %} + +# Virtual IP address to use for the admin endpoints of Undercloud +# services. Only used if undercloud_service_certficate is set. +# (string value) +{% if undercloud_undercloud_admin_vip is defined %} +undercloud_admin_vip = {{undercloud_undercloud_admin_vip}} +{% else %} +#undercloud_admin_vip = 192.0.2.3 +{% endif %} + +# Certificate file to use for OpenStack service SSL connections. +# Setting this enables SSL for the OpenStack API endpoints, leaving it +# unset disables SSL. (string value) +#undercloud_service_certificate = + +# Network interface on the Undercloud that will be handling the PXE +# boots and DHCP for Overcloud instances. (string value) +{% if undercloud_local_interface is defined %} +local_interface = {{undercloud_local_interface}} +{% else %} +#local_interface = eth1 +{% endif %} + +# Network that will be masqueraded for external access, if required. +# This should be the subnet used for PXE booting. (string value) +masquerade_network = {{undercloud_masquerade_network|default( + undercloud_network_cidr)}} + +# Start of DHCP allocation range for PXE and DHCP of Overcloud +# instances. (string value) +dhcp_start = {{undercloud_dhcp_start|default( + undercloud_network_cidr|nthhost(5))}} + +# End of DHCP allocation range for PXE and DHCP of Overcloud +# instances. (string value) +dhcp_end = {{undercloud_dhcp_end|default( + undercloud_network_cidr|nthhost(30))}} + +# Network interface on which inspection dnsmasq will listen. If in +# doubt, use the default value. (string value) +# Deprecated group/name - [DEFAULT]/discovery_interface +{% if undercloud_inspection_interface is defined %} +inspection_interface = {{undercloud_inspection_interface}} +{% else %} +#inspection_interface = br-ctlplane +{% endif %} + +# Temporary IP range that will be given to nodes during the inspection +# process. Should not overlap with the range defined by dhcp_start +# and dhcp_end, but should be in the same network. (string value) +# Deprecated group/name - [DEFAULT]/discovery_iprange +inspection_iprange = {{undercloud_inspection_iprange|default( + '%s,%s' % (undercloud_network_cidr|nthhost(100), + undercloud_network_cidr|nthhost(120)))}} + +# Whether to run benchmarks when inspecting nodes. (boolean value) +# Deprecated group/name - [DEFAULT]/discovery_runbench +{% if undercloud_inspection_runbench is defined %} +inspection_runbench = {{undercloud_inspection_runbench}} +{% else %} +#inspection_runbench = false +{% endif %} + +# Whether to enable the debug log level for Undercloud OpenStack +# services. (boolean value) +{% if undercloud_undercloud_debug is defined %} +undercloud_debug = {{undercloud_undercloud_debug}} +{% else %} +#undercloud_debug = true +{% endif %} + +# Whether to install Tempest in the Undercloud. (boolean value) +{% if undercloud_enable_tempest is defined %} +enable_tempest = {{undercloud_enable_tempest}} +{% else %} +#enable_tempest = true +{% endif %} + +# Whether to install Mistral in the Undercloud. (boolean value) +{% if undercloud_enable_mistral is defined %} +enable_mistral = {{undercloud_enable_mistral}} +{% else %} +#enable_mistral = false +{% endif %} + +# Whether to use iPXE for deploy by default. (boolean value) +{% if undercloud_ipxe_deploy is defined %} +ipxe_deploy = {{undercloud_ipxe_deploy}} +{% else %} +#ipxe_deploy = true +{% endif %} + +# Whether to install Monitoring services in the Undercloud. (boolean +# value) +{% if undercloud_enable_monitoring is defined %} +enable_monitoring = {{undercloud_enable_monitoring}} +{% else %} +#enable_monitoring = false +{% endif %} + +[auth] + +# +# From instack-undercloud +# + +# Password used for MySQL databases. If left unset, one will be +# automatically generated. (string value) +{% if undercloud_undercloud_db_password is defined %} +undercloud_db_password = {{undercloud_undercloud_db_password}} +{% else %} +#undercloud_db_password = +{% endif %} + +# Keystone admin token. If left unset, one will be automatically +# generated. (string value) +{% if undercloud_undercloud_admin_token is defined %} +undercloud_admin_token = {{undercloud_undercloud_admin_token}} +{% else %} +#undercloud_admin_token = +{% endif %} + +# Keystone admin password. If left unset, one will be automatically +# generated. (string value) +{% if undercloud_undercloud_admin_password is defined %} +undercloud_admin_password = {{undercloud_undercloud_admin_password}} +{% else %} +#undercloud_admin_password = +{% endif %} + +# Glance service password. If left unset, one will be automatically +# generated. (string value) +{% if undercloud_undercloud_glance_password is defined %} +undercloud_glance_password = {{undercloud_undercloud_glance_password}} +{% else %} +#undercloud_glance_password = +{% endif %} + +# Heat db encryption key(must be 16, 24, or 32 characters. If left +# unset, one will be automatically generated. (string value) +{% if undercloud_undercloud_heat_encryption_key is defined %} +undercloud_heat_encryption_key = {{undercloud_undercloud_heat_encryption_key}} +{% else %} +#undercloud_heat_encryption_key = +{% endif %} + +# Heat service password. If left unset, one will be automatically +# generated. (string value) +{% if undercloud_undercloud_heat_password is defined %} +undercloud_heat_password = {{undercloud_undercloud_heat_password}} +{% else %} +#undercloud_heat_password = +{% endif %} + +# Neutron service password. If left unset, one will be automatically +# generated. (string value) +{% if undercloud_undercloud_neutron_password is defined %} +undercloud_neutron_password = {{undercloud_undercloud_neutron_password}} +{% else %} +#undercloud_neutron_password = +{% endif %} + +# Nova service password. If left unset, one will be automatically +# generated. (string value) +{% if undercloud_undercloud_nova_password is defined %} +undercloud_nova_password = {{undercloud_undercloud_nova_password}} +{% else %} +#undercloud_nova_password = +{% endif %} + +# Ironic service password. If left unset, one will be automatically +# generated. (string value) +{% if undercloud_undercloud_ironic_password is defined %} +undercloud_ironic_password = {{undercloud_undercloud_ironic_password}} +{% else %} +#undercloud_ironic_password = +{% endif %} + +# Ceilometer service password. If left unset, one will be +# automatically generated. (string value) +{% if undercloud_undercloud_ceilometer_password is defined %} +undercloud_ceilometer_password = {{undercloud_undercloud_ceilometer_password}} +{% else %} +#undercloud_ceilometer_password = +{% endif %} + +# Aodh service password. If left unset, one will be +# automatically generated. (string value) +{% if undercloud_undercloud_aodh_password is defined %} +undercloud_aodh_password = {{undercloud_undercloud_aodh_password}} +{% else %} +#undercloud_aodh_password = +{% endif %} + +# Sensu service password. If left unset, one will be automatically +# generated. (string value) +{% if undercloud_undercloud_sensu_password is defined %} +undercloud_sensu_password = {{undercloud_undercloud_sensu_password}} +{% else %} +#undercloud_sensu_password = +{% endif %} + +# Ceilometer metering secret. If left unset, one will be automatically +# generated. (string value) +{% if undercloud_undercloud_ceilometer_metering_secret is defined %} +undercloud_ceilometer_metering_secret = {{undercloud_undercloud_ceilometer_metering_secret}} +{% else %} +#undercloud_ceilometer_metering_secret = +{% endif %} + +# Ceilometer snmpd user. If left unset, one will be automatically +# generated. (string value) +{% if undercloud_undercloud_ceilometer_snmpd_user is defined %} +undercloud_ceilometer_snmpd_user = {{undercloud_undercloud_ceilometer_snmpd_user}} +{% else %} +#undercloud_ceilometer_snmpd_user = +{% endif %} + +# Ceilometer snmpd password. If left unset, one will be automatically +# generated. (string value) +{% if undercloud_undercloud_ceilometer_snmpd_password is defined %} +undercloud_ceilometer_snmpd_password = {{undercloud_undercloud_ceilometer_snmpd_password}} +{% else %} +#undercloud_ceilometer_snmpd_password = +{% endif %} + +# Swift service password. If left unset, one will be automatically +# generated. (string value) +{% if undercloud_undercloud_swift_password is defined %} +undercloud_swift_password = {{undercloud_undercloud_swift_password}} +{% else %} +#undercloud_swift_password = +{% endif %} + +# Mistral service password. If left unset, one will be automatically +# generated. (string value) +{% if undercloud_undercloud_mistral_password is defined %} +undercloud_mistral_password = {{undercloud_undercloud_mistral_password}} +{% else %} +#undercloud_mistral_password = +{% endif %} + +# Rabbitmq cookie. If left unset, one will be automatically generated. +# (string value) +{% if undercloud_undercloud_rabbit_cookie is defined %} +undercloud_rabbit_cookie = {{undercloud_undercloud_rabbit_cookie}} +{% else %} +#undercloud_rabbit_cookie = +{% endif %} + +# Rabbitmq password. If left unset, one will be automatically +# generated. (string value) +{% if undercloud_undercloud_rabbit_password is defined %} +undercloud_rabbit_password = {{undercloud_undercloud_rabbit_password}} +{% else %} +#undercloud_rabbit_password = +{% endif %} + +# Rabbitmq username. If left unset, one will be automatically +# generated. (string value) +{% if undercloud_undercloud_rabbit_username is defined %} +undercloud_rabbit_username = {{undercloud_undercloud_rabbit_username}} +{% else %} +#undercloud_rabbit_username = +{% endif %} + +# Heat stack domain admin password. If left unset, one will be +# automatically generated. (string value) +{% if undercloud_undercloud_heat_stack_domain_admin_password is defined %} +undercloud_heat_stack_domain_admin_password = {{undercloud_undercloud_heat_stack_domain_admin_password}} +{% else %} +#undercloud_heat_stack_domain_admin_password = +{% endif %} + +# Swift hash suffix. If left unset, one will be automatically +# generated. (string value) +{% if undercloud_undercloud_swift_hash_suffix is defined %} +undercloud_swift_hash_suffix = {{undercloud_undercloud_swift_hash_suffix}} +{% else %} +#undercloud_swift_hash_suffix = +{% endif %} From 52dde0065d7ad38ec864671c3b36425509b7391a Mon Sep 17 00:00:00 2001 From: Raoul Scarazzini Date: Mon, 11 Jul 2016 05:21:48 -0400 Subject: [PATCH 03/11] Add a complete README This commits adds a complete README that explains how to use this role and to implement a complete baremetal environment starting from scratch. Change-Id: I3c861e46e87ca38afa1b98932eb6585c5b802b8b --- README.md | 221 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 212 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 225dd44b9..66b0d699a 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,234 @@ -Role Name +ansible-role-tripleo-baremetal-undercloud ========= -A brief description of the role goes here. +This role aims to build a baremetal undercloud machine from scratch. Using tripleo-quickstart, this means that you will be able to provide, prepare and install the undercloud on a physical machine. + +From the tripleo-quickstart perspective virthost and undercloud will be the same host. Requirements ------------ -Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. +For make all the things working you need to have an environment with all the things in place: + +Hardware requirements + +* A physical machine for the undercloud that can be accessed as root from the jump host +* At least two other physical machines that will become controller and compute, for HA three controllers and one compute are needed +* A working network link between overcloud and undercloud, typically the second net device of the undercloud will talk to the first net device of all the overcloud machines + +Software requirements + +* The tripleo-quickstart quickstart.sh script: + * A config file (i.e. ha.yml) containing all the customizations for the baremetal environment +* This set of files, dependent from the hardware: + * File undercloud-provisioning.sh - optional, name is not important + * File network-environment.yaml - mandatory + * Directory nic-configs - mandatory if declared inside the resource_registry section in network-environment.yaml and must contain all the needed files + * File instackenv.json - mandatory, must contain the ipmi credentials for the nodes Role Variables -------------- -A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. +A typical config file will contain something like this: + + undercloud_type: baremetal + + flavor_map: + control: baremetal + compute: baremetal + storage: baremetal + ceph: baremetal + + overcloud_nodes: + - name: control_0 + flavor: baremetal + - name: control_1 + flavor: baremetal + - name: control_2 + flavor: baremetal + + - name: compute_0 + flavor: baremetal + - name: compute_1 + flavor: baremetal + + # Steps + step_introspect: true + step_introspect_with_retry: true + step_provide_undercloud: true + step_overcloud_images: true + step_install_undercloud: true + step_prepare_undercloud: true + + libvirt_type: kvm + libvirt_args: "--libvirt-type kvm" + + undercloud_local_interface: eth1 + + baremetal_provisioning_script: "/path/to/undercloud-provisioning.sh" + baremetal_network_environment: "/path/to/network-environment.yaml" + baremetal_instackenv: "/path/to/instackenv.json" + baremetal_nic_configs: "/path/to/nic_configs" + + floating_ip_cidr: "" + public_net_pool_start: "" + public_net_pool_end: "" + public_net_gateway: "" + + extra_args: "--ntp-server --control-scale 3 --compute-scale 2 --ceph-storage-scale 0 --block-storage-scale 0 --swift-storage-scale 0 --templates -e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml -e /home/stack/network-environment.yaml --neutron-bridge-mappings datacentre:br-floating" + tempest: false + +A brief explanation of the variables: + +* The variable **undercloud_type** is checked in all the dependent roles (see @Dependencies) +* A specific **flavor_map** (in this case baremetal) needs to be applied to each node kind +* The list of all the **overcloud_nodes** must be explicited +* With **step_introspect** and **step_introspect_with_retry** you can choose if you want to introspect and even retry again for host that failed introspection +* The **libvirt_type** and **libvirt_args** must be set to kvm, since we will work on baremetal with native virtual capabilities +* The **undercloud_local_interface** needs to be changed accordingly to the baremetal hardware +* If the user does not need to provide the machine, then **baremetal_provisioning_script** can be omitted while setting also **step_provide_undercloud: false** +* **baremetal_network_environment**, **baremetal_instackenv** and *optionally* **baremetal_nic_configs** will contain all the environment files. +* **extra_args** will contain all deploy specific (like HA settings) +* **tempest** will enable tempest tests +* If instances needs to be accessible from the outside network then all the parameters (so **floating_ip_cidr** and **public_net_***) of this floating network must be explicited. + +The main task of the role is this one: + + --- + # tasks file for ansible-role-tripleo-baremetal-undercloud + + - include: machine-provisioning.yml + tags: + - machine-provision + + - include: machine-setup.yml + tags: + - machine-setup + + - include: undercloud-scripts.yml + delegate_to: "{{ virthost }}" + tags: + - undercloud-scripts + + - include: undercloud-pre-install.yml + delegate_to: "{{ virthost }}" + tags: + - undercloud-pre-install + + - include: undercloud-install.yml + delegate_to: "{{ virthost }}" + tags: + - undercloud-install + + - include: overcloud-images.yml + delegate_to: "{{ virthost }}" + tags: + - overcloud-images + +Some notes about the main task file: + +* Even if virthost and undercloud are the same machine, the name “undercloud” will be inventoried after (see the baremetal playbook slide) +* Each action is tagged so it is possible to exclude a specific section, but... +* In any case some variables can be controlled via config settings: + * step_provide_undercloud: choose if you want to do machine provisioning + * step_install_repos_undercloud: choose if you want to prepare the undercloud machine wirh repositories and all the packages needed + * step_install_undercloud: choose if you want to install the undercloud + * step_overcloud_images: choose if you want to download overcloud images + +This is basically what the specific tasks does: + +* **machine-provisioning.yml** provides the machine and make it become both virthost/undercloud +* **machine-setup.yml** prepares the undercloud with ssh connections, users, sudoers and inventory addition +* **undercloud-scripts.yml** copies all the needed scripts into virthost/undercloud +* **undercloud-pre-install.yml** selinux, firewall, repositories and packages +* **undercloud-install.yml** installs the undercloud +* **overcloud-images.yml** retrieves the overcloud images Dependencies ------------ -A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. +If you don't need to change anything in how the environments gets deployed, then all the dependencies should be satisfied by the default requirements.txt file. + +In any case the roles you will need to deploy an entire environment from scratch (see @Example Playbook) are: + +* **ansible-role-tripleo-inventory** +* **ansible-role-tripleo-undercloud-post** +* **ansible-role-tripleo-overcloud** +* **ansible-role-tripleo-overcloud-validate** +* **ansible-role-tripleo-overcloud-validate-ha** (this is optional if you want to test HA capabilities) Example Playbook ---------------- -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +Here's is an example on host to use this role in combination to all the others coming from various related to tripleo-quickstart: - - hosts: servers + --- + - name: Baremetal undercloud install + hosts: localhost roles: - - { role: username.rolename, x: 42 } + - tripleo-baremetal-undercloud + tags: + - undercloud-bm-install + + - name: Inventory the undercloud + hosts: localhost + vars: + inventory: undercloud + roles: + - tripleo-inventory + tags: + - undercloud-inventory + + - name: Post undercloud install steps + hosts: undercloud + roles: + - tripleo-undercloud-post + tags: + - undercloud-post-install + + - name: Deploy the overcloud + hosts: undercloud + gather_facts: no + roles: + - tripleo-overcloud + tags: + - overcloud-deploy + + - name: Inventory the overcloud + hosts: undercloud + vars: + inventory: all + roles: + - tripleo-inventory + tags: + - overcloud-inventory + + - name: validate the overcloud + hosts: undercloud + gather_facts: no + roles: + - tripleo-overcloud-validate + tags: + - overcloud-validate + +The steps of the sample playbook are these: + +* First invoked role is tripleo-baremeal-undercloud undercloud +* Then undercloud is inventoried +* In the post task all the env files are pushed into undercloud, introspection is performed and a default route external interface is created for the overcloud network access +* Overcloud is then deployed, inventoried and validated + +Then you can invoke *quickstart.sh* like this: + + ./quickstart.sh -v --clean --playbook baremetal-undercloud.yml --working-dir /path/to/workdir --requirements /path/to/requirements.txt --config /path/to/config.yml --release mitaka --tags all + +Basically this command: + +* Uses the playbook **baremetal-undercloud.yml** +* Uses a custom workdir that is rebuilt from scratch (so if it already exists, it is dropped) +* Performs all the tasks in the playbook +* Chooses release (liberty, mitaka or “master” for newton) +* Starts the installation on virthost License ------- @@ -35,4 +238,4 @@ BSD Author Information ------------------ -An optional section for the role authors to include contact information, or a website (HTML is not allowed). +Raoul Scarazzini From 091a723b6fe008b41840e8ed17f5599d2b704a6a Mon Sep 17 00:00:00 2001 From: Raoul Scarazzini Date: Fri, 16 Sep 2016 04:45:49 -0400 Subject: [PATCH 04/11] Fix package name repetitions While installing pcakages on the undercloud there were a lot of repeated packages inside the yum install list. This commit fixes them. Change-Id: Iab7d2050a74d0e7ee4ec76d51ea9edb793d5f380 --- templates/undercloud-pre-install.sh.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/undercloud-pre-install.sh.j2 b/templates/undercloud-pre-install.sh.j2 index 8d4e88e19..b5190ed6a 100644 --- a/templates/undercloud-pre-install.sh.j2 +++ b/templates/undercloud-pre-install.sh.j2 @@ -14,7 +14,7 @@ sudo sed -i -e 's/^SELINUX.*/SELINUX=permissive/g' /etc/sysconfig/selinux sudo systemctl disable firewalld # Packages -sudo yum install -y ntp vim tmux openssl wget ntp ntpdate bind-utils net-tools tmux vim git lftp libguestfs-tools +sudo yum install -y ntp ntpdate vim tmux openssl wget bind-utils net-tools git lftp libguestfs-tools sos # Time sudo yum erase -y chrony From 702f63a6e7e9d6d7f66407b963c82680c68cf8da Mon Sep 17 00:00:00 2001 From: Raoul Scarazzini Date: Fri, 16 Sep 2016 05:07:33 -0400 Subject: [PATCH 05/11] Adding a different playbook for HA validation This commit adds a playbook which can be used to combinate the undercloud baremetal role with the HA validation, using the role ansible-role-tripleo-overcloud-validate-ha. Change-Id: I8c14029e5279456723d96b39d9d530fcfda5c1dd --- .../baremetal-undercloud-validate-ha.yml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 playbooks/baremetal-undercloud-validate-ha.yml diff --git a/playbooks/baremetal-undercloud-validate-ha.yml b/playbooks/baremetal-undercloud-validate-ha.yml new file mode 100644 index 000000000..021b8d375 --- /dev/null +++ b/playbooks/baremetal-undercloud-validate-ha.yml @@ -0,0 +1,48 @@ +--- +- name: Baremetal undercloud install + hosts: localhost + roles: + - tripleo-baremetal-undercloud + tags: + - undercloud-bm-install + +- name: Inventory the undercloud + hosts: localhost + vars: + inventory: undercloud + roles: + - tripleo-inventory + tags: + - undercloud-inventory + +- name: Post undercloud install steps + hosts: undercloud + roles: + - tripleo-undercloud-post + tags: + - undercloud-post-install + +- name: Deploy the overcloud + hosts: undercloud + gather_facts: no + roles: + - tripleo-overcloud + tags: + - overcloud-deploy + +- name: Inventory the overcloud + hosts: undercloud + vars: + inventory: all + roles: + - tripleo-inventory + tags: + - overcloud-inventory + +- name: validate the overcloud using HA tests + hosts: undercloud + gather_facts: no + roles: + - tripleo-overcloud-validate-ha + tags: + - overcloud-validate-ha From 9583f8b5a2d5049f8a8636cb96f0c23df45bb166 Mon Sep 17 00:00:00 2001 From: Raoul Scarazzini Date: Thu, 22 Sep 2016 13:04:26 -0400 Subject: [PATCH 06/11] New internal repo for artifact images This commit make overcloud_image_url point to http://209.132.178.27 to avoid problems while downloading the artifacts images. Change-Id: I7d20474b7497534751c95d5ec84cecb836867cc2 --- defaults/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/defaults/main.yml b/defaults/main.yml index a5fbce61d..054e23227 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -11,6 +11,7 @@ undercloud_install_script: undercloud-install.sh.j2 undercloud_pre_install_log: "{{ working_dir }}/undercloud_pre_install.log" undercloud_install_log: "{{ working_dir }}/undercloud_install.log" +overcloud_image_url: "http://209.132.178.27/{{ release }}/delorean/consistent/stable/" overcloud_images_script: overcloud-images.sh.j2 overcloud_images_log: "{{ working_dir }}/overcloud_images.log" From 76ddeb4d6e5d35feeb9d67131bbce4f458f41191 Mon Sep 17 00:00:00 2001 From: Raoul Scarazzini Date: Thu, 22 Sep 2016 14:09:43 -0400 Subject: [PATCH 07/11] Using wget instead of curl to download images Since curl seem not to download images correctly this commit replaces it with wget. Change-Id: If87bd027709e6a3d6c60f34cb7174062b1de253f --- templates/overcloud-images.sh.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/overcloud-images.sh.j2 b/templates/overcloud-images.sh.j2 index d505a805f..f99fa43ac 100644 --- a/templates/overcloud-images.sh.j2 +++ b/templates/overcloud-images.sh.j2 @@ -4,8 +4,8 @@ set -eux # Retrieving images -curl -O "{{ overcloud_image_url }}" -curl -O "{{ ipa_image_url }}" +wget "{{ overcloud_image_url }}" +wget "{{ ipa_image_url }}" for i in *.tar; do tar xvfp $i done From aac1a5145612e6002262ce6c1450bc37f5af1db0 Mon Sep 17 00:00:00 2001 From: Raoul Scarazzini Date: Wed, 12 Oct 2016 10:47:48 -0400 Subject: [PATCH 08/11] Revert "New internal repo for artifact images" The image url can be overridden while launching quickstart script, by using -e overcloud_image_url="". In this way it will also be globally applied and not limited to the role. This reverts commit 9583f8b5a2d5049f8a8636cb96f0c23df45bb166. Change-Id: I8fcab8982d4ee629b601e1a8d8578cfcac21f3f5 --- defaults/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 054e23227..a5fbce61d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -11,7 +11,6 @@ undercloud_install_script: undercloud-install.sh.j2 undercloud_pre_install_log: "{{ working_dir }}/undercloud_pre_install.log" undercloud_install_log: "{{ working_dir }}/undercloud_install.log" -overcloud_image_url: "http://209.132.178.27/{{ release }}/delorean/consistent/stable/" overcloud_images_script: overcloud-images.sh.j2 overcloud_images_log: "{{ working_dir }}/overcloud_images.log" From f17e85d3fcb5dacd4b65368742c344dea27ca4c7 Mon Sep 17 00:00:00 2001 From: Raoul Scarazzini Date: Fri, 4 Nov 2016 13:08:27 -0400 Subject: [PATCH 09/11] Integrate role with oooq extra roles This commit integrates this role with the actual oooq extra roles, to reuse the most of the existing stuff and keeping the scope of this role limited to what was created for. It also clean up the stuff while removing unused parts and updates documentation adding docgen compatible comments. Depends-On: https://review.gerrithub.io/#/c/301433/ Depends-On: https://review.gerrithub.io/#/c/300866/ Change-Id: I3244db150a70d6cf7429134df76ae561305e0e4a --- README.md | 246 ++++++++----- defaults/main.yml | 9 +- handlers/main.yml | 2 - meta/main.yml | 173 --------- .../baremetal-undercloud-validate-ha.yml | 84 ++++- playbooks/baremetal-undercloud.yml | 85 ++++- setup.cfg | 4 - tasks/main.yml | 18 +- tasks/overcloud-images.yml | 7 + tasks/undercloud-install.yml | 4 - tasks/undercloud-pre-install.yml | 4 - tasks/undercloud-repos-conf.yml | 12 + tasks/undercloud-scripts.yml | 23 -- templates/overcloud-images.sh.j2 | 22 +- templates/undercloud-install.sh.j2 | 10 - templates/undercloud-pre-install.sh.j2 | 47 --- templates/undercloud-repos-conf.sh.j2 | 53 +++ templates/undercloud.conf.j2 | 335 ------------------ tests/inventory | 1 - tests/test.yml | 5 - vars/main.yml | 2 - 21 files changed, 388 insertions(+), 758 deletions(-) delete mode 100644 handlers/main.yml delete mode 100644 tasks/undercloud-install.yml delete mode 100644 tasks/undercloud-pre-install.yml create mode 100644 tasks/undercloud-repos-conf.yml delete mode 100644 tasks/undercloud-scripts.yml delete mode 100644 templates/undercloud-install.sh.j2 delete mode 100644 templates/undercloud-pre-install.sh.j2 create mode 100644 templates/undercloud-repos-conf.sh.j2 delete mode 100644 templates/undercloud.conf.j2 delete mode 100644 tests/inventory delete mode 100644 tests/test.yml delete mode 100644 vars/main.yml diff --git a/README.md b/README.md index 66b0d699a..595ed58d2 100644 --- a/README.md +++ b/README.md @@ -32,130 +32,129 @@ Role Variables A typical config file will contain something like this: undercloud_type: baremetal - + + # Specify the secondary net interface for overcloud provisioning + undercloud_local_interface: eth1 + + # Specify the external network for undercloud that will be used to route overcloud traffic + undercloud_external_network_cidr: 172.20.0.0/24 + + # Declare the additional interface on undercloud to route overcloud traffic + undercloud_networks: + external: + address: 172.20.0.254 + netmask: 255.255.255.0 + device_type: ovs + type: OVSIntPort + ovs_bridge: br-ctlplane + ovs_options: '"tag=1105"' + tag: 1105 + + # Define all the flavors flavor_map: control: baremetal compute: baremetal storage: baremetal ceph: baremetal + swift: baremetal - overcloud_nodes: - - name: control_0 - flavor: baremetal - - name: control_1 - flavor: baremetal - - name: control_2 - flavor: baremetal - - - name: compute_0 - flavor: baremetal - - name: compute_1 - flavor: baremetal - - # Steps - step_introspect: true - step_introspect_with_retry: true + # To be used ansible-role-tripleo-baremetal-undercloud step_provide_undercloud: true - step_overcloud_images: true - step_install_undercloud: true - step_prepare_undercloud: true - + # To be used in ansible-role-tripleo-overcloud-prep-baremetal + step_install_upstream_ipxe: true + # To be used in ansible-role-tripleo-overcloud-prep-images + step_introspect: true + + # Explicitly declare kvm since we are on BM libvirt_type: kvm libvirt_args: "--libvirt-type kvm" - - undercloud_local_interface: eth1 - + + # Environment specific variables baremetal_provisioning_script: "/path/to/undercloud-provisioning.sh" baremetal_network_environment: "/path/to/network-environment.yaml" baremetal_instackenv: "/path/to/instackenv.json" baremetal_nic_configs: "/path/to/nic_configs" - + + # Public (Floating) network definition + public_physical_network: "floating" floating_ip_cidr: "" public_net_pool_start: "" public_net_pool_end: "" public_net_gateway: "" - + extra_args: "--ntp-server --control-scale 3 --compute-scale 2 --ceph-storage-scale 0 --block-storage-scale 0 --swift-storage-scale 0 --templates -e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml -e /home/stack/network-environment.yaml --neutron-bridge-mappings datacentre:br-floating" - tempest: false A brief explanation of the variables: -* The variable **undercloud_type** is checked in all the dependent roles (see @Dependencies) -* A specific **flavor_map** (in this case baremetal) needs to be applied to each node kind -* The list of all the **overcloud_nodes** must be explicited -* With **step_introspect** and **step_introspect_with_retry** you can choose if you want to introspect and even retry again for host that failed introspection -* The **libvirt_type** and **libvirt_args** must be set to kvm, since we will work on baremetal with native virtual capabilities -* The **undercloud_local_interface** needs to be changed accordingly to the baremetal hardware -* If the user does not need to provide the machine, then **baremetal_provisioning_script** can be omitted while setting also **step_provide_undercloud: false** +* The variable **undercloud_type** is checked in all the dependent roles (see @Dependencies). +* The **undercloud_local_interface** needs to be changed accordingly to the baremetal hardware. +* The **undercloud_external_network_cidr** will be the overcloud external network that undercloud will route. +* A specific **flavor_map** (in this case baremetal) needs to be applied to each node kind. +* With **step_provide_undercloud** you can choose if you want to provide the virthost. +* With **step_introspect** you can choose if you want to introspect nodes. +* With **step_install_upstream_ipxe** you can choose if you want to install upstream ipxe (useful with some hardware issues). +* The **libvirt_type** and **libvirt_args** must be set to kvm, since we will work on baremetal with native virtual capabilities. +* **baremetal_provisioning_script** is the script to provide the machine, if **step_provide_undercloud is false** than this can be omitted. * **baremetal_network_environment**, **baremetal_instackenv** and *optionally* **baremetal_nic_configs** will contain all the environment files. -* **extra_args** will contain all deploy specific (like HA settings) -* **tempest** will enable tempest tests * If instances needs to be accessible from the outside network then all the parameters (so **floating_ip_cidr** and **public_net_***) of this floating network must be explicited. +* **extra_args** will contain all deploy specific (like HA settings) The main task of the role is this one: --- # tasks file for ansible-role-tripleo-baremetal-undercloud - + + # Do machine provisioning - include: machine-provisioning.yml tags: - machine-provision - + + # Prepare machine to be used with TripleO - include: machine-setup.yml tags: - machine-setup - - - include: undercloud-scripts.yml + + # Configure repos and packages + - include: undercloud-repos-conf.yml delegate_to: "{{ virthost }}" tags: - - undercloud-scripts - - - include: undercloud-pre-install.yml - delegate_to: "{{ virthost }}" - tags: - - undercloud-pre-install - - - include: undercloud-install.yml - delegate_to: "{{ virthost }}" - tags: - - undercloud-install - + - undercloud-repos-conf + + # Get overcloud images - include: overcloud-images.yml delegate_to: "{{ virthost }}" tags: - overcloud-images -Some notes about the main task file: - -* Even if virthost and undercloud are the same machine, the name “undercloud” will be inventoried after (see the baremetal playbook slide) -* Each action is tagged so it is possible to exclude a specific section, but... -* In any case some variables can be controlled via config settings: - * step_provide_undercloud: choose if you want to do machine provisioning - * step_install_repos_undercloud: choose if you want to prepare the undercloud machine wirh repositories and all the packages needed - * step_install_undercloud: choose if you want to install the undercloud - * step_overcloud_images: choose if you want to download overcloud images - -This is basically what the specific tasks does: +This is basically what each specific tasks does: * **machine-provisioning.yml** provides the machine and make it become both virthost/undercloud * **machine-setup.yml** prepares the undercloud with ssh connections, users, sudoers and inventory addition -* **undercloud-scripts.yml** copies all the needed scripts into virthost/undercloud -* **undercloud-pre-install.yml** selinux, firewall, repositories and packages -* **undercloud-install.yml** installs the undercloud -* **overcloud-images.yml** retrieves the overcloud images +* **undercloud-repos-conf.yml** repositories and packages configurations +* **overcloud-images.yml** overcloud images retrieving + +Some notes: + +* Even if virthost and undercloud are the same machine, the name “undercloud” will be inventoried after (see the baremetal playbook slide) +* Each action is tagged so it is possible to exclude a specific section +* In any case some variables can be controlled via config settings: + * step_provide_undercloud: choose if you want to do undercloud machine provisioning + * step_prepare_undercloud: choose if you want to install repos and basic packages on undercloud + * step_overcloud_images: choose if you want to download overcloud images Dependencies ------------ -If you don't need to change anything in how the environments gets deployed, then all the dependencies should be satisfied by the default requirements.txt file. +If you don't need to change anything in how the environments gets deployed, then all the dependencies should be satisfied by the default **quickstart-extras-requirements.txt** file. In any case the roles you will need to deploy an entire environment from scratch (see @Example Playbook) are: -* **ansible-role-tripleo-inventory** -* **ansible-role-tripleo-undercloud-post** +* **ansible-role-tripleo-baremetal-undercloud** (this role) +* **tripleo-inventory** (part of *tripleo-quickstart*) +* **tripleo/undercloud** (part of *tripleo-quickstart*) +* **ansible-role-overcloud-prep-{baremetal,config,images,flavors,network}** * **ansible-role-tripleo-overcloud** -* **ansible-role-tripleo-overcloud-validate** -* **ansible-role-tripleo-overcloud-validate-ha** (this is optional if you want to test HA capabilities) +* **ansible-role-tripleo-overcloud-validate** or **ansible-role-tripleo-overcloud-validate-ha** (if you want to test HA capabilities) Example Playbook ---------------- @@ -163,71 +162,128 @@ Example Playbook Here's is an example on host to use this role in combination to all the others coming from various related to tripleo-quickstart: --- + # Provision and initial undercloud setup - name: Baremetal undercloud install hosts: localhost roles: - tripleo-baremetal-undercloud tags: - undercloud-bm-install - - - name: Inventory the undercloud + + # Machine at this point is provided + - name: Add the undercloud node to the generated inventory hosts: localhost - vars: - inventory: undercloud + gather_facts: yes + tags: + - undercloud-scripts roles: - tripleo-inventory + + # Deploy the undercloud + - name: Install undercloud + hosts: undercloud + gather_facts: no tags: - - undercloud-inventory - - - name: Post undercloud install steps + - undercloud-install + roles: + - tripleo/undercloud + + # Baremetal preparation (with workarounds) + - name: Prepare baremetal for the overcloud deployment hosts: undercloud roles: - - tripleo-undercloud-post + - overcloud-prep-baremetal tags: - - undercloud-post-install - - - name: Deploy the overcloud + - overcloud-prep-baremetal + + # Prepare any additional configuration files required by the overcloud + - name: Prepare configuration files for the overcloud deployment hosts: undercloud gather_facts: no + roles: + - overcloud-prep-config + + # Prepare the overcloud images for deployment + - name: Prepare the overcloud images for deployment + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-images + + # Prepare the overcloud flavor configuration + - name: Prepare overcloud flavors + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-flavors + + # Prepare the undercloud networks for the overcloud deployment + - name: Prepare the undercloud networks for the overcloud deployment + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-network + + # Deploy the overcloud + - name: Deploy the overcloud + hosts: undercloud + gather_facts: yes roles: - tripleo-overcloud + + - name: Add the overcloud nodes to the generated inventory + hosts: undercloud + gather_facts: yes tags: - overcloud-deploy - - - name: Inventory the overcloud - hosts: undercloud vars: inventory: all roles: - tripleo-inventory + + # Check the results of the deployment, note after inventory has executed + - name: Check the result of the deployment + hosts: localhost tags: - - overcloud-inventory - - - name: validate the overcloud + - overcloud-deploy + tasks: + - name: ensure the deployment result has been read into memory + include_vars: "{{ local_working_dir }}/overcloud_deployment_result.json" + + # overcloud_deploy_result = ["failed", "passed"] + - name: did the deployment pass or fail? + debug: var=overcloud_deploy_result + failed_when: overcloud_deploy_result == "failed" + + # HA Validation + - name: Validate the overcloud using HA tests hosts: undercloud gather_facts: no roles: - - tripleo-overcloud-validate + - tripleo-overcloud-validate-ha tags: - - overcloud-validate + - overcloud-validate-ha + The steps of the sample playbook are these: * First invoked role is tripleo-baremeal-undercloud undercloud * Then undercloud is inventoried -* In the post task all the env files are pushed into undercloud, introspection is performed and a default route external interface is created for the overcloud network access +* Undercloud is prepared for deploying * Overcloud is then deployed, inventoried and validated -Then you can invoke *quickstart.sh* like this: +So you can invoke *quickstart.sh* like this: - ./quickstart.sh -v --clean --playbook baremetal-undercloud.yml --working-dir /path/to/workdir --requirements /path/to/requirements.txt --config /path/to/config.yml --release mitaka --tags all + ./quickstart.sh -v --clean --playbook baremetal-undercloud-validate-ha.yml --working-dir /path/to/workdir --requirements /path/to/quickstart-extras-requirements.txt --config /path/to/config.yml --release --tags all Basically this command: * Uses the playbook **baremetal-undercloud.yml** * Uses a custom workdir that is rebuilt from scratch (so if it already exists, it is dropped) -* Performs all the tasks in the playbook +* Get all the extra requirements +* Select the config file * Chooses release (liberty, mitaka or “master” for newton) +* Performs all the tasks in the playbook * Starts the installation on virthost License diff --git a/defaults/main.yml b/defaults/main.yml index a5fbce61d..184b59185 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -5,11 +5,8 @@ undercloud_key: "{{ local_working_dir }}/id_rsa_undercloud" baremetal_provisioning_log: "{{ local_working_dir }}/baremetal_provision.log" -undercloud_config_file: undercloud.conf.j2 -undercloud_pre_install_script: undercloud-pre-install.sh.j2 -undercloud_install_script: undercloud-install.sh.j2 -undercloud_pre_install_log: "{{ working_dir }}/undercloud_pre_install.log" -undercloud_install_log: "{{ working_dir }}/undercloud_install.log" +undercloud_repos_conf_script: undercloud-repos-conf.sh.j2 +undercloud_repos_conf_log: "{{ working_dir }}/undercloud_repos_conf.log" overcloud_images_script: overcloud-images.sh.j2 overcloud_images_log: "{{ working_dir }}/overcloud_images.log" @@ -19,5 +16,5 @@ undercloud_network_cidr: 192.0.2.0/24 step_provide_undercloud: true step_prepare_undercloud: true -step_install_undercloud: true +step_undercloud_repos: true step_overcloud_images: true diff --git a/handlers/main.yml b/handlers/main.yml deleted file mode 100644 index faa7d64b9..000000000 --- a/handlers/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# handlers file for ansible-role-tripleo-baremetal-undercloud diff --git a/meta/main.yml b/meta/main.yml index c764a1304..e69de29bb 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,173 +0,0 @@ -galaxy_info: - author: your name - description: - company: your company (optional) - - # If the issue tracker for your role is not on github, uncomment the - # next line and provide a value - # issue_tracker_url: http://example.com/issue/tracker - - # Some suggested licenses: - # - BSD (default) - # - MIT - # - GPLv2 - # - GPLv3 - # - Apache - # - CC-BY - license: license (GPLv2, CC-BY, etc) - - min_ansible_version: 1.2 - - # Optionally specify the branch Galaxy will use when accessing the GitHub - # repo for this role. During role install, if no tags are available, - # Galaxy will use this branch. During import Galaxy will access files on - # this branch. If travis integration is cofigured, only notification for this - # branch will be accepted. Otherwise, in all cases, the repo's default branch - # (usually master) will be used. - #github_branch: - - # - # Below are all platforms currently available. Just uncomment - # the ones that apply to your role. If you don't see your - # platform on this list, let us know and we'll get it added! - # - #platforms: - #- name: EL - # versions: - # - all - # - 5 - # - 6 - # - 7 - #- name: GenericUNIX - # versions: - # - all - # - any - #- name: Solaris - # versions: - # - all - # - 10 - # - 11.0 - # - 11.1 - # - 11.2 - # - 11.3 - #- name: Fedora - # versions: - # - all - # - 16 - # - 17 - # - 18 - # - 19 - # - 20 - # - 21 - # - 22 - # - 23 - #- name: opensuse - # versions: - # - all - # - 12.1 - # - 12.2 - # - 12.3 - # - 13.1 - # - 13.2 - #- name: IOS - # versions: - # - all - # - any - #- name: SmartOS - # versions: - # - all - # - any - #- name: eos - # versions: - # - all - # - Any - #- name: Windows - # versions: - # - all - # - 2012R2 - #- name: Amazon - # versions: - # - all - # - 2013.03 - # - 2013.09 - #- name: GenericBSD - # versions: - # - all - # - any - #- name: Junos - # versions: - # - all - # - any - #- name: FreeBSD - # versions: - # - all - # - 10.0 - # - 10.1 - # - 10.2 - # - 8.0 - # - 8.1 - # - 8.2 - # - 8.3 - # - 8.4 - # - 9.0 - # - 9.1 - # - 9.1 - # - 9.2 - # - 9.3 - #- name: Ubuntu - # versions: - # - all - # - lucid - # - maverick - # - natty - # - oneiric - # - precise - # - quantal - # - raring - # - saucy - # - trusty - # - utopic - # - vivid - # - wily - # - xenial - #- name: SLES - # versions: - # - all - # - 10SP3 - # - 10SP4 - # - 11 - # - 11SP1 - # - 11SP2 - # - 11SP3 - #- name: GenericLinux - # versions: - # - all - # - any - #- name: NXOS - # versions: - # - all - # - any - #- name: Debian - # versions: - # - all - # - etch - # - jessie - # - lenny - # - sid - # - squeeze - # - stretch - # - wheezy - - galaxy_tags: [] - # List tags for your role here, one per line. A tag is - # a keyword that describes and categorizes the role. - # Users find roles by searching for tags. Be sure to - # remove the '[]' above if you add tags to this list. - # - # NOTE: A tag is limited to a single word comprised of - # alphanumeric characters. Maximum 20 tags per role. - -dependencies: [] - # List your role dependencies here, one per line. - # Be sure to remove the '[]' above if you add dependencies - # to this list. \ No newline at end of file diff --git a/playbooks/baremetal-undercloud-validate-ha.yml b/playbooks/baremetal-undercloud-validate-ha.yml index 021b8d375..1f9389299 100644 --- a/playbooks/baremetal-undercloud-validate-ha.yml +++ b/playbooks/baremetal-undercloud-validate-ha.yml @@ -1,4 +1,5 @@ --- +# Provision and initial undercloud setup - name: Baremetal undercloud install hosts: localhost roles: @@ -6,40 +7,93 @@ tags: - undercloud-bm-install -- name: Inventory the undercloud +# Machine at this point is provided +- name: Add the undercloud node to the generated inventory hosts: localhost - vars: - inventory: undercloud + gather_facts: yes + tags: + - undercloud-scripts roles: - tripleo-inventory - tags: - - undercloud-inventory -- name: Post undercloud install steps +# Deploy the undercloud +- name: Install undercloud + hosts: undercloud + gather_facts: no + tags: + - undercloud-install + roles: + - tripleo/undercloud + +# Baremetal preparation (with workarounds) +- name: Prepare baremetal for the overcloud deployment hosts: undercloud roles: - - tripleo-undercloud-post + - overcloud-prep-baremetal tags: - - undercloud-post-install + - overcloud-prep-baremetal -- name: Deploy the overcloud +# Prepare any additional configuration files required by the overcloud +- name: Prepare configuration files for the overcloud deployment hosts: undercloud gather_facts: no + roles: + - overcloud-prep-config + +# Prepare the overcloud images for deployment +- name: Prepare the overcloud images for deployment + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-images + +# Prepare the overcloud flavor configuration +- name: Prepare overcloud flavors + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-flavors + +# Prepare the undercloud networks for the overcloud deployment +- name: Prepare the undercloud networks for the overcloud deployment + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-network + +# Deploy the overcloud +- name: Deploy the overcloud + hosts: undercloud + gather_facts: yes roles: - tripleo-overcloud + +- name: Add the overcloud nodes to the generated inventory + hosts: undercloud + gather_facts: yes tags: - overcloud-deploy - -- name: Inventory the overcloud - hosts: undercloud vars: inventory: all roles: - tripleo-inventory - tags: - - overcloud-inventory -- name: validate the overcloud using HA tests +# Check the results of the deployment, note after inventory has executed +- name: Check the result of the deployment + hosts: localhost + tags: + - overcloud-deploy + tasks: + - name: ensure the deployment result has been read into memory + include_vars: "{{ local_working_dir }}/overcloud_deployment_result.json" + + # overcloud_deploy_result = ["failed", "passed"] + - name: did the deployment pass or fail? + debug: var=overcloud_deploy_result + failed_when: overcloud_deploy_result == "failed" + +# HA Validation +- name: Validate the overcloud using HA tests hosts: undercloud gather_facts: no roles: diff --git a/playbooks/baremetal-undercloud.yml b/playbooks/baremetal-undercloud.yml index 1b1fdbec9..54c950b1e 100644 --- a/playbooks/baremetal-undercloud.yml +++ b/playbooks/baremetal-undercloud.yml @@ -1,45 +1,98 @@ --- -- name: Baremetal undercloud install +# Provision and initial undercloud setup +- name: Baremetal undercloud install hosts: localhost roles: - tripleo-baremetal-undercloud tags: - undercloud-bm-install -- name: Inventory the undercloud +# Machine at this point is provided +- name: Add the undercloud node to the generated inventory hosts: localhost - vars: - inventory: undercloud + gather_facts: yes + tags: + - undercloud-scripts roles: - tripleo-inventory - tags: - - undercloud-inventory -- name: Post undercloud install steps +# Deploy the undercloud +- name: Install undercloud + hosts: undercloud + gather_facts: no + tags: + - undercloud-install + roles: + - tripleo/undercloud + +# Baremetal preparation (with workarounds) +- name: Prepare baremetal for the overcloud deployment hosts: undercloud roles: - - tripleo-undercloud-post + - overcloud-prep-baremetal tags: - - undercloud-post-install + - overcloud-prep-baremetal -- name: Deploy the overcloud +# Prepare any additional configuration files required by the overcloud +- name: Prepare configuration files for the overcloud deployment hosts: undercloud gather_facts: no + roles: + - overcloud-prep-config + +# Prepare the overcloud images for deployment +- name: Prepare the overcloud images for deployment + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-images + +# Prepare the overcloud flavor configuration +- name: Prepare overcloud flavors + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-flavors + +# Prepare the undercloud networks for the overcloud deployment +- name: Prepare the undercloud networks for the overcloud deployment + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-network + +# Deploy the overcloud +- name: Deploy the overcloud + hosts: undercloud + gather_facts: yes roles: - tripleo-overcloud + +- name: Add the overcloud nodes to the generated inventory + hosts: undercloud + gather_facts: yes tags: - overcloud-deploy - -- name: Inventory the overcloud - hosts: undercloud vars: inventory: all roles: - tripleo-inventory - tags: - - overcloud-inventory -- name: validate the overcloud +# Check the results of the deployment, note after inventory has executed +- name: Check the result of the deployment + hosts: localhost + tags: + - overcloud-deploy + tasks: + - name: ensure the deployment result has been read into memory + include_vars: "{{ local_working_dir }}/overcloud_deployment_result.json" + + # overcloud_deploy_result = ["failed", "passed"] + - name: did the deployment pass or fail? + debug: var=overcloud_deploy_result + failed_when: overcloud_deploy_result == "failed" + +- name: Validate the overcloud hosts: undercloud gather_facts: no roles: diff --git a/setup.cfg b/setup.cfg index 7ef913802..d9c895cbb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -22,13 +22,9 @@ setup-hooks = data_files = playbooks = playbooks/* usr/local/share/ansible/roles/tripleo-baremetal-undercloud/defaults = defaults/* - usr/local/share/ansible/roles/tripleo-baremetal-undercloud/handlers = handlers/* usr/local/share/ansible/roles/tripleo-baremetal-undercloud/meta = meta/* usr/local/share/ansible/roles/tripleo-baremetal-undercloud/tasks = tasks/* usr/local/share/ansible/roles/tripleo-baremetal-undercloud/templates = templates/* - usr/local/share/ansible/roles/tripleo-baremetal-undercloud/files = files/* - usr/local/share/ansible/roles/tripleo-baremetal-undercloud/tests = tests/* - usr/local/share/ansible/roles/tripleo-baremetal-undercloud/vars = vars/* [wheel] universal = 1 diff --git a/tasks/main.yml b/tasks/main.yml index 74f67645a..0aeff2582 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,29 +1,23 @@ --- # tasks file for ansible-role-tripleo-baremetal-undercloud +# Do machine provisioning - include: machine-provisioning.yml tags: - machine-provision +# Prepare machine to be used with TripleO - include: machine-setup.yml tags: - machine-setup -- include: undercloud-scripts.yml +# Configure repos and packages +- include: undercloud-repos-conf.yml delegate_to: "{{ virthost }}" tags: - - undercloud-scripts - -- include: undercloud-pre-install.yml - delegate_to: "{{ virthost }}" - tags: - - undercloud-pre-install - -- include: undercloud-install.yml - delegate_to: "{{ virthost }}" - tags: - - undercloud-install + - undercloud-repos-conf +# Get overcloud images - include: overcloud-images.yml delegate_to: "{{ virthost }}" tags: diff --git a/tasks/overcloud-images.yml b/tasks/overcloud-images.yml index da0f79d1c..7bcff9cf9 100644 --- a/tasks/overcloud-images.yml +++ b/tasks/overcloud-images.yml @@ -1,3 +1,10 @@ +# Copy overcloud images script +- name: Copy repositories configuration script + template: + src: "{{ overcloud_images_script }}" + dest: "{{ working_dir }}/overcloud-images.sh" + mode: 0755 + - name: Overcloud images shell: > {{ working_dir }}/overcloud-images.sh > {{ overcloud_images_log }} 2>&1 diff --git a/tasks/undercloud-install.yml b/tasks/undercloud-install.yml deleted file mode 100644 index c10f35aae..000000000 --- a/tasks/undercloud-install.yml +++ /dev/null @@ -1,4 +0,0 @@ -- name: Install the undercloud - shell: > - {{ working_dir }}/undercloud-install.sh > {{ undercloud_install_log }} 2>&1 - when: step_install_undercloud diff --git a/tasks/undercloud-pre-install.yml b/tasks/undercloud-pre-install.yml deleted file mode 100644 index d7e2f9575..000000000 --- a/tasks/undercloud-pre-install.yml +++ /dev/null @@ -1,4 +0,0 @@ -- name: Preparing machine for undercloud installation - shell: > - {{ working_dir }}/undercloud-pre-install.sh > {{ undercloud_pre_install_log }} 2>&1 - when: step_prepare_undercloud diff --git a/tasks/undercloud-repos-conf.yml b/tasks/undercloud-repos-conf.yml new file mode 100644 index 000000000..e3b0eb099 --- /dev/null +++ b/tasks/undercloud-repos-conf.yml @@ -0,0 +1,12 @@ +# Copy repo configuration script +- name: Copy repositories configuration script + template: + src: "{{ undercloud_repos_conf_script }}" + dest: "{{ working_dir }}/undercloud-repos-conf.sh" + mode: 0755 + +- name: Execute repositories configuration script + shell: > + {{ working_dir }}/undercloud-repos-conf.sh > {{ undercloud_repos_conf_log }} 2>&1 + when: step_prepare_undercloud + become: true diff --git a/tasks/undercloud-scripts.yml b/tasks/undercloud-scripts.yml deleted file mode 100644 index bfa44bcba..000000000 --- a/tasks/undercloud-scripts.yml +++ /dev/null @@ -1,23 +0,0 @@ -- name: Create undercloud configuration - template: - src: "{{ undercloud_config_file }}" - dest: "./undercloud.conf" - mode: 0600 - -- name: Create undercloud pre-install script - template: - src: "{{ undercloud_pre_install_script }}" - dest: "{{ working_dir }}/undercloud-pre-install.sh" - mode: 0755 - -- name: Create undercloud install script - template: - src: "{{ undercloud_install_script }}" - dest: "{{ working_dir }}/undercloud-install.sh" - mode: 0755 - -- name: Create overcloud image generation script - template: - src: "{{ overcloud_images_script }}" - dest: "{{ working_dir }}/overcloud-images.sh" - mode: 0755 diff --git a/templates/overcloud-images.sh.j2 b/templates/overcloud-images.sh.j2 index f99fa43ac..e81875a81 100644 --- a/templates/overcloud-images.sh.j2 +++ b/templates/overcloud-images.sh.j2 @@ -1,17 +1,31 @@ #!/bin/bash -# Prepare overcloud images set -eux -# Retrieving images +### --start_docs +## Prepare the images to be used in the overcloud +## ============================================== + +## Prepare the images +## ------------------ + +## * Retrieve images from the known urls +## :: + wget "{{ overcloud_image_url }}" wget "{{ ipa_image_url }}" for i in *.tar; do tar xvfp $i done -# Checking libvirtd" +## * Ensure libvirtd is started (otherwise virt-customize won't work +## :: + sudo systemctl restart libvirtd -# Changing root password of the overcloud +## * Change root password on the image +## :: + virt-customize -a overcloud-full.qcow2 --root-password password:redhat + +### --stop_docs diff --git a/templates/undercloud-install.sh.j2 b/templates/undercloud-install.sh.j2 deleted file mode 100644 index 41abd794a..000000000 --- a/templates/undercloud-install.sh.j2 +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -# Run the undercloud install - -set -eux - -{% for var in (undercloud_env_vars|default([])) %} -export {{ var }} -{% endfor %} - -openstack undercloud install diff --git a/templates/undercloud-pre-install.sh.j2 b/templates/undercloud-pre-install.sh.j2 deleted file mode 100644 index b5190ed6a..000000000 --- a/templates/undercloud-pre-install.sh.j2 +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# Prepare undercloud repos - -set -eux - -# Adding static hostname into /etc/hosts -sudo sh -c 'echo "{{ registered_undercloud_ip.stdout }} $(hostname -f)" >> /etc/hosts' - -# SELinux -sudo setenforce 0 -sudo sed -i -e 's/^SELINUX.*/SELINUX=permissive/g' /etc/sysconfig/selinux - -# Firewall -sudo systemctl disable firewalld - -# Packages -sudo yum install -y ntp ntpdate vim tmux openssl wget bind-utils net-tools git lftp libguestfs-tools sos - -# Time -sudo yum erase -y chrony -sudo rm -f /etc/chrony* -sudo sed -i s'/^server.*//' /etc/ntp.conf -sudo sh -c 'echo "server clock.redhat.com iburst" >> /etc/ntp.conf' -sudo sh -c 'echo clock.redhat.com > /etc/ntp/step-tickers' -sudo sh -c 'echo "SYNC_HWCLOCK=yes" >> /etc/sysconfig/ntpdate' -sudo systemctl enable ntpdate -sudo systemctl enable ntpd - -# Repos -#sudo curl -o /etc/yum.repos.d/delorean.repo http://trunk.rdoproject.org/centos7-{{ release }}/current-passed-ci/delorean.repo -sudo curl -o /etc/yum.repos.d/delorean.repo http://buildlogs.centos.org/centos/7/cloud/x86_64/rdo-trunk-{{ release }}-tested/delorean.repo -sudo curl -o /etc/yum.repos.d/delorean-deps.repo http://trunk.rdoproject.org/centos7-{{ release }}/delorean-deps.repo - -{% if release == 'liberty' %} -# (trown) Install ironic-python-agent from mitaka delorean for LIO support. -# We either need to do that or include tgt from EPEL, and upstream -# ironic-python-agent project does not actually even gate the stable branch. -# I am working on getting them to remove the stable branch, which will give us -# LIO support in liberty delorean. -sudo yum install -y http://trunk.rdoproject.org/centos7/55/17/5517b8e9aea3ded1052209384b4194d2caa97541_673a78a2/openstack-ironic-python-agent-1.1.1-dev6.el7.centos.noarch.rpm http://trunk.rdoproject.org/centos7/55/17/5517b8e9aea3ded1052209384b4194d2caa97541_673a78a2/python2-ironic-python-agent-1.1.1-dev6.el7.centos.noarch.rpm -{% endif %} - -sudo yum update -y - -# Tripleo packages -sudo yum install -y yum-plugin-priorities -sudo yum install -y python-tripleoclient diff --git a/templates/undercloud-repos-conf.sh.j2 b/templates/undercloud-repos-conf.sh.j2 new file mode 100644 index 000000000..bf173af27 --- /dev/null +++ b/templates/undercloud-repos-conf.sh.j2 @@ -0,0 +1,53 @@ +#!/bin/bash + +set -eux + +### --start_docs +## Prepare repos and packages on the undercloud +## ============================================ + +## Prepare repos and packages +## -------------------------- + +## * Install base and useful packages. +## :: + +yum install -y ntp ntpdate vim tmux openssl wget bind-utils net-tools git lftp libguestfs-tools sos + +## * Fix time issues with ntp. +## :: + +yum erase -y chrony +rm -f /etc/chrony* +sed -i s'/^server.*//' /etc/ntp.conf +sh -c 'echo "server clock.redhat.com iburst" >> /etc/ntp.conf' +sh -c 'echo clock.redhat.com > /etc/ntp/step-tickers' +sh -c 'echo "SYNC_HWCLOCK=yes" >> /etc/sysconfig/ntpdate' +ntpdate clock.redhat.com +systemctl enable ntpdate +systemctl enable ntpd +systemctl start ntpd + +## * Configure repos. +## :: + +#curl -o /etc/yum.repos.d/delorean.repo http://trunk.rdoproject.org/centos7-{{ release }}/current-passed-ci/delorean.repo +curl -o /etc/yum.repos.d/delorean.repo http://buildlogs.centos.org/centos/7/cloud/x86_64/rdo-trunk-{{ release }}-tested/delorean.repo +curl -o /etc/yum.repos.d/delorean-deps.repo http://trunk.rdoproject.org/centos7-{{ release }}/delorean-deps.repo + +{% if release == 'liberty' %} +# (trown) Install ironic-python-agent from mitaka delorean for LIO support. +# We either need to do that or include tgt from EPEL, and upstream +# ironic-python-agent project does not actually even gate the stable branch. +# I am working on getting them to remove the stable branch, which will give us +# LIO support in liberty delorean. +yum install -y http://trunk.rdoproject.org/centos7/55/17/5517b8e9aea3ded1052209384b4194d2caa97541_673a78a2/openstack-ironic-python-agent-1.1.1-dev6.el7.centos.noarch.rpm http://trunk.rdoproject.org/centos7/55/17/5517b8e9aea3ded1052209384b4194d2caa97541_673a78a2/python2-ironic-python-agent-1.1.1-dev6.el7.centos.noarch.rpm +{% endif %} + +## * Install TripleO packages. +## :: + +yum install -y yum-plugin-priorities +yum install -y python-tripleoclient + +### --stop_docs diff --git a/templates/undercloud.conf.j2 b/templates/undercloud.conf.j2 deleted file mode 100644 index 7cb0e694a..000000000 --- a/templates/undercloud.conf.j2 +++ /dev/null @@ -1,335 +0,0 @@ -[DEFAULT] - -# -# From instack-undercloud -# - -# Local file path to the necessary images. The path should be a -# directory readable by the current user that contains the full set of -# images. (string value) -{% if undercloud_image_path is defined %} -image_path = {{undercloud_image_path}} -{% else %} -#image_path = . -{% endif %} - -# Fully qualified hostname (including domain) to set on the -# Undercloud. If left unset, the current hostname will be used, but -# the user is responsible for configuring all system hostname settings -# appropriately. If set, the undercloud install will configure all -# system hostname settings. (string value) -{% if undercloud_undercloud_hostname is defined %} -undercloud_hostname = {{undercloud_undercloud_hostname}} -{% else %} -#undercloud_hostname = -{% endif %} - -# Network CIDR for the Neutron-managed network for Overcloud -# instances. This should be the subnet used for PXE booting. (string -# value) -network_cidr = {{undercloud_network_cidr}} - -# IP information for the interface on the Undercloud that will be -# handling the PXE boots and DHCP for Overcloud instances. The IP -# portion of the value will be assigned to the network interface -# defined by local_interface, with the netmask defined by the prefix -# portion of the value. (string value) -local_ip = {{undercloud_local_ip|default( - '%s/%s' % (undercloud_network_cidr|nthhost(1), - undercloud_network_cidr.split('/').1))}} - -# Network gateway for the Neutron-managed network for Overcloud -# instances. This should match the local_ip above when using -# masquerading. (string value) -network_gateway = {{undercloud_network_gateway|default( - undercloud_network_cidr|nthhost(1))}} - -# Virtual IP address to use for the public endpoints of Undercloud -# services. Only used if undercloud_service_certficate is set. -# (string value) -{% if undercloud_undercloud_public_vip is defined %} -undercloud_public_vip = {{undercloud_undercloud_public_vip}} -{% else %} -#undercloud_public_vip = 192.0.2.2 -{% endif %} - -# Virtual IP address to use for the admin endpoints of Undercloud -# services. Only used if undercloud_service_certficate is set. -# (string value) -{% if undercloud_undercloud_admin_vip is defined %} -undercloud_admin_vip = {{undercloud_undercloud_admin_vip}} -{% else %} -#undercloud_admin_vip = 192.0.2.3 -{% endif %} - -# Certificate file to use for OpenStack service SSL connections. -# Setting this enables SSL for the OpenStack API endpoints, leaving it -# unset disables SSL. (string value) -#undercloud_service_certificate = - -# Network interface on the Undercloud that will be handling the PXE -# boots and DHCP for Overcloud instances. (string value) -{% if undercloud_local_interface is defined %} -local_interface = {{undercloud_local_interface}} -{% else %} -#local_interface = eth1 -{% endif %} - -# Network that will be masqueraded for external access, if required. -# This should be the subnet used for PXE booting. (string value) -masquerade_network = {{undercloud_masquerade_network|default( - undercloud_network_cidr)}} - -# Start of DHCP allocation range for PXE and DHCP of Overcloud -# instances. (string value) -dhcp_start = {{undercloud_dhcp_start|default( - undercloud_network_cidr|nthhost(5))}} - -# End of DHCP allocation range for PXE and DHCP of Overcloud -# instances. (string value) -dhcp_end = {{undercloud_dhcp_end|default( - undercloud_network_cidr|nthhost(30))}} - -# Network interface on which inspection dnsmasq will listen. If in -# doubt, use the default value. (string value) -# Deprecated group/name - [DEFAULT]/discovery_interface -{% if undercloud_inspection_interface is defined %} -inspection_interface = {{undercloud_inspection_interface}} -{% else %} -#inspection_interface = br-ctlplane -{% endif %} - -# Temporary IP range that will be given to nodes during the inspection -# process. Should not overlap with the range defined by dhcp_start -# and dhcp_end, but should be in the same network. (string value) -# Deprecated group/name - [DEFAULT]/discovery_iprange -inspection_iprange = {{undercloud_inspection_iprange|default( - '%s,%s' % (undercloud_network_cidr|nthhost(100), - undercloud_network_cidr|nthhost(120)))}} - -# Whether to run benchmarks when inspecting nodes. (boolean value) -# Deprecated group/name - [DEFAULT]/discovery_runbench -{% if undercloud_inspection_runbench is defined %} -inspection_runbench = {{undercloud_inspection_runbench}} -{% else %} -#inspection_runbench = false -{% endif %} - -# Whether to enable the debug log level for Undercloud OpenStack -# services. (boolean value) -{% if undercloud_undercloud_debug is defined %} -undercloud_debug = {{undercloud_undercloud_debug}} -{% else %} -#undercloud_debug = true -{% endif %} - -# Whether to install Tempest in the Undercloud. (boolean value) -{% if undercloud_enable_tempest is defined %} -enable_tempest = {{undercloud_enable_tempest}} -{% else %} -#enable_tempest = true -{% endif %} - -# Whether to install Mistral in the Undercloud. (boolean value) -{% if undercloud_enable_mistral is defined %} -enable_mistral = {{undercloud_enable_mistral}} -{% else %} -#enable_mistral = false -{% endif %} - -# Whether to use iPXE for deploy by default. (boolean value) -{% if undercloud_ipxe_deploy is defined %} -ipxe_deploy = {{undercloud_ipxe_deploy}} -{% else %} -#ipxe_deploy = true -{% endif %} - -# Whether to install Monitoring services in the Undercloud. (boolean -# value) -{% if undercloud_enable_monitoring is defined %} -enable_monitoring = {{undercloud_enable_monitoring}} -{% else %} -#enable_monitoring = false -{% endif %} - -[auth] - -# -# From instack-undercloud -# - -# Password used for MySQL databases. If left unset, one will be -# automatically generated. (string value) -{% if undercloud_undercloud_db_password is defined %} -undercloud_db_password = {{undercloud_undercloud_db_password}} -{% else %} -#undercloud_db_password = -{% endif %} - -# Keystone admin token. If left unset, one will be automatically -# generated. (string value) -{% if undercloud_undercloud_admin_token is defined %} -undercloud_admin_token = {{undercloud_undercloud_admin_token}} -{% else %} -#undercloud_admin_token = -{% endif %} - -# Keystone admin password. If left unset, one will be automatically -# generated. (string value) -{% if undercloud_undercloud_admin_password is defined %} -undercloud_admin_password = {{undercloud_undercloud_admin_password}} -{% else %} -#undercloud_admin_password = -{% endif %} - -# Glance service password. If left unset, one will be automatically -# generated. (string value) -{% if undercloud_undercloud_glance_password is defined %} -undercloud_glance_password = {{undercloud_undercloud_glance_password}} -{% else %} -#undercloud_glance_password = -{% endif %} - -# Heat db encryption key(must be 16, 24, or 32 characters. If left -# unset, one will be automatically generated. (string value) -{% if undercloud_undercloud_heat_encryption_key is defined %} -undercloud_heat_encryption_key = {{undercloud_undercloud_heat_encryption_key}} -{% else %} -#undercloud_heat_encryption_key = -{% endif %} - -# Heat service password. If left unset, one will be automatically -# generated. (string value) -{% if undercloud_undercloud_heat_password is defined %} -undercloud_heat_password = {{undercloud_undercloud_heat_password}} -{% else %} -#undercloud_heat_password = -{% endif %} - -# Neutron service password. If left unset, one will be automatically -# generated. (string value) -{% if undercloud_undercloud_neutron_password is defined %} -undercloud_neutron_password = {{undercloud_undercloud_neutron_password}} -{% else %} -#undercloud_neutron_password = -{% endif %} - -# Nova service password. If left unset, one will be automatically -# generated. (string value) -{% if undercloud_undercloud_nova_password is defined %} -undercloud_nova_password = {{undercloud_undercloud_nova_password}} -{% else %} -#undercloud_nova_password = -{% endif %} - -# Ironic service password. If left unset, one will be automatically -# generated. (string value) -{% if undercloud_undercloud_ironic_password is defined %} -undercloud_ironic_password = {{undercloud_undercloud_ironic_password}} -{% else %} -#undercloud_ironic_password = -{% endif %} - -# Ceilometer service password. If left unset, one will be -# automatically generated. (string value) -{% if undercloud_undercloud_ceilometer_password is defined %} -undercloud_ceilometer_password = {{undercloud_undercloud_ceilometer_password}} -{% else %} -#undercloud_ceilometer_password = -{% endif %} - -# Aodh service password. If left unset, one will be -# automatically generated. (string value) -{% if undercloud_undercloud_aodh_password is defined %} -undercloud_aodh_password = {{undercloud_undercloud_aodh_password}} -{% else %} -#undercloud_aodh_password = -{% endif %} - -# Sensu service password. If left unset, one will be automatically -# generated. (string value) -{% if undercloud_undercloud_sensu_password is defined %} -undercloud_sensu_password = {{undercloud_undercloud_sensu_password}} -{% else %} -#undercloud_sensu_password = -{% endif %} - -# Ceilometer metering secret. If left unset, one will be automatically -# generated. (string value) -{% if undercloud_undercloud_ceilometer_metering_secret is defined %} -undercloud_ceilometer_metering_secret = {{undercloud_undercloud_ceilometer_metering_secret}} -{% else %} -#undercloud_ceilometer_metering_secret = -{% endif %} - -# Ceilometer snmpd user. If left unset, one will be automatically -# generated. (string value) -{% if undercloud_undercloud_ceilometer_snmpd_user is defined %} -undercloud_ceilometer_snmpd_user = {{undercloud_undercloud_ceilometer_snmpd_user}} -{% else %} -#undercloud_ceilometer_snmpd_user = -{% endif %} - -# Ceilometer snmpd password. If left unset, one will be automatically -# generated. (string value) -{% if undercloud_undercloud_ceilometer_snmpd_password is defined %} -undercloud_ceilometer_snmpd_password = {{undercloud_undercloud_ceilometer_snmpd_password}} -{% else %} -#undercloud_ceilometer_snmpd_password = -{% endif %} - -# Swift service password. If left unset, one will be automatically -# generated. (string value) -{% if undercloud_undercloud_swift_password is defined %} -undercloud_swift_password = {{undercloud_undercloud_swift_password}} -{% else %} -#undercloud_swift_password = -{% endif %} - -# Mistral service password. If left unset, one will be automatically -# generated. (string value) -{% if undercloud_undercloud_mistral_password is defined %} -undercloud_mistral_password = {{undercloud_undercloud_mistral_password}} -{% else %} -#undercloud_mistral_password = -{% endif %} - -# Rabbitmq cookie. If left unset, one will be automatically generated. -# (string value) -{% if undercloud_undercloud_rabbit_cookie is defined %} -undercloud_rabbit_cookie = {{undercloud_undercloud_rabbit_cookie}} -{% else %} -#undercloud_rabbit_cookie = -{% endif %} - -# Rabbitmq password. If left unset, one will be automatically -# generated. (string value) -{% if undercloud_undercloud_rabbit_password is defined %} -undercloud_rabbit_password = {{undercloud_undercloud_rabbit_password}} -{% else %} -#undercloud_rabbit_password = -{% endif %} - -# Rabbitmq username. If left unset, one will be automatically -# generated. (string value) -{% if undercloud_undercloud_rabbit_username is defined %} -undercloud_rabbit_username = {{undercloud_undercloud_rabbit_username}} -{% else %} -#undercloud_rabbit_username = -{% endif %} - -# Heat stack domain admin password. If left unset, one will be -# automatically generated. (string value) -{% if undercloud_undercloud_heat_stack_domain_admin_password is defined %} -undercloud_heat_stack_domain_admin_password = {{undercloud_undercloud_heat_stack_domain_admin_password}} -{% else %} -#undercloud_heat_stack_domain_admin_password = -{% endif %} - -# Swift hash suffix. If left unset, one will be automatically -# generated. (string value) -{% if undercloud_undercloud_swift_hash_suffix is defined %} -undercloud_swift_hash_suffix = {{undercloud_undercloud_swift_hash_suffix}} -{% else %} -#undercloud_swift_hash_suffix = -{% endif %} diff --git a/tests/inventory b/tests/inventory deleted file mode 100644 index d18580b3c..000000000 --- a/tests/inventory +++ /dev/null @@ -1 +0,0 @@ -localhost \ No newline at end of file diff --git a/tests/test.yml b/tests/test.yml deleted file mode 100644 index 3f3e5702b..000000000 --- a/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - ansible-role-tripleo-baremetal-undercloud \ No newline at end of file diff --git a/vars/main.yml b/vars/main.yml deleted file mode 100644 index b1329957e..000000000 --- a/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for ansible-role-tripleo-baremetal-undercloud From 3631e3a90da0d02fde405715c061a3b79330091b Mon Sep 17 00:00:00 2001 From: Raoul Scarazzini Date: Mon, 14 Nov 2016 12:47:40 -0500 Subject: [PATCH 10/11] Fix documentation syntax and license This command fixes several issues on the README, including syntax highlight and license. Change-Id: I750e37c00e164705df8140ccfd4c6b5c7c3151f5 --- README.md | 408 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 213 insertions(+), 195 deletions(-) diff --git a/README.md b/README.md index 595ed58d2..c7ca32b96 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ansible-role-tripleo-baremetal-undercloud -========= +========================================= This role aims to build a baremetal undercloud machine from scratch. Using tripleo-quickstart, this means that you will be able to provide, prepare and install the undercloud on a physical machine. @@ -26,63 +26,92 @@ Software requirements * Directory nic-configs - mandatory if declared inside the resource_registry section in network-environment.yaml and must contain all the needed files * File instackenv.json - mandatory, must contain the ipmi credentials for the nodes -Role Variables --------------- +Quickstart invocation +--------------------- + +You can invoke *quickstart.sh* like this: + +```console +./quickstart.sh \ + --clean \ + --playbook baremetal-undercloud-validate-ha.yml \ + --working-dir /path/to/workdir \ + --requirements /path/to/quickstart-extras-requirements.txt \ + --config /path/to/config.yml \ + --release \ + --tags all \ + +``` + +Basically this command: + +* Uses the playbook **baremetal-undercloud.yml** +* Uses a custom workdir that is rebuilt from scratch (so if it already exists, it is dropped, see *--clean*) +* Get all the extra requirements +* Select the config file +* Chooses release (liberty, mitaka or “master” for newton) +* Performs all the tasks in the playbook +* Starts the installation on virthost + +Role usage +---------- A typical config file will contain something like this: - undercloud_type: baremetal - - # Specify the secondary net interface for overcloud provisioning - undercloud_local_interface: eth1 - - # Specify the external network for undercloud that will be used to route overcloud traffic - undercloud_external_network_cidr: 172.20.0.0/24 - - # Declare the additional interface on undercloud to route overcloud traffic - undercloud_networks: - external: - address: 172.20.0.254 - netmask: 255.255.255.0 - device_type: ovs - type: OVSIntPort - ovs_bridge: br-ctlplane - ovs_options: '"tag=1105"' - tag: 1105 - - # Define all the flavors - flavor_map: - control: baremetal - compute: baremetal - storage: baremetal - ceph: baremetal - swift: baremetal +```yaml +undercloud_type: baremetal - # To be used ansible-role-tripleo-baremetal-undercloud - step_provide_undercloud: true - # To be used in ansible-role-tripleo-overcloud-prep-baremetal - step_install_upstream_ipxe: true - # To be used in ansible-role-tripleo-overcloud-prep-images - step_introspect: true - - # Explicitly declare kvm since we are on BM - libvirt_type: kvm - libvirt_args: "--libvirt-type kvm" - - # Environment specific variables - baremetal_provisioning_script: "/path/to/undercloud-provisioning.sh" - baremetal_network_environment: "/path/to/network-environment.yaml" - baremetal_instackenv: "/path/to/instackenv.json" - baremetal_nic_configs: "/path/to/nic_configs" - - # Public (Floating) network definition - public_physical_network: "floating" - floating_ip_cidr: "" - public_net_pool_start: "" - public_net_pool_end: "" - public_net_gateway: "" - - extra_args: "--ntp-server --control-scale 3 --compute-scale 2 --ceph-storage-scale 0 --block-storage-scale 0 --swift-storage-scale 0 --templates -e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml -e /home/stack/network-environment.yaml --neutron-bridge-mappings datacentre:br-floating" +# Specify the secondary net interface for overcloud provisioning +undercloud_local_interface: eth1 + +# Specify the external network for undercloud that will be used to route overcloud traffic +undercloud_external_network_cidr: 172.20.0.0/24 + +# Declare the additional interface on undercloud to route overcloud traffic +undercloud_networks: + external: + address: 172.20.0.254 + netmask: 255.255.255.0 + device_type: ovs + type: OVSIntPort + ovs_bridge: br-ctlplane + ovs_options: '"tag=1105"' + tag: 1105 + +# Define all the flavors +flavor_map: + control: baremetal + compute: baremetal + storage: baremetal + ceph: baremetal + swift: baremetal + +# To be used ansible-role-tripleo-baremetal-undercloud +step_provide_undercloud: true +# To be used in ansible-role-tripleo-overcloud-prep-baremetal +step_install_upstream_ipxe: true +# To be used in ansible-role-tripleo-overcloud-prep-images +step_introspect: true + +# Explicitly declare kvm since we are on BM +libvirt_type: kvm +libvirt_args: "--libvirt-type kvm" + +# Environment specific variables +baremetal_provisioning_script: "/path/to/undercloud-provisioning.sh" +baremetal_network_environment: "/path/to/network-environment.yaml" +baremetal_instackenv: "/path/to/instackenv.json" +baremetal_nic_configs: "/path/to/nic_configs" + +# Public (Floating) network definition +public_physical_network: "floating" +floating_ip_cidr: "" +public_net_pool_start: "" +public_net_pool_end: "" +public_net_gateway: "" + +extra_args: "--ntp-server --control-scale 3 --compute-scale 2 --ceph-storage-scale 0 --block-storage-scale 0 --swift-storage-scale 0 --templates -e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml -e /home/stack/network-environment.yaml --neutron-bridge-mappings datacentre:br-floating" +``` A brief explanation of the variables: @@ -101,30 +130,32 @@ A brief explanation of the variables: The main task of the role is this one: - --- - # tasks file for ansible-role-tripleo-baremetal-undercloud - - # Do machine provisioning - - include: machine-provisioning.yml - tags: - - machine-provision - - # Prepare machine to be used with TripleO - - include: machine-setup.yml - tags: - - machine-setup - - # Configure repos and packages - - include: undercloud-repos-conf.yml - delegate_to: "{{ virthost }}" - tags: - - undercloud-repos-conf - - # Get overcloud images - - include: overcloud-images.yml - delegate_to: "{{ virthost }}" - tags: - - overcloud-images +```yaml +--- +# tasks file for ansible-role-tripleo-baremetal-undercloud + +# Do machine provisioning +- include: machine-provisioning.yml + tags: + - machine-provision + +# Prepare machine to be used with TripleO +- include: machine-setup.yml + tags: + - machine-setup + +# Configure repos and packages +- include: undercloud-repos-conf.yml + delegate_to: "{{ virthost }}" + tags: + - undercloud-repos-conf + +# Get overcloud images +- include: overcloud-images.yml + delegate_to: "{{ virthost }}" + tags: + - overcloud-images +``` This is basically what each specific tasks does: @@ -161,109 +192,110 @@ Example Playbook Here's is an example on host to use this role in combination to all the others coming from various related to tripleo-quickstart: - --- - # Provision and initial undercloud setup - - name: Baremetal undercloud install - hosts: localhost - roles: - - tripleo-baremetal-undercloud - tags: - - undercloud-bm-install - - # Machine at this point is provided - - name: Add the undercloud node to the generated inventory - hosts: localhost - gather_facts: yes - tags: - - undercloud-scripts - roles: - - tripleo-inventory - - # Deploy the undercloud - - name: Install undercloud - hosts: undercloud - gather_facts: no - tags: - - undercloud-install - roles: - - tripleo/undercloud - - # Baremetal preparation (with workarounds) - - name: Prepare baremetal for the overcloud deployment - hosts: undercloud - roles: - - overcloud-prep-baremetal - tags: - - overcloud-prep-baremetal - - # Prepare any additional configuration files required by the overcloud - - name: Prepare configuration files for the overcloud deployment - hosts: undercloud - gather_facts: no - roles: - - overcloud-prep-config - - # Prepare the overcloud images for deployment - - name: Prepare the overcloud images for deployment - hosts: undercloud - gather_facts: no - roles: - - overcloud-prep-images - - # Prepare the overcloud flavor configuration - - name: Prepare overcloud flavors - hosts: undercloud - gather_facts: no - roles: - - overcloud-prep-flavors - - # Prepare the undercloud networks for the overcloud deployment - - name: Prepare the undercloud networks for the overcloud deployment - hosts: undercloud - gather_facts: no - roles: - - overcloud-prep-network - - # Deploy the overcloud - - name: Deploy the overcloud - hosts: undercloud - gather_facts: yes - roles: - - tripleo-overcloud - - - name: Add the overcloud nodes to the generated inventory - hosts: undercloud - gather_facts: yes - tags: - - overcloud-deploy - vars: - inventory: all - roles: - - tripleo-inventory - - # Check the results of the deployment, note after inventory has executed - - name: Check the result of the deployment - hosts: localhost - tags: - - overcloud-deploy - tasks: - - name: ensure the deployment result has been read into memory - include_vars: "{{ local_working_dir }}/overcloud_deployment_result.json" - - # overcloud_deploy_result = ["failed", "passed"] - - name: did the deployment pass or fail? - debug: var=overcloud_deploy_result - failed_when: overcloud_deploy_result == "failed" - - # HA Validation - - name: Validate the overcloud using HA tests - hosts: undercloud - gather_facts: no - roles: - - tripleo-overcloud-validate-ha - tags: - - overcloud-validate-ha +```yaml +--- +# Provision and initial undercloud setup +- name: Baremetal undercloud install + hosts: localhost + roles: + - tripleo-baremetal-undercloud + tags: + - undercloud-bm-install +# Machine at this point is provided +- name: Add the undercloud node to the generated inventory + hosts: localhost + gather_facts: yes + tags: + - undercloud-scripts + roles: + - tripleo-inventory + +# Deploy the undercloud +- name: Install undercloud + hosts: undercloud + gather_facts: no + tags: + - undercloud-install + roles: + - tripleo/undercloud + +# Baremetal preparation (with workarounds) +- name: Prepare baremetal for the overcloud deployment + hosts: undercloud + roles: + - overcloud-prep-baremetal + tags: + - overcloud-prep-baremetal + +# Prepare any additional configuration files required by the overcloud +- name: Prepare configuration files for the overcloud deployment + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-config + +# Prepare the overcloud images for deployment +- name: Prepare the overcloud images for deployment + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-images + +# Prepare the overcloud flavor configuration +- name: Prepare overcloud flavors + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-flavors + +# Prepare the undercloud networks for the overcloud deployment +- name: Prepare the undercloud networks for the overcloud deployment + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-network + +# Deploy the overcloud +- name: Deploy the overcloud + hosts: undercloud + gather_facts: yes + roles: + - tripleo-overcloud + +- name: Add the overcloud nodes to the generated inventory + hosts: undercloud + gather_facts: yes + tags: + - overcloud-deploy + vars: + inventory: all + roles: + - tripleo-inventory + +# Check the results of the deployment, note after inventory has executed +- name: Check the result of the deployment + hosts: localhost + tags: + - overcloud-deploy + tasks: + - name: ensure the deployment result has been read into memory + include_vars: "{{ local_working_dir }}/overcloud_deployment_result.json" + + # overcloud_deploy_result = ["failed", "passed"] + - name: did the deployment pass or fail? + debug: var=overcloud_deploy_result + failed_when: overcloud_deploy_result == "failed" + +# HA Validation +- name: Validate the overcloud using HA tests + hosts: undercloud + gather_facts: no + roles: + - tripleo-overcloud-validate-ha + tags: + - overcloud-validate-ha +``` The steps of the sample playbook are these: @@ -272,24 +304,10 @@ The steps of the sample playbook are these: * Undercloud is prepared for deploying * Overcloud is then deployed, inventoried and validated -So you can invoke *quickstart.sh* like this: - - ./quickstart.sh -v --clean --playbook baremetal-undercloud-validate-ha.yml --working-dir /path/to/workdir --requirements /path/to/quickstart-extras-requirements.txt --config /path/to/config.yml --release --tags all - -Basically this command: - -* Uses the playbook **baremetal-undercloud.yml** -* Uses a custom workdir that is rebuilt from scratch (so if it already exists, it is dropped) -* Get all the extra requirements -* Select the config file -* Chooses release (liberty, mitaka or “master” for newton) -* Performs all the tasks in the playbook -* Starts the installation on virthost - License ------- -BSD +Apache Author Information ------------------ From a35c9c7090cbbab7e32c20be6f417c3d504ee203 Mon Sep 17 00:00:00 2001 From: Attila Darazs Date: Mon, 21 Nov 2016 11:50:35 +0100 Subject: [PATCH 11/11] Cleanup and move files for baremetal-undercloud --- .gitignore | 2 - .gitreview | 5 - LICENSE | 202 ------------------ .../baremetal-undercloud/README.md | 0 .../baremetal-undercloud/defaults}/main.yml | 0 .../baremetal-undercloud/meta}/main.yml | 0 .../tasks}/machine-provisioning.yml | 0 .../tasks}/machine-setup.yml | 0 .../baremetal-undercloud/tasks}/main.yml | 0 .../tasks}/overcloud-images.yml | 0 .../tasks}/undercloud-repos-conf.yml | 0 .../templates}/overcloud-images.sh.j2 | 0 .../templates}/undercloud-repos-conf.sh.j2 | 0 setup.cfg | 34 --- setup.py | 19 -- 15 files changed, 262 deletions(-) delete mode 100644 .gitignore delete mode 100644 .gitreview delete mode 100644 LICENSE rename README.md => roles/baremetal-undercloud/README.md (100%) rename {defaults => roles/baremetal-undercloud/defaults}/main.yml (100%) rename {meta => roles/baremetal-undercloud/meta}/main.yml (100%) rename {tasks => roles/baremetal-undercloud/tasks}/machine-provisioning.yml (100%) rename {tasks => roles/baremetal-undercloud/tasks}/machine-setup.yml (100%) rename {tasks => roles/baremetal-undercloud/tasks}/main.yml (100%) rename {tasks => roles/baremetal-undercloud/tasks}/overcloud-images.yml (100%) rename {tasks => roles/baremetal-undercloud/tasks}/undercloud-repos-conf.yml (100%) rename {templates => roles/baremetal-undercloud/templates}/overcloud-images.sh.j2 (100%) rename {templates => roles/baremetal-undercloud/templates}/undercloud-repos-conf.sh.j2 (100%) delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 7fdea582c..000000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.pyc -*.egg-info diff --git a/.gitreview b/.gitreview deleted file mode 100644 index 5a6ba0a9d..000000000 --- a/.gitreview +++ /dev/null @@ -1,5 +0,0 @@ -[gerrit] -host=review.gerrithub.io -port=29418 -project=redhat-openstack/ansible-role-tripleo-baremetal-undercloud.git -defaultbranch=master diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 8f71f43fe..000000000 --- a/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/README.md b/roles/baremetal-undercloud/README.md similarity index 100% rename from README.md rename to roles/baremetal-undercloud/README.md diff --git a/defaults/main.yml b/roles/baremetal-undercloud/defaults/main.yml similarity index 100% rename from defaults/main.yml rename to roles/baremetal-undercloud/defaults/main.yml diff --git a/meta/main.yml b/roles/baremetal-undercloud/meta/main.yml similarity index 100% rename from meta/main.yml rename to roles/baremetal-undercloud/meta/main.yml diff --git a/tasks/machine-provisioning.yml b/roles/baremetal-undercloud/tasks/machine-provisioning.yml similarity index 100% rename from tasks/machine-provisioning.yml rename to roles/baremetal-undercloud/tasks/machine-provisioning.yml diff --git a/tasks/machine-setup.yml b/roles/baremetal-undercloud/tasks/machine-setup.yml similarity index 100% rename from tasks/machine-setup.yml rename to roles/baremetal-undercloud/tasks/machine-setup.yml diff --git a/tasks/main.yml b/roles/baremetal-undercloud/tasks/main.yml similarity index 100% rename from tasks/main.yml rename to roles/baremetal-undercloud/tasks/main.yml diff --git a/tasks/overcloud-images.yml b/roles/baremetal-undercloud/tasks/overcloud-images.yml similarity index 100% rename from tasks/overcloud-images.yml rename to roles/baremetal-undercloud/tasks/overcloud-images.yml diff --git a/tasks/undercloud-repos-conf.yml b/roles/baremetal-undercloud/tasks/undercloud-repos-conf.yml similarity index 100% rename from tasks/undercloud-repos-conf.yml rename to roles/baremetal-undercloud/tasks/undercloud-repos-conf.yml diff --git a/templates/overcloud-images.sh.j2 b/roles/baremetal-undercloud/templates/overcloud-images.sh.j2 similarity index 100% rename from templates/overcloud-images.sh.j2 rename to roles/baremetal-undercloud/templates/overcloud-images.sh.j2 diff --git a/templates/undercloud-repos-conf.sh.j2 b/roles/baremetal-undercloud/templates/undercloud-repos-conf.sh.j2 similarity index 100% rename from templates/undercloud-repos-conf.sh.j2 rename to roles/baremetal-undercloud/templates/undercloud-repos-conf.sh.j2 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index d9c895cbb..000000000 --- a/setup.cfg +++ /dev/null @@ -1,34 +0,0 @@ -[metadata] -name = ansible-role-tripleo-baremetal-undercloud -summary = ansible-role-tripleo-baremetal-undercloud - A ansible role for deploying a tripleo overcloud via baremetal undercloud -description-file = - README.md -author = RDO-CI Team -author-email = rscarazz@redhat.com -home-page = https://github.com/redhat-openstack/ansible-role-tripleo-baremetal-undercloud -classifier = - License :: OSI Approved :: Apache Software License - Development Status :: 4 - Beta - Intended Audience :: Developers - Intended Audience :: System Administrators - Intended Audience :: Information Technology - Topic :: Utilities - -[global] -setup-hooks = - pbr.hooks.setup_hook - -[files] -data_files = - playbooks = playbooks/* - usr/local/share/ansible/roles/tripleo-baremetal-undercloud/defaults = defaults/* - usr/local/share/ansible/roles/tripleo-baremetal-undercloud/meta = meta/* - usr/local/share/ansible/roles/tripleo-baremetal-undercloud/tasks = tasks/* - usr/local/share/ansible/roles/tripleo-baremetal-undercloud/templates = templates/* - -[wheel] -universal = 1 - -[pbr] -skip_authors = True -skip_changelog = True diff --git a/setup.py b/setup.py deleted file mode 100644 index 6a931a61c..000000000 --- a/setup.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright Red Hat, Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import setuptools - -setuptools.setup( - setup_requires=['pbr'], - pbr=True)