From 5730c2993ae1a255e3a1a9d1a507539221627ec3 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sat, 17 Oct 2015 16:05:04 -0400 Subject: [PATCH] Retire stackforge/tripleo-ansible --- .coveragerc | 7 - .gitignore | 51 -- .gitreview | 4 - .mailmap | 3 - .testr.conf | 7 - CONTRIBUTING.rst | 16 - HACKING.rst | 4 - LICENSE | 175 ------ MANIFEST.in | 6 - README.rst | 282 +-------- Troubleshooting.rst | 578 ------------------ ansible.cfg | 3 - babel.cfg | 1 - doc/source/conf.py | 75 --- doc/source/contributing.rst | 4 - doc/source/index.rst | 24 - doc/source/installation.rst | 12 - doc/source/readme.rst | 1 - doc/source/usage.rst | 7 - elements/tripleo-ansible/README.md | 6 - elements/tripleo-ansible/element-deps | 2 - .../31-tripleo-ansible | 28 - .../source-repository-tripleo-ansible | 1 - examples/playbooks/auth_vars.yml.ex | 20 - examples/playbooks/simple_rebuild.yml | 28 - examples/simple_iterative_applier/README.rst | 53 -- .../simple_iterative_applier/instances.txt | 4 - examples/simple_iterative_applier/main.yml | 33 - .../simple_iterative_applier/simple_update.py | 64 -- .../update_config.cfg | 26 - library/cloud/nova_facts | 185 ------ openstack-common.conf | 6 - playbooks/activate_cinder_volumes.yml | 44 -- playbooks/all_disable_os_collect_config.yml | 17 - playbooks/all_refresh_config.yml | 17 - playbooks/cleanup_cinder_volumes.yml | 36 -- playbooks/cleanup_rabbitmq_start.yml | 31 - playbooks/disable_os_collect_config.yml | 37 -- playbooks/enable_start_os_collect_config.yml | 21 - playbooks/files/cleanup_cinder_devices.sh | 7 - playbooks/files/cleanup_loop_devices.sh | 6 - .../files/correct_mnt_state_permissions.py | 176 ------ playbooks/files/create-databases.sh | 24 - playbooks/files/explode-deployments.py | 27 - playbooks/files/os-collect-config.conf | 4 - playbooks/files/patch-ssh-client-config.sh | 31 - playbooks/files/rabbitmq-server.override | 1 - playbooks/files/wait_for_database-helion.sh | 36 -- playbooks/galera_status.yml | 38 -- playbooks/library/glance_download | 245 -------- playbooks/library/nova_powercontrol | 350 ----------- playbooks/library/nova_rebuild | 268 -------- playbooks/library/service_facts | 42 -- playbooks/mysql_access_fix.yml | 17 - playbooks/mysql_init_fix.yml | 17 - playbooks/pre-flight_check.yml | 124 ---- playbooks/preserve_ssh_host_keys.yml | 33 - playbooks/rabbitmq_occ_disable.yml | 26 - playbooks/rabbitmq_rejoin_cluster.yml | 13 - playbooks/rebuild.yml | 47 -- playbooks/refresh_config.yml | 34 -- playbooks/restart_vms.yml | 23 - playbooks/restore_ssh_host_keys.yml | 24 - .../roles/pre_flight_disk_check/README.rst | 28 - .../pre_flight_disk_check/defaults/main.yml | 20 - .../pre_flight_disk_check/tasks/main.yml | 23 - playbooks/start_cloud.yml | 36 -- playbooks/start_mysql.yml | 19 - playbooks/start_rabbitmq.yml | 38 -- playbooks/step_check_image_vars.yml | 35 -- .../step_cleanup_from_online_upgrade.yml | 25 - playbooks/step_cloud_init.yml | 24 - playbooks/step_create_databases.yml | 26 - playbooks/step_fail_unmount.yml | 22 - playbooks/step_generate_hosts_file.yml | 24 - playbooks/step_os-apply-config.yml | 18 - playbooks/step_ping.yml | 7 - playbooks/step_post_hook.yml | 26 - playbooks/step_pre_hook.yml | 26 - playbooks/step_preserve_iscsi_initiator.yml | 21 - playbooks/step_preserve_password_file.yml | 23 - .../step_reset_mnt_state_permissions.yml | 21 - playbooks/step_restore_iscsi_initiator.yml | 21 - playbooks/step_run_occ.yml | 35 -- playbooks/step_stamp_image_id.yml | 23 - playbooks/step_stop_ns_metadata_proxy.yml | 24 - playbooks/step_stop_services.yml | 27 - playbooks/step_undercloud_backup_tftpboot.yml | 21 - ...undercloud_ironic_release_reservations.yml | 25 - .../step_undercloud_restore_tftpboot.yml | 18 - playbooks/step_unmount.yml | 23 - playbooks/step_update_online.yml | 197 ------ .../step_update_online_download_image.yml | 24 - playbooks/step_update_rebuild_node.yml | 26 - playbooks/step_upload_image.yml | 22 - playbooks/stop_cloud.yml | 30 - playbooks/stop_mysql.yml | 21 - playbooks/stop_tgt.yml | 23 - playbooks/stop_vms.yml | 56 -- playbooks/templates/heat_local.json.j2 | 12 - playbooks/templates/host_metadata.json.j2 | 1 - playbooks/templates/os_config_files.json.j2 | 1 - playbooks/update_cloud.yml | 536 ---------------- playbooks/update_local_ssh_config.yml | 18 - plugins/inventory/group_vars/all | 263 -------- plugins/inventory/heat.py | 280 --------- requirements.txt | 7 - scripts/build_tarball.sh | 35 -- scripts/inject_nova_meta.bash | 64 -- scripts/populate_image_vars | 164 ----- scripts/retrieve_oc_vars | 7 - setup.cfg | 46 -- setup.py | 22 - test-requirements.txt | 11 - test.sh | 152 ----- tox.ini | 34 -- tripleo_ansible/__init__.py | 19 - tripleo_ansible/tests/__init__.py | 0 tripleo_ansible/tests/base.py | 53 -- tripleo_ansible/tests/test_tripleo_ansible.py | 28 - 120 files changed, 5 insertions(+), 6358 deletions(-) delete mode 100644 .coveragerc delete mode 100644 .gitignore delete mode 100644 .gitreview delete mode 100644 .mailmap delete mode 100644 .testr.conf delete mode 100644 CONTRIBUTING.rst delete mode 100644 HACKING.rst delete mode 100644 LICENSE delete mode 100644 MANIFEST.in delete mode 100644 Troubleshooting.rst delete mode 100644 ansible.cfg delete mode 100644 babel.cfg delete mode 100755 doc/source/conf.py delete mode 100644 doc/source/contributing.rst delete mode 100644 doc/source/index.rst delete mode 100644 doc/source/installation.rst delete mode 100644 doc/source/readme.rst delete mode 100644 doc/source/usage.rst delete mode 100644 elements/tripleo-ansible/README.md delete mode 100644 elements/tripleo-ansible/element-deps delete mode 100755 elements/tripleo-ansible/install.d/tripleo-ansible-source-install/31-tripleo-ansible delete mode 100644 elements/tripleo-ansible/source-repository-tripleo-ansible delete mode 100644 examples/playbooks/auth_vars.yml.ex delete mode 100644 examples/playbooks/simple_rebuild.yml delete mode 100644 examples/simple_iterative_applier/README.rst delete mode 100644 examples/simple_iterative_applier/instances.txt delete mode 100644 examples/simple_iterative_applier/main.yml delete mode 100644 examples/simple_iterative_applier/simple_update.py delete mode 100644 examples/simple_iterative_applier/update_config.cfg delete mode 100644 library/cloud/nova_facts delete mode 100644 openstack-common.conf delete mode 100644 playbooks/activate_cinder_volumes.yml delete mode 100644 playbooks/all_disable_os_collect_config.yml delete mode 100644 playbooks/all_refresh_config.yml delete mode 100644 playbooks/cleanup_cinder_volumes.yml delete mode 100644 playbooks/cleanup_rabbitmq_start.yml delete mode 100644 playbooks/disable_os_collect_config.yml delete mode 100644 playbooks/enable_start_os_collect_config.yml delete mode 100644 playbooks/files/cleanup_cinder_devices.sh delete mode 100644 playbooks/files/cleanup_loop_devices.sh delete mode 100755 playbooks/files/correct_mnt_state_permissions.py delete mode 100644 playbooks/files/create-databases.sh delete mode 100644 playbooks/files/explode-deployments.py delete mode 100644 playbooks/files/os-collect-config.conf delete mode 100644 playbooks/files/patch-ssh-client-config.sh delete mode 100644 playbooks/files/rabbitmq-server.override delete mode 100644 playbooks/files/wait_for_database-helion.sh delete mode 100644 playbooks/galera_status.yml delete mode 100644 playbooks/library/glance_download delete mode 100644 playbooks/library/nova_powercontrol delete mode 100644 playbooks/library/nova_rebuild delete mode 100644 playbooks/library/service_facts delete mode 100644 playbooks/mysql_access_fix.yml delete mode 100644 playbooks/mysql_init_fix.yml delete mode 100644 playbooks/pre-flight_check.yml delete mode 100644 playbooks/preserve_ssh_host_keys.yml delete mode 100644 playbooks/rabbitmq_occ_disable.yml delete mode 100644 playbooks/rabbitmq_rejoin_cluster.yml delete mode 100644 playbooks/rebuild.yml delete mode 100644 playbooks/refresh_config.yml delete mode 100644 playbooks/restart_vms.yml delete mode 100644 playbooks/restore_ssh_host_keys.yml delete mode 100644 playbooks/roles/pre_flight_disk_check/README.rst delete mode 100644 playbooks/roles/pre_flight_disk_check/defaults/main.yml delete mode 100644 playbooks/roles/pre_flight_disk_check/tasks/main.yml delete mode 100644 playbooks/start_cloud.yml delete mode 100644 playbooks/start_mysql.yml delete mode 100644 playbooks/start_rabbitmq.yml delete mode 100644 playbooks/step_check_image_vars.yml delete mode 100644 playbooks/step_cleanup_from_online_upgrade.yml delete mode 100644 playbooks/step_cloud_init.yml delete mode 100644 playbooks/step_create_databases.yml delete mode 100644 playbooks/step_fail_unmount.yml delete mode 100644 playbooks/step_generate_hosts_file.yml delete mode 100644 playbooks/step_os-apply-config.yml delete mode 100644 playbooks/step_ping.yml delete mode 100644 playbooks/step_post_hook.yml delete mode 100644 playbooks/step_pre_hook.yml delete mode 100644 playbooks/step_preserve_iscsi_initiator.yml delete mode 100644 playbooks/step_preserve_password_file.yml delete mode 100644 playbooks/step_reset_mnt_state_permissions.yml delete mode 100644 playbooks/step_restore_iscsi_initiator.yml delete mode 100644 playbooks/step_run_occ.yml delete mode 100644 playbooks/step_stamp_image_id.yml delete mode 100644 playbooks/step_stop_ns_metadata_proxy.yml delete mode 100644 playbooks/step_stop_services.yml delete mode 100644 playbooks/step_undercloud_backup_tftpboot.yml delete mode 100644 playbooks/step_undercloud_ironic_release_reservations.yml delete mode 100644 playbooks/step_undercloud_restore_tftpboot.yml delete mode 100644 playbooks/step_unmount.yml delete mode 100644 playbooks/step_update_online.yml delete mode 100644 playbooks/step_update_online_download_image.yml delete mode 100644 playbooks/step_update_rebuild_node.yml delete mode 100644 playbooks/step_upload_image.yml delete mode 100644 playbooks/stop_cloud.yml delete mode 100644 playbooks/stop_mysql.yml delete mode 100644 playbooks/stop_tgt.yml delete mode 100644 playbooks/stop_vms.yml delete mode 100644 playbooks/templates/heat_local.json.j2 delete mode 100644 playbooks/templates/host_metadata.json.j2 delete mode 100644 playbooks/templates/os_config_files.json.j2 delete mode 100644 playbooks/update_cloud.yml delete mode 100644 playbooks/update_local_ssh_config.yml delete mode 100644 plugins/inventory/group_vars/all delete mode 100755 plugins/inventory/heat.py delete mode 100644 requirements.txt delete mode 100755 scripts/build_tarball.sh delete mode 100755 scripts/inject_nova_meta.bash delete mode 100755 scripts/populate_image_vars delete mode 100644 scripts/retrieve_oc_vars delete mode 100644 setup.cfg delete mode 100755 setup.py delete mode 100644 test-requirements.txt delete mode 100755 test.sh delete mode 100644 tox.ini delete mode 100644 tripleo_ansible/__init__.py delete mode 100644 tripleo_ansible/tests/__init__.py delete mode 100644 tripleo_ansible/tests/base.py delete mode 100644 tripleo_ansible/tests/test_tripleo_ansible.py diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 9d0dfb0..0000000 --- a/.coveragerc +++ /dev/null @@ -1,7 +0,0 @@ -[run] -branch = True -source = tripleo_ansible -omit = tripleo_ansible/tests/*,tripleo_ansible/openstack/* - -[report] -ignore-errors = True \ No newline at end of file diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 1399c98..0000000 --- a/.gitignore +++ /dev/null @@ -1,51 +0,0 @@ -*.py[cod] - -# C extensions -*.so - -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg -lib -lib64 - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox -nosetests.xml -.testrepository - -# Translations -*.mo - -# Mr Developer -.mr.developer.cfg -.project -.pydevproject - -# Complexity -output/*.html -output/*/index.html - -# Sphinx -doc/build - -# pbr generates these -AUTHORS -ChangeLog - -# Editors -*~ -.*.swp \ No newline at end of file diff --git a/.gitreview b/.gitreview deleted file mode 100644 index 439d206..0000000 --- a/.gitreview +++ /dev/null @@ -1,4 +0,0 @@ -[gerrit] -host=review.openstack.org -port=29418 -project=stackforge/tripleo-ansible.git diff --git a/.mailmap b/.mailmap deleted file mode 100644 index cc92f17..0000000 --- a/.mailmap +++ /dev/null @@ -1,3 +0,0 @@ -# Format is: -# -# \ No newline at end of file diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index fb62267..0000000 --- a/.testr.conf +++ /dev/null @@ -1,7 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ - OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ - OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ - ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list \ No newline at end of file diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst deleted file mode 100644 index 89a3ae5..0000000 --- a/CONTRIBUTING.rst +++ /dev/null @@ -1,16 +0,0 @@ -If you would like to contribute to the development of OpenStack, -you must follow the steps in this page: - - http://docs.openstack.org/infra/manual/developers.html - -Once those steps have been completed, changes to OpenStack -should be submitted for review via the Gerrit tool, following -the workflow documented at: - - http://docs.openstack.org/infra/manual/developers.html#development-workflow - -Pull requests submitted through GitHub will be ignored. - -Bugs should be filed on Launchpad, not GitHub: - - https://bugs.launchpad.net/tripleo-ansible \ No newline at end of file diff --git a/HACKING.rst b/HACKING.rst deleted file mode 100644 index db391aa..0000000 --- a/HACKING.rst +++ /dev/null @@ -1,4 +0,0 @@ -tripleo-ansible Style Commandments -=============================================== - -Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/ \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 67db858..0000000 --- a/LICENSE +++ /dev/null @@ -1,175 +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. diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 90f8a7a..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,6 +0,0 @@ -include AUTHORS -include ChangeLog -exclude .gitignore -exclude .gitreview - -global-exclude *.pyc \ No newline at end of file diff --git a/README.rst b/README.rst index 56d0d10..9006052 100644 --- a/README.rst +++ b/README.rst @@ -1,279 +1,7 @@ -Using Ansible to update images -============================== +This project is no longer maintained. -This is a new approach to updating an in-place TripleO cloud with new -images. We have chosen Ansible as it allows fine grained control of -the work-flow without requiring one to write any idempotent bash or -python. There are components that are bash or python scripts, and we are -working hard not to replace the whole of TripleO with Ansible, but just -the pieces that make updates more complicated than they need to be. - -In general this update process works in the following manner: - - * Gather inventory and facts about the deployed cloud from Heat and Nova - * Quiesce the cloud by shutting down all OpenStack services on - appropriate nodes - * Nova-Rebuild nodes using requested image ids - * Disable os-collect-config polling of Heat - * Push Metadata from Heat to rebuilt nodes using Ansible and manually - trigger os-collect-config - * Start OpenStack services - -Installing Ansible ------------------- - -Ideally the node Ansible is to be executed from was built with the following -disk image elements: - - * ansible - * tripleo-ansible - -Systems that the playbooks are brining up should ideally have the following -disk image elements: - - * restore-ssh-host-keys - * disable-os-collect-config - -If Ansible is not preloaded, it can be installed via `pip install -ansible` Ansible 1.8.1 or later is required. - -If you have manually installed Ansible, see the section on "Setting -the OS Environment" for details on ensuring your dependencies are -met. - -Executing Scripts and Playbooks -------------------------------- - -All Ansible playbooks and scripts have been written to be run directly -from the tripleo-ansible folder. - -An ``ansible.cfg`` file is provided. If you have a systemwide -(/etc/ansible/ansible.conf) or user-specific ( ~/.ansible.cfg) Ansible -config file, then Ansible will not utilize the provided configuration file. - -Pre-flight check ----------------- - -A playbook exists that can be used to check the controllers prior to the -execution of the main playbook in order to quickly identify any issues in -advance. - -All controller nodes must be in a healty state (ACTIVE) for the pre flight -checks to pass. We **CANNOT** proceed with an update if a controller node is -down. - - ansible-playbook -vvvv -M library/cloud -i plugins/inventory/heat.py -u heat-admin playbooks/pre-flight_check.yml - -Running the updates -------------------- - -You will want to set your environment variables to the appropriate -values for the following: OS_AUTH_URL, OS_USERNAME, OS_PASSWORD, and -OS_TENANT_NAME - - source /root/stackrc - -Your new images will need to be uploaded to glance, such that an instance -can be booted from them, and the image ID will need to be provided to -the playbook as an argument. - -You can obtain the ID with the `glance image-list` command, and then -set them to be passed into ansible as arguments. - - glance image-list - -Upon execution, you will see output along these lines: - - +--------------------------------------+---------------------------+-------------+------------------+------------+--------+ - | ID | Name | Disk Format | Container Format | Size | Status | - +--------------------------------------+---------------------------+-------------+------------------+------------+--------+ - | 4ba4c941-2065-4925-8ddc-328d813051c3 | bm-deploy-kernel | aki | aki | 3194080 | active | - | b0379d39-b73e-459e-a22d-a79645b83995 | bm-deploy-ramdisk | ari | ari | 24962351 | active | - | b89342a9-94f7-4e19-a179-6b0d67a857a1 | overcloud-compute | qcow2 | bare | 706412544 | active | - | f25cc0d7-ff6f-4beb-9456-e24b06f5a2e4 | overcloud-compute-initrd | ari | ari | 10557800 | active | - | cbdccc2e-aaf0-4080-88bb-57656f31e747 | overcloud-compute-vmlinuz | aki | aki | 3194080 | active | - | a5b85458-f355-49e0-bdc9-29824f2429d5 | overcloud-control | qcow2 | bare | 1210996736 | active | - | 642f4197-5d4e-4e10-b466-188df9ac2915 | overcloud-control-initrd | ari | ari | 11652799 | active | - | 9c386c74-66d8-4937-9438-d00c9740670d | overcloud-control-vmlinuz | aki | aki | 3194080 | active | - | f52e97c6-e91a-4885-94be-97ea324f6c06 | overcloud-swift | qcow2 | bare | 440991744 | active | - | 1fd49eff-bdbc-4176-b4f5-3779848c5894 | overcloud-swift-initrd | ari | ari | 10557940 | active | - | 50aaab4b-8085-470c-9cc9-9fbfb9891071 | overcloud-swift-vmlinuz | aki | aki | 3194080 | active | - +--------------------------------------+---------------------------+-------------+------------------+------------+--------+ - -It may be possible to infer the image IDs using the script -"populate_image_vars". It will try to determine the latest image for -each image class and set it as a group variable in inventory. For -this to function correctly, the new images in glance must have the -same names that the previous images had, which match the node type -name, such as undercloud, swift, compute, control. - - scripts/populate_image_vars - -Upon execution, you will see output that indicates the ID values that -have been stored for the image variable. Example output below: - - { - "nova-compute": { - "buildnum": null, - "id": "b89342a9-94f7-4e19-a179-6b0d67a857a1" - }, - "swift-storage": { - "buildnum": null, - "id": "f52e97c6-e91a-4885-94be-97ea324f6c06" - }, - "controller": { - "buildnum": null, - "id": "a5b85458-f355-49e0-bdc9-29824f2429d5" - }, - } - ... Creating plugins/inventory/group_vars/nova-compute - ... Creating plugins/inventory/group_vars/swift-storage - ... Creating plugins/inventory/group_vars/controller - -After the populate_image_vars script runs, inspect the output, -example above, and if the data is what you expect, you can omit -the image ids from the ansible command line below. Note, the -undercloud is not shown in this list as this documentation is -geared for overcloud updates, however when you utilize the update -for the undercloud, the variable that needs to be set is -undercloud_rebuild_image_id. - -Once you are ready to execute the update, below is an example command -for updating the overcloud, showing all of the disk image IDs being -defined on the command line. - - ansible-playbook -vvvv -u heat-admin -i plugins/inventory/heat.py -e nova_compute_rebuild_image_id=1ae9fe6e-c0cc-4f62-8e2b-1d382b20fdcb -e controller_rebuild_image_id=2432dd37-a072-463d-ab86-0861bb5f36cc -e swift_storage_rebuild_image_id=2432dd37-a072-463d-ab86-0861bb5f36cc playbooks/update_cloud.yml - -If you have set the image ids in group vars or via the -populate_image_vars script: - - ansible-playbook -vvvv -u heat-admin -i plugins/inventory/heat.py playbooks/update_cloud.yml - -Below, we break down the above command so you can see what each part does: - - * -vvvv - Make Ansible very verbose. - * -u heat-admin - Utilize the heat-admin user to connect to the remote machine. - * -i plugins/inventory/heat.py - Sets the inventory plugin. - * -e nova_compute_rebuild_image_id=1ae9fe6e-c0cc-4f62-8e2b-1d382b20fdcb - Sets the compute node image ID. - * -e controller_rebuild_image_id=2432dd37-a072-463d-ab86-0861bb5f36cc - Sets the controller node image ID. - * -e swift_storage_rebuild_image_id=2432dd37-a072-463d-ab86-0861bb5f36cc - Sets the swift storage node image ID. - * playbooks/update_cloud.yml is the path and file name to the ansible playbook that will be utilized. - -Upon a successful completion, ansible will print a summary report: - - PLAY RECAP ******************************************************************** - 192.0.2.24 : ok=18 changed=9 unreachable=0 failed=0 - 192.0.2.25 : ok=19 changed=9 unreachable=0 failed=0 - 192.0.2.26 : ok=18 changed=8 unreachable=0 failed=0 - -Additionally: - -As ansible utilizes SSH, you may encounter ssh key errors if the IP -address has been re-used. The fact that SSH keys aren't preserved is a -defect that is being addressed. In order to avoid problems while this -defect is being fixed, you will want to set an environment variable of -"ANSIBLE_HOST_KEY_CHECKING=False", example below. - - ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -vvvv -M library/cloud -i plugins/inventory/heat.py -e controller_rebuild_image_id=4bee1a0a-2670-48e4-a3a4-17da6be795cb -e nova_compute_rebuild_image_id=bd20e098-0753-4dc8-8dba-2f739c01ee65 -u heat-admin playbooks/update_cloud.yml - -Python, the language that ansible is written in, buffers IO output by default. -This can be observed as long pauses between sudden bursts of log entries where -multiple steps are observed, particullarlly when executed by Jenkins. This -behavior can be disabled by passing setting the an environment variable of -"PYTHONUNBUFFERED=1", examble below. - - PYTHONUNBUFFERED=1 ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -vvvv -M library/cloud -i plugins/inventory/heat.py -e controller_rebuild_image_id=4bee1a0a-2670-48e4-a3a4-17da6be795cb -e nova_compute_rebuild_image_id=bd20e098-0753-4dc8-8dba-2f739c01ee65 -u heat-admin playbooks/update_cloud.yml - -For more information about Ansible, please refer to the documentation at http://docs.ansible.com/ - -Failure Handling ----------------- - -Ansible has tunable options to abort the execution of a playbook upon -encountering a failure. - -The max_fail_percentage parameter allows users to define what percentage of -nodes can fail before the playbook stops executing. This setting is pre-defined -in the playbook file playbooks/update_cloud.yml. The default value is zero, -which causes the playbook to abort execution if any node fails. You can read -about this option at: -http://docs.ansible.com/playbooks_delegation.html#maximum-failure-percentage - -Additionally, it should be noted that the any_errors_fatal variable, when -set to a value of True, will result in ansible aborting upon encountering -any failures. This variable can be set by adding '-e any_errors_fatal=True' -to the command line. - -Additional Options ------------------- - -The plugins/inventory/group_vars/all file has the following options in order -to tune behavior of the playbook execution. These options can be enabled by -defining the variable name that they represent on the ansible comamnd line, or -by uncommenting the appropriate line in the plugins/inventory/group-vars/all -file. - - * force_rebuild - This option overrides the logic that prevents an instance - from being rebuilt if the pre-existing image id maches the id being deployed. - This may be useful for the purposes of testing. - Example command line addition: -e force_rebuild=True - * wait_for_hostkey - This option causes the playbook to wait for the - SSH host keys to be restored. This option should only be used if - the restore-ssh-host-keys element is built into the new image. - * single_controller - This option is for when a single controller node is - receiving an upgrade. It alters the logic so that mysql checks operate - as if the mysql database cluster is being maintained online by other - controller nodes during the upgrade. *IF* you are looking at this option - due to an error indicating "Node appears to be the last node in a cluster" - then consult Troubleshooting.rst. - * ssh_timeout - This value, defaulted to 900 [seconds], is the maximum - amount of time that the post-rebuild ssh connection test will wait for - before proceeding. - * pre_hook_command - This, when set to a command, such as /bin/date, - will execute that command on the host where the playbook is run - before starting any jobs. - * post_hook_command - Similar to the pre_hook_command variable, when - defined, will execute upon the completion of the upgrade job. - * online_upgrade - This setting tells the script to attempt an online upgrade - of the node. At present this is only known to work on compute nodes. - -Online Upgrade --------------- - -When an upgrade *does not* require a kernel update, the Online Upgrade feature -can be utilized to upgrade compute nodes while leaving their virtual machines -in a running state. The result is a short one to two minute loss of network -connectivity for the virtual machines as os-refresh-config stops and -restarts key services which causes the loss in network connectivity. - -This operation is performed by uploading the new image to the /tmp folder on -the node, syncing file contents over while preserving key files, and then -restarting services. This is only known to work on compute nodes. - -Nova Powercontrol ------------------ - -A module named nova_powercontrol has been included which is intended to utilize -nova for all instance power control operations. This utility module also records -the previous state of the instance and has a special flag which allows the user -to resume or restart all virtual machines that are powered off/suspended upon the -completion of the upgrade if the module is utilized to shut down the instances. - -To Use: - -From the tripleo-ansible folder, execute the command: - - bash scripts/retrieve_oc_vars - -The script will then inform you of a file you need to source into your current -user environment, it will contain the overcloud API credentials utilizing modified -variable names which the playbook knows how to utilize. - - source /root/oc-stackrc-tripleo-ansible - -Now that the environment variables are present, add the following to the -ansible-playbook command line for the playbooks to utilize the nova_powercontrol -module: - - -e use_nova_powercontrol=True +The contents of this repository are still available in the Git source code +management system. To see the contents of this repository before it reached +its end of life, please check out the previous commit with +"git checkout HEAD^1". diff --git a/Troubleshooting.rst b/Troubleshooting.rst deleted file mode 100644 index 87a010b..0000000 --- a/Troubleshooting.rst +++ /dev/null @@ -1,578 +0,0 @@ -Retrying failed actions -======================= - -In some cases, steps may fail as some components may not yet be ready for -use due to initialization times, which can vary based on hardware and volume -In the event of this occurring, two options exist that allows a user to -optionally re-attempt or resume playbook executions. - - * Solutions: - - * Ansible ansible-playbook command option --start-at-task="TASK NAME" - allows resumption of a playbook, when used with the -l limit option. - - * Ansible ansible-playbook command option --step allows a user to confirm - each task executed by Ansible before it is executed upon. - -A node goes to ERROR state during rebuild -========================================= - -This can happen from time to time due to network errors or temporary -overload of the undercloud. - - * Symptoms: - - * After error, `nova list` shows node in ERROR - - * Solution: - - * Verify hardware is in working order. - - * Verify that approximately 20% of the disk space is free on the Ironic - server node. - - * Get the image ID of the machine with `nova show`:: - - nova show $node_id - - * Rebuild manually:: - - nova rebuild --preserve-ephemeral $node_id $image_id - -A node times out after rebuild -============================== - -While rare, there is the possibility that something unexpected happened -and the host has failed to reboot as expected from a rebuild. - - * Symptoms: - - * Error Message: `msg: Timeout waiting for the server to come up.. Please - check manually` - - * Solution: - - * Follow the steps detailed above in "A node goes to ERROR state during - rebuild" - -MySQL CLI configuration file missing -==================================== - -Should the post-rebuild restart fail, the possibility exists that the -MySQL CLI configuration file is missing. - - * Symptoms: - - * Attempts to access the MySQL CLI command return an error:: - - ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) - - * Solution: - - * Verify that the MySQL CLI config file stored on the state drive - is present and has content within the file. You can do this - by executing the command below to display the contents in your - terminal.:: - - sudo cat /mnt/state/root/metadata.my.cnf - - * If the file is empty, run the command below which will retrieve current - metadata and update config files on disk.:: - - sudo os-collect-config --force --one --command=os-apply-config - - * Verify that the MySQL CLI config file is present in the root user - directory by executing the following command:: - - sudo cat /root/.my.cnf - - * If that file does not exist or is empty, two options exist. - - * Add the following to your MySQL CLI command line:: - - --defaults-extra-file=/mnt/state/root/metadata.my.cnf - - * Alternatively, copy configuration from the state drive.:: - - sudo cp -f /mnt/state/root/metadata.my.cnf /root/.my.cnf - - -MySQL fails to start upon retrying update -========================================= - -If the update was aborted or failed during the Update sequence before a -single MySQL controller was operational, MySQL will fail to start upon retrying. - - * Symptoms: - - * Update is being re-attempted. - - * The following error messages having been observed. - - * `msg: Starting MySQL (Percona XtraDB Cluster) database server: mysqld . . . . The server quit without updating PID file (/var/run/mysqld/mysqld.pid)` - - * `stderr: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)` - - * `FATAL: all hosts have already failed -- aborting` - - * Update automatically aborts. - - * *WARNING*: - - * The command `/etc/init.d/mysql bootstrap-pxc` which is mentioned below - should only ever be executed when an entire MySQL cluster is down, and - then only on the last node to have been shut down. Running this command - on multiple nodes will cause the MySQL cluster to enter a split brain - scenario effectively breaking the cluster which will result in - unpredictable behavior. - - * Solution: - - * Use `nova list` to determine the IP of the controllerMgmt node, then ssh into it:: - - ssh heat-admin@$IP - - * Verify MySQL is down by running the mysql client as root. It _should_ fail:: - - sudo mysql -e "SELECT 1" - - * Attempt to restart MySQL in case another cluster node is online. - This should fail in this error state, however if it succeeds your - cluster should again be operational and the next step can be skipped.:: - - sudo /etc/init.d/mysql start - - * Start MySQL back up in single node bootstrap mode:: - - sudo /etc/init.d/mysql bootstrap-pxc - - -MySQL/Percona/Galera is out of sync -=================================== - -OpenStack is configured to store all of its state in a multi-node -synchronous replication Percona XtraDB Cluster database, which uses -Galera for replication. This database must be in sync and have the full -complement of servers before updates can be performed safely. - - * Symptoms: - - * Update fails with errors about Galera and/or MySQL being "Out of Sync" - - * Solution: - - * use `nova list` to determine IP of controllerMgmt node, then SSH to it:: - - ssh heat-admin@$IP - - * Verify replication is out of sync:: - - sudo mysql -e "SHOW STATUS like 'wsrep_%'" - - * Stop mysql:: - - sudo /etc/init.d/mysql stop - - * Verify it is down by running the mysql client as root. It _should_ fail:: - - sudo mysql -e "SELECT 1" - - * Start controllerMgmt0 MySQL back up in single node bootstrap mode:: - - sudo /etc/init.d/mysql bootstrap-pxc - - * On the remaining controller nodes observed to be having issues, utilize - the IP address via `nova list` and login to them.:: - - ssh heat-admin@$IP - - * Verify replication is out of sync:: - - sudo mysql -e "SHOW STATUS like 'wsrep_%'" - - * Stop mysql:: - - sudo /etc/init.d/mysql stop - - * Verify it is down by running the mysql client as root. It _should_ fail:: - - sudo mysql -e "SELECT 1" - - * Start MySQL back up so it attempts to connect to controllerMgmt0:: - - sudo /etc/init.d/mysql start - - * If restarting MySQL fails, then the database is most certainly out of sync - and the MySQL error logs, located at /var/log/mysql/error.log, will need - to be consulted. In this case, never attempt to restart MySQL with - `sudo /etc/init.d/mysql bootstrap-pxc` as it will bootstrap the host - as a single node cluster thus worsening what already appears to be a - split-brain scenario. - -MysQL "Node appears to be the last node in a cluster" error -=========================================================== - -This error occurs when one of the controller nodes does not have MySQL running. -The playbook has detected that the current node is the last running node, -although based on sequence it should not be the last node. As a result the -error is thrown and update aborted. - - * Symptoms: - - * Update Failed with error message "Galera Replication - Node appears to be the last node in a cluster - cannot safely proceed unless overridden via single_controller setting - See README.rst" - - * Actions: - - * Run the pre-flight_check.yml playbook. It will attempt to restart MySQL - on each node in the "Ensuring MySQL is running -" step. If that step - succeeeds, you should be able to re-run the playbook and not encounter - "Node appears to be last node in a cluster" error. - - * IF pre-flight_check fails to restart MySQL, you will need to consult the - MySQL logs (/var/log/mysql/error.log) to determine why the other nodes - are not restarting. - -SSH Connectivity is lost -======================== - -Ansible uses SSH to communicate with remote nodes. In heavily loaded, single -host virtualized environments, SSH can lose connectivity. It should be noted -that similar issues in a physical environment may indicate issues in the -underlying network infrastructure. - - * Symptoms: - - * Ansible update attempt fails. - - * Error output:: - - fatal: [192.0.2.25] => SSH encountered an unknown error. The - output was: OpenSSH_6.6.1, OpenSSL 1.0.1i-dev xx XXX xxxx - debug1: Reading configuration data /etc/ssh/ssh_config debug1: - /etc/ssh/ssh_config line 19: Applying options for * debug1: - auto-mux: Trying existing master debug2: fd 3 setting - O_NONBLOCK mux_client_hello_exchange: write packet: Broken - pipe FATAL: all hosts have already failed – aborting - - * Solution: - - * You will generally be able to re-run the playbook and complete the - upgrade, unless SSH connectivity is lost while all MySQL nodes are - down. (See 'MySQL fails to start upon retrying update' to correct - this issue.) - - * Early Ubuntu Trusty kernel versions have known issues with KVM which - will severely impact SSH connectivity to instances. Test hosts should - have a minimum kernel version of 3.13.0-36-generic. - The update steps, as root, are:: - - apt-get update - apt-get dist-upgrade - reboot - - * If this issue is repeatedly encountered on a physical environment, the - network infrastructure should be inspected for errors. - - * Similar error messages to the error noted in the Symptom may occur with - long running processes, such as database creation/upgrade steps. These - cases will generally have partial program execution log output - immediately before the broken pipe message visible. - - Should this be the case, Ansible and OpenSSH may need to have their - configuration files tuned to meet the needs of the environment. - - Consult the Ansible configuration file to see available connection settings - ssh_args, timeout, and possibly pipelining..:: - - https://github.com/ansible/ansible/blob/release1.7.0/examples/ansible.cfg - - As Ansible uses OpenSSH, Please reference the ssh_config manual, in - paricular the ServerAliveInterval and ServerAliveCountMax options. - -Postfix fails to reload -======================= - -Occasionally the postfix mail transfer agent will fail to reload because -it is not running when the system expects it to be running. - - * Symptoms: - - * Step in /var/log/upstart/os-collect-config.log shows that 'service postfix reload' failed. - - Solution: - - * Start postfix:: - - sudo service postfix start - -Apache2 Fails to start -====================== - -Apache2 requires some self-signed SSL certificates to be put in place -that may not have been configured yet due to earlier failures in the -setup process. - - * Error Message: - - * failed: [192.0.2.25] => (item=apache2) => {"failed": true, "item": "apache2"} - * msg: start: Job failed to start - - * Symptoms: - - * apache2 service fails to start - * /etc/ssl/certs/ssl-cert-snakeoil.pem is missing or empty - - * Solution: - - * Re-run `os-collect-config` to reassert the SSL certificates:: - - sudo os-collect-config --force --one - -RabbitMQ still running when restart is attempted -================================================ - -There are certain system states that cause RabbitMQ to fail to die on normal kill signals. - - * Symptoms: - - * Attempts to start rabbitmq fail because it is already running - - * Solution: - - * Find any processes running as `rabbitmq` on the box, and kill them, forcibly if need be. - -Instance reported with status == "SHUTOFF" and task_state == "powering on" -========================================================================== - -If nova attempts to restart an instance when the compute node is not ready, -it is possible that nova could entered a confused state where it thinks that -an instance is starting when in fact the compute node is doing nothing. - - * Symptoms: - - * Command `nova list --all-tenants` reports instance(s) with STATUS == - "SHUTOFF" and task_state == "powering on". - * Instance cannot be pinged. - * No instance appears to be running on the compute node. - * Nova hangs upon retrieving logs or returns old logs from the previous - boot. - * Console session cannot be established. - - * Solution: - - * On a controller logged in as root, after executing `source stackrc`: - - * Execute `nova list --all-tenants` to obtain instance ID(s) - - * Execute `nova show ` on each suspected ID to identify - suspected compute nodes. - - * Log into the suspected compute node(s) and execute: - `os-collect-config --force --one` - - * Return to the controller node that you were logged into previously, and - using the instancce IDs obtained previously, take the following steps. - - * Execute `nova reset-state --active ` - - * Execute `nova stop ` - - * Execute `nova start ` - - * Once the above steps have been taken in order, you should see the - instance status return to ACTIVE and the instance become accessible - via the network. - -state drive /mnt is not mounted -=============================== - -In the rare event that something bad happened between the state drive being -unmounted and the rebuild command being triggered, the /mnt volume on the -instance that was being executed upon at that time will be in an unmounted -state. - -In such a state, pre-flight checks will fail attempting to start MySQL and -RabbitMQ. - - * Error Messages: - - * Pre-flight check returns an error similar to:: - - failed: [192.0.2.24] => {"changed": true, "cmd": - "rabbitmqctl -n rabbit@$(hostname) status" stderr: Error: - unable to connect to node - 'rabbit@overcloud-controller0-vahypr34iy2x': nodedown - - * Attempting to manually start MySQL or RabbitMQ return:: - - start: Job failed to start - - * Upgrade execution returns with an error indicating:: - - TASK: [fail msg="Galera Replication - Node appears to be the - last node in a cluster - cannot safely proceed unless - overriden via single_controller setting - See README.rst"] *** - - * Symptom: - - * Execution of the `df` command does not show a volume mounted as /mnt. - - * Unable to manually start services. - - * Solution: - - * Execute the os-collect config which will re-mount the state drive. This - command may fail without additional intervention, however it should mount - the state drive which is all that is needed to proceed to the next step.:: - - sudo os-collect-config --force --one - - * At this point, the /mnt volume should be visible in the output of the `df` - command. - - * Start MySQL by executing:: - - sudo /etc/init.d/mysqld start - - * If MySQL fails to start, and it has been verified that MySQL is not - running on any controller nodes, then you will need to identify the - *last* node that MySQL was stopped on and consult the section "MySQL - fails to start upon retrying update" for guidance on restarting the - cluster. - - * Start RabbitMQ by executing:: - - service rabbitmq-server start - - * If rabbitmq-server fails to start, then the cluster may be down. If - this is the case, then the *last* node to be stopped will need to be - identified and started before attempting to restart RabbitMQ on this - node. - - * At this point, re-execute the pre-flight check, and proceed with the - upgrade. - -VMs may not shut down properly during upgrade -============================================= - -During the upgrade process, VMs on compute nodes are shut down -gracefully. If the VMs do not shut down, this can cause the upgrade to -stop. - - * Error Messages: - - * A playbook run ends with a message similar to:: - - failed: [10.23.210.31] => {"failed": true} msg: The ephemeral - storage of this system failed to be cleaned up properly and - processes or files are still in use. The previous ansible play - should have information to help troubleshoot this issue. - - * The output of the playbook run prior to this message contains a - process listing and a listing of open files. - - * Symptoms: - - * The state drive on the compute node, /mnt, is still in use and - cannot be unmounted. You can confirm this by executing:: - - lsof -n | grep /mnt - - * VMs are running on the node. To see which VMs are running, run:: - - virsh list - - * If `virsh list` fails, you may need to restart libvirt-bin or - libvirtd depending on which process you are running. Do - so by running:: - - service libvirt-bin restart - or - service libvirtd restart - - * Solution: - - * Manual intervention is required. You will need to determine why - the VMs did not shut down properly, and resolve the issue. - - * Unresponsive VMs can be forcibly shutdown using `virsh destroy - `. Note that this can corrupt filesystems on the VM. - - * Resume the playbook run once the VMs have been shut down. - -Instances are inaccessible via network -====================================== - -Upon restarting, it is possible that the virtual machine is -unreachable due to Open vSwitch not being ready for the virtual machine -networking. - - * Symptom: - - * After a restart, instances won't ping. - - * Solution: - - * To resolve: - - * Log into a controller node and execute `source /root/stackrc` - - * Stop all virtual machines on a compute node utilizing `nova - hypervisor-servers ` and `nova stop ` - - * Log into the undercloud node and execute `source /root/stackrc` - - * Obtain a list of nodes by executing `nova list` - - * Execute `nova stop ` for the affected compute node. - - * Once the compute node has stopped, execute `nova start ` to - reboot the compute node. - -Online Upgrade fails with message saying glanceclient is not found. -=================================================================== - - * Symptoms: - - * Online upgrade has been attempted, however the playbook - execution failed when attempting to download the new image from - Glance reporting that glanceclient was not found. - - * Solution: - - * If you are attempting to execute the Ansible playbook on the seed or - undercloud node, source the Ansible virtual environment by executing - `source /opt/stack/venvs/ansible/bin/activate` - - * Once the Ansible virtual environment has been sourced, execute - `sudo pip install python-glanceclient` on the node you are attempting - to execute Ansible from. - -Online Upgrade of compute node failed -===================================== - -In the event that an online upgrade of a compute node somehow failed, the node -can be recovered utilizing a traditional rebuild. - - * Symptoms: - - * Online upgrade was performed. - - * Compute node cannot be logged into, or is otherwise in a - non-working state. - - * Solution: - - * From the undercloud: - - * Execute `source /root/stackrc` - - * Identify the instance ID of the broken compute node via `nova list` - - * Execute the command `nova stop ` to stop the instance. - - * Return to the host that you ran the upgrade from and re-run the playbook - without the "-e online_upgrade=True" option. - - * Additionally, you may need to utilize the "-e force_rebuild=True" option - to force the instance to rebuild. diff --git a/ansible.cfg b/ansible.cfg deleted file mode 100644 index 09042b9..0000000 --- a/ansible.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[defaults] -timeout = 300 -pipelining = True diff --git a/babel.cfg b/babel.cfg deleted file mode 100644 index efceab8..0000000 --- a/babel.cfg +++ /dev/null @@ -1 +0,0 @@ -[python: **.py] diff --git a/doc/source/conf.py b/doc/source/conf.py deleted file mode 100755 index d008497..0000000 --- a/doc/source/conf.py +++ /dev/null @@ -1,75 +0,0 @@ -# -*- coding: utf-8 -*- -# 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 os -import sys - -sys.path.insert(0, os.path.abspath('../..')) -# -- General configuration ---------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = [ - 'sphinx.ext.autodoc', - #'sphinx.ext.intersphinx', - 'oslosphinx' -] - -# autodoc generation is a bit aggressive and a nuisance when doing heavy -# text edit cycles. -# execute "export SPHINX_DEBUG=1" in your terminal to disable - -# The suffix of source filenames. -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = u'tripleo-ansible' -copyright = u'2013, OpenStack Foundation' - -# If true, '()' will be appended to :func: etc. cross-reference text. -add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -add_module_names = True - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# -- Options for HTML output -------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. Major themes that come with -# Sphinx are currently 'default' and 'sphinxdoc'. -# html_theme_path = ["."] -# html_theme = '_theme' -# html_static_path = ['static'] - -# Output file base name for HTML help builder. -htmlhelp_basename = '%sdoc' % project - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass -# [howto/manual]). -latex_documents = [ - ('index', - '%s.tex' % project, - u'%s Documentation' % project, - u'OpenStack Foundation', 'manual'), -] - -# Example configuration for intersphinx: refer to the Python standard library. -#intersphinx_mapping = {'http://docs.python.org/': None} \ No newline at end of file diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst deleted file mode 100644 index ed77c12..0000000 --- a/doc/source/contributing.rst +++ /dev/null @@ -1,4 +0,0 @@ -============ -Contributing -============ -.. include:: ../../CONTRIBUTING.rst \ No newline at end of file diff --git a/doc/source/index.rst b/doc/source/index.rst deleted file mode 100644 index ed3cb17..0000000 --- a/doc/source/index.rst +++ /dev/null @@ -1,24 +0,0 @@ -.. tripleo-ansible documentation master file, created by - sphinx-quickstart on Tue Jul 9 22:26:36 2013. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to tripleo-ansible's documentation! -======================================================== - -Contents: - -.. toctree:: - :maxdepth: 2 - - readme - installation - usage - contributing - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` diff --git a/doc/source/installation.rst b/doc/source/installation.rst deleted file mode 100644 index 45ff771..0000000 --- a/doc/source/installation.rst +++ /dev/null @@ -1,12 +0,0 @@ -============ -Installation -============ - -At the command line:: - - $ pip install tripleo-ansible - -Or, if you have virtualenvwrapper installed:: - - $ mkvirtualenv tripleo-ansible - $ pip install tripleo-ansible \ No newline at end of file diff --git a/doc/source/readme.rst b/doc/source/readme.rst deleted file mode 100644 index 38ba804..0000000 --- a/doc/source/readme.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../../README.rst \ No newline at end of file diff --git a/doc/source/usage.rst b/doc/source/usage.rst deleted file mode 100644 index b27c123..0000000 --- a/doc/source/usage.rst +++ /dev/null @@ -1,7 +0,0 @@ -======== -Usage -======== - -To use tripleo-ansible in a project:: - - import tripleo_ansible \ No newline at end of file diff --git a/elements/tripleo-ansible/README.md b/elements/tripleo-ansible/README.md deleted file mode 100644 index 935745e..0000000 --- a/elements/tripleo-ansible/README.md +++ /dev/null @@ -1,6 +0,0 @@ -Install tripleo-ansible repository - -Configuration -------------- - -At present, there is no configuration for this element. diff --git a/elements/tripleo-ansible/element-deps b/elements/tripleo-ansible/element-deps deleted file mode 100644 index 51ee83d..0000000 --- a/elements/tripleo-ansible/element-deps +++ /dev/null @@ -1,2 +0,0 @@ -source-repositories -ansible diff --git a/elements/tripleo-ansible/install.d/tripleo-ansible-source-install/31-tripleo-ansible b/elements/tripleo-ansible/install.d/tripleo-ansible-source-install/31-tripleo-ansible deleted file mode 100755 index 57cffe7..0000000 --- a/elements/tripleo-ansible/install.d/tripleo-ansible-source-install/31-tripleo-ansible +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# -# Copyright 2014 Hewlett-Packard Development Company, L.P. -# 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. -# - -set -eux -set -o pipefail - -VENV=/opt/stack/venvs/ansible - -set +u -source $VENV/bin/activate -set -u - -$VENV/bin/pip install -r /opt/stack/tripleo-ansible/requirements.txt diff --git a/elements/tripleo-ansible/source-repository-tripleo-ansible b/elements/tripleo-ansible/source-repository-tripleo-ansible deleted file mode 100644 index c4ab90c..0000000 --- a/elements/tripleo-ansible/source-repository-tripleo-ansible +++ /dev/null @@ -1 +0,0 @@ -tripleo-ansible git /opt/stack/tripleo-ansible https://github.com/SpamapS/tripleo-ansible.git diff --git a/examples/playbooks/auth_vars.yml.ex b/examples/playbooks/auth_vars.yml.ex deleted file mode 100644 index 8e31008..0000000 --- a/examples/playbooks/auth_vars.yml.ex +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. --- -os_username: admin -os_password: admin -os_tenant_name: admin -os_region_name: region.x -os_auth_url: http://127.0.0.1:35357/v2.0/ diff --git a/examples/playbooks/simple_rebuild.yml b/examples/playbooks/simple_rebuild.yml deleted file mode 100644 index b9f9120..0000000 --- a/examples/playbooks/simple_rebuild.yml +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -- name: rebuild a nova instance - hosts: localhost - tasks: - - name: rebuild an instance - nova_rebuild: - region_name: regionOne - login_username: admin - login_password: setpassword - login_tenant_name: admin - auth_url: http://192.0.2.3:5000/v2.0 - name: overcloud-NovaCompute-setvmname - image_id: 6663f30c-fff8-4c67-b0a9-fc72193b9eea - preserve_ephemeral: yes - wait_for: 200 diff --git a/examples/simple_iterative_applier/README.rst b/examples/simple_iterative_applier/README.rst deleted file mode 100644 index 71328b1..0000000 --- a/examples/simple_iterative_applier/README.rst +++ /dev/null @@ -1,53 +0,0 @@ -A simple iterator for running a playbook. -========================================= - -Getting Started ---------------- - -You will need: - - * Stack environment variables loaded. - - Example: source $TRIPLEO_ROOT/tripleo-incubator/undercloudrc - - * An Ansible Inventory file defining localhost which makes use of a local connection. This file is passed in as the -i option to the included script. You can view such a file at ../hosts_local. - - Example Content: "localhost ansible_connection=local" - - More information can be found at http://docs.ansible.com/intro_inventory.html - - * A file containing a list of instances you wish to run the playbook against. - - Example: instances.txt - - * A configuration file named update_config.cfg in the folder where your executing the script from. This file has sections that are based upon a portion of the instance name, such as "controller" and "NovaCompute". With-in each section is a "image_id" option which is where you would place the new image ID to rebuild the instance with. Image IDs can be obtained via `glance image-list` once you have the appropriate environment variables loaded. - - Example: update_config.cfg - - * A playbook, expecting expecting the following - - * image_id - glance image id. - * name - instance name - - * A slightly modified copy of the simeple_rebuild.yml example playbook exists as main.yml - -Putting it all together ------------------------ - - source $TRIPLEO_ROOT/tripleo-incubator/undercloudrc - - python ./simple_update.py -p ./main.yml -l instances.txt -i ../hosts_local - -A Few notes ------------ - -1) The variables defined in main.yml before the tasks level are presently - redundant, as the underlying nova_rebuild module supports retrieval of the - configuration from environment variables, although they could be useful for - modules that do not presently support such functionality, or modules that - need to execute remotely. - -2) If an inventory is populated of each machine into ansible, then it would - be easy to modify the playbook to connect out and perform actions on each - instance, such as backup a database, fetch files, replace files, etc. - diff --git a/examples/simple_iterative_applier/instances.txt b/examples/simple_iterative_applier/instances.txt deleted file mode 100644 index 40b2798..0000000 --- a/examples/simple_iterative_applier/instances.txt +++ /dev/null @@ -1,4 +0,0 @@ -overcloud-NovaCompute0-sbepht5ngm5v -overcloud-NovaCompute1-7d2o5lpz32yt -overcloud-NovaCompute2-wssjjvfecxwk -overcloud-controller0-blhq6zj26lhh diff --git a/examples/simple_iterative_applier/main.yml b/examples/simple_iterative_applier/main.yml deleted file mode 100644 index b7bd9d6..0000000 --- a/examples/simple_iterative_applier/main.yml +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -- name: rebuild an instance - hosts: localhost - vars: - os_username: "{{ lookup('env','OS_USERNAME') }}" - os_tenant_name: "{{ lookup('env','OS_TENANT_NAME') }}" - os_password: "{{ lookup('env','OS_PASSWORD') }}" - os_auth_url: "{{ lookup('env','OS_AUTH_URL') }}" - tasks: - - name: rebuild an instance - nova_rebuild: - region_name: regionOne - login_username: "{{ os_username }}" - login_password: "{{ os_password }}" - login_tenant_name: "{{ os_tenant_name}}" - auth_url: "{{ os_auth_url }}" - name: "{{ name }}" - image_id: "{{ image_id }}" - preserve_ephemeral: yes - wait_for: 300 diff --git a/examples/simple_iterative_applier/simple_update.py b/examples/simple_iterative_applier/simple_update.py deleted file mode 100644 index 291d335..0000000 --- a/examples/simple_iterative_applier/simple_update.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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 argparse -import ConfigParser -import subprocess - -parser = argparse.ArgumentParser(description='Exmaple iterative updater') -parser.add_argument('-p', dest='playbook', help='main.yml', required=True) -parser.add_argument( - '-l', - dest='instances', - help='instances.txt', - required=True -) -parser.add_argument( - '-i', - dest='inventory', - help='inventory.ini', - required=True -) -parser.add_argument( - '-c', - dest='configfile', - help='update_config.cfg', - required=False, - default='update_config.cfg' -) - -results = parser.parse_args() -config = ConfigParser.RawConfigParser() -config.read(results.configfile) - -with open(results.instances) as list: - for host in list: - for section in config.sections(): - if section in host: - hostname = host.strip('\n') - image_id = config.get(section, 'image_id') - args = ( - 'ansible-playbook', - results.playbook, - '-e', - "name=%s image_id=%s" % (hostname, image_id), - '-i', - results.inventory - ) - print('Executing:\n') - print(args) - subprocess.call(args) diff --git a/examples/simple_iterative_applier/update_config.cfg b/examples/simple_iterative_applier/update_config.cfg deleted file mode 100644 index 33d8440..0000000 --- a/examples/simple_iterative_applier/update_config.cfg +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. - -# Each server name "class" should be a section with an underlying -# image_id property that contains the Glance Image ID to be utilized. -# You can obtain a list of loaded image ids utilizing the -# `glance image-list` command. - -[controller] -image_id=7732e7ca-52fa-4acf-beeb-9cfd82e0e3df - -[NovaCompute] -image_id=0e09dcac-b4de-42c4-b7ad-d86a33c49ae0 - diff --git a/library/cloud/nova_facts b/library/cloud/nova_facts deleted file mode 100644 index d6ea1d3..0000000 --- a/library/cloud/nova_facts +++ /dev/null @@ -1,185 +0,0 @@ -#!/usr/bin/env python -# This code is part of Ansible, but is an independent component. -# This particular file snippet, and this file snippet only, is BSD licensed. -# Modules you write using this snippet, which is embedded dynamically by Ansible -# still belong to the author of the module, and may assign their own license -# to the complete work. -# -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import os - -try: - from novaclient.v1_1 import client as nova_client - from novaclient import exceptions - import time -except ImportError: - print("failed=True msg='novaclient is required for this module'") - -DOCUMENTATION = ''' ---- -module: nova_facts -short_description: Return facts from Nova -description: - - Returns instance state and metadata from Openstack Nova. -options: - login_username: - description: - - login username to authenticate to keystone - required: true - default: admin - login_password: - description: - - Password of login user - required: true - default: 'yes' - login_tenant_name: - description: - - The tenant name of the login user - required: true - default: 'yes' - auth_url: - description: - - The keystone url for authentication - required: false - default: 'http://127.0.0.1:35357/v2.0/' - region_name: - description: - - Name of the region - required: false - default: None - name: - description: - - Name of the instance for which facts will be retrieved. - default: None - instance_id: - description: - - Instance ID of the instance for which facts will be retrieved. - default: None -requirements: ["novaclient"] -''' - -EXAMPLES = ''' -# Rebuilds an existing VM with a new image -- nova_facts: - login_username: admin - login_password: admin - login_tenant_name: admin - name: vm1 - image_id: 4f905f38-e52a-43d2-b6ec-754a13ffb529 -''' - - -# The following openstack_ is a copy paste from an upcoming -# core module "lib/ansible/module_utils/openstack.py" Once that's landed, -# these should be replaced with a line at the bottom of the file: -# from ansible.module_utils.openstack import * -def openstack_argument_spec(): - # Consume standard OpenStack environment variables. - # This is mainly only useful for ad-hoc command line operation as - # in playbooks one would assume variables would be used appropriately - OS_AUTH_URL = os.environ.get('OS_AUTH_URL', 'http://127.0.0.1:35357/v2.0/') - OS_PASSWORD = os.environ.get('OS_PASSWORD', None) - OS_REGION_NAME = os.environ.get('OS_REGION_NAME', None) - OS_USERNAME = os.environ.get('OS_USERNAME', 'admin') - OS_TENANT_NAME = os.environ.get('OS_TENANT_NAME', OS_USERNAME) - - spec = dict( - login_username=dict(default=OS_USERNAME), - auth_url=dict(default=OS_AUTH_URL), - region_name=dict(default=OS_REGION_NAME), - availability_zone=dict(default=None), - ) - if OS_PASSWORD: - spec['login_password'] = dict(default=OS_PASSWORD) - else: - spec['login_password'] = dict(required=True) - if OS_TENANT_NAME: - spec['login_tenant_name'] = dict(default=OS_TENANT_NAME) - else: - spec['login_tenant_name'] = dict(required=True) - return spec - - -def _nova_facts(module, nova): - server = None - try: - if module.params.get('instance_id') is None: - servers = nova.servers.list(True, {'name': module.params['name']}) - if servers: - # the {'name': module.params['name']} will also return servers - # with names that partially match the server name, so we have to - # strictly filter here - servers = [ - x for x in servers if x.name == module.params['name'] - ] - if servers: - server = servers[0] - else: - server = nova.servers.get(module.params['instance_id']) - except Exception, e: - module.fail_json( - msg="Error in getting the server list: %s" % e.message - ) - if not server: - module.exit_json(changed=False, result="not present") - - try: - server = nova.servers.get(server.id) - except Exception, e: - module.fail_json(msg="not present") - - facts = {'ansible_facts': {}} - facts['ansible_facts']['instance_status'] = server.status - facts['ansible_facts']['instance_metadata'] = server.metadata - - module.exit_json(**facts) - - -def main(): - argument_spec = openstack_argument_spec() - argument_spec.update(dict( - name=dict(), - instance_id=dict(), - )) - module = AnsibleModule(argument_spec=argument_spec) - - nova = nova_client.Client(module.params['login_username'], - module.params['login_password'], - module.params['login_tenant_name'], - module.params['auth_url'], - region_name=module.params['region_name'], - service_type='compute') - try: - nova.authenticate() - except exceptions.Unauthorized, e: - module.fail_json( - msg="Invalid OpenStack Nova credentials.: %s" % e.message - ) - except exceptions.AuthorizationFailure, e: - module.fail_json(msg="Unable to authorize user: %s" % e.message) - - _nova_facts(module, nova) -# this is magic, see lib/ansible/module_common.py -from ansible.module_utils.basic import * -main() diff --git a/openstack-common.conf b/openstack-common.conf deleted file mode 100644 index 92a7585..0000000 --- a/openstack-common.conf +++ /dev/null @@ -1,6 +0,0 @@ -[DEFAULT] - -# The list of modules to copy from oslo-incubator.git - -# The base module to hold the copy of openstack.common -base=tripleo_ansible \ No newline at end of file diff --git a/playbooks/activate_cinder_volumes.yml b/playbooks/activate_cinder_volumes.yml deleted file mode 100644 index 5b0b8eb..0000000 --- a/playbooks/activate_cinder_volumes.yml +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -- name: Check if using lvm based storage - stat: path=/mnt/state/var/lib/cinder/cinder-volumes-backing-file - register: lvm_backing_file -- name: Re-create cinder loopdevice - command: losetup -f /mnt/state/var/lib/cinder/cinder-volumes-backing-file - when: lvm_backing_file.stat.exists - sudo: yes -- pause: seconds=5 - when: lvm_backing_file.stat.exists -- name: Re-scan for volume groups - command: pvscan - when: lvm_backing_file.stat.exists - sudo: yes -- pause: seconds=5 -- name: Re-enable volume groups - command: vgchange -a y - when: lvm_backing_file.stat.exists - sudo: yes -- pause: seconds=5 - when: lvm_backing_file.stat.exists -- name: Get all cinder lvm volumes - shell: "lvdisplay | grep cinder-volumes | grep 'LV Path' | awk '{print $3}'" - when: lvm_backing_file.stat.exists - register: cinder_volumes - sudo: yes -- name: Activate cinder lvm volumes - shell: lvchange -a y {{ item }} - with_items: cinder_volumes.stdout_lines - when: lvm_backing_file.stat.exists - sudo: yes diff --git a/playbooks/all_disable_os_collect_config.yml b/playbooks/all_disable_os_collect_config.yml deleted file mode 100644 index b405ffe..0000000 --- a/playbooks/all_disable_os_collect_config.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -- hosts: all - tasks: - - include: disable_os_collect_config.yml diff --git a/playbooks/all_refresh_config.yml b/playbooks/all_refresh_config.yml deleted file mode 100644 index bf5d9a6..0000000 --- a/playbooks/all_refresh_config.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -- hosts: all - tasks: - - include: refresh_config.yml diff --git a/playbooks/cleanup_cinder_volumes.yml b/playbooks/cleanup_cinder_volumes.yml deleted file mode 100644 index 92bc735..0000000 --- a/playbooks/cleanup_cinder_volumes.yml +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Remove any cinder volume mounts that may be present" - sudo: yes - script: files/cleanup_cinder_devices.sh - register: test_cinder_cleanup - ignore_errors: yes -- name: "If cinder cleanup failed, collect volume group data" - command: vgdisplay -v - when: instance_status == "ACTIVE" and test_cinder_cleanup.rc != 0 -- include: step_fail_unmount.yml - when: instance_status == "ACTIVE" and test_cinder_cleanup.rc != 0 -- name: "Detach any loop devices in use" - sudo: yes - script: files/cleanup_loop_devices.sh - register: test_loop_device_cleanup -- name: "Collect list of loop devices" - sudo: yes - command: losetup -a - ignore_errors: yes - when: test_loop_device_cleanup.rc != 0 -- include: step_fail_unmount.yml - when: instance_status == "ACTIVE" and test_loop_device_cleanup.rc != 0 diff --git a/playbooks/cleanup_rabbitmq_start.yml b/playbooks/cleanup_rabbitmq_start.yml deleted file mode 100644 index c075f69..0000000 --- a/playbooks/cleanup_rabbitmq_start.yml +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: Determine if node is part of a cluster - shell: grep -q "$(hostname)" "/mnt/state/var/lib/rabbitmq/mnesia/rabbit@$(hostname)/cluster_nodes.config" - ignore_errors: yes - register: rabbit_cluster_test -- name: Collect names of post-configure.d rabbitmq files - shell: ls "{{os_refresh_config_folder}}/post-configure.d/"|grep '\-rabbitmq$' - register: test_rabbitmq_script_list - when: single_controller is not defined and rabbit_cluster_test.rc == 0 -- name: If node rabbitmq cluster config was present, re-enable os-refresh-config post-configure.d. - sudo: yes - file: mode=0755 path="{{os_refresh_config_folder}}/post-configure.d/{{item}}" - when: single_controller is not defined and rabbit_cluster_test.rc == 0 - with_items: test_rabbitmq_script_list.stdout_lines -- name: "Removing temporary rabbitmq-server override" - sudo: yes - file: path=/etc/init/rabbitmq-server.override state=absent diff --git a/playbooks/disable_os_collect_config.yml b/playbooks/disable_os_collect_config.yml deleted file mode 100644 index e9b4e4a..0000000 --- a/playbooks/disable_os_collect_config.yml +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -# Stop and disable os-collect-config -# -# Run from the tripleo-ansible directory: -# -- name: "Disable os-collect-config service" - sudo: yes - service: name=os-collect-config enabled=no state=stopped -- name: "Remove file that allows os-collect-config start via upstart" - shell: os-svc-enable-upstart os-collect-config disable - sudo: yes -- name: "Ensure os-collect-config local-data folder is present" - sudo: yes - file: path=/var/lib/os-collect-config/local-data state=directory owner=root group=root mode=0700 - when: online_upgrade is defined -- name: "Reconfigure os-collect-config for local collector" - sudo: yes - copy: - src: files/os-collect-config.conf - dest: /etc/os-collect-config.conf -- name: "Install os-collect-config disable sentinel file" - sudo: yes - file: path=/mnt/state/disable-os-collect-config owner=root group=root mode=644 state=touch diff --git a/playbooks/enable_start_os_collect_config.yml b/playbooks/enable_start_os_collect_config.yml deleted file mode 100644 index 664bbd7..0000000 --- a/playbooks/enable_start_os_collect_config.yml +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Create file that allows os-collect-config start via upstart" - shell: os-svc-enable-upstart os-collect-config enable - sudo: yes -- name: "Enable os-collect-config via upstart and start the service" - service: name=os-collect-config state=started - sudo: yes diff --git a/playbooks/files/cleanup_cinder_devices.sh b/playbooks/files/cleanup_cinder_devices.sh deleted file mode 100644 index 65476d1..0000000 --- a/playbooks/files/cleanup_cinder_devices.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -eux - -for CINDER_VOLUME in `lvdisplay | grep cinder-volumes | grep 'LV Path' | awk '{print $3}'`; do - lvchange -a n $CINDER_VOLUME -done -vgchange -a n \ No newline at end of file diff --git a/playbooks/files/cleanup_loop_devices.sh b/playbooks/files/cleanup_loop_devices.sh deleted file mode 100644 index e8913fe..0000000 --- a/playbooks/files/cleanup_loop_devices.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -set -eux - -for loopdevice in `losetup -a| cut -d ':' -f 1`; do - losetup --detach $loopdevice -done diff --git a/playbooks/files/correct_mnt_state_permissions.py b/playbooks/files/correct_mnt_state_permissions.py deleted file mode 100755 index eb67a7c..0000000 --- a/playbooks/files/correct_mnt_state_permissions.py +++ /dev/null @@ -1,176 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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 grp -import optparse -import os -import pwd -import stat - - -def get_object_ids(file): - stat_information = os.stat(file) - return(stat_information.st_uid, stat_information.st_gid) - - -def get_username_from_uid(old_uid, old_password_file): - file = open(old_password_file) - passwd_file = file.readlines() - for user_entry in passwd_file: - ( - user, - passwd, - uid, - gid, - gecos, - home, - shell - ) = user_entry.split(':') - if old_uid == int(uid): - return user - return "ErrUserNotFound" - - -def get_groupname_from_gid(old_gid, old_group_file): - file = open(old_group_file) - group_file = file.readlines() - for group_entry in group_file: - ( - group, - passwd, - gid, - members - ) = group_entry.split(':') - if old_gid == int(gid): - return group - return "ErrUserNotFound" - - -def get_new_uid(username): - return pwd.getpwnam(username).pw_uid - - -def get_new_gid(groupname): - return grp.getgrnam(groupname).gr_gid - - -def run_check(object, old_password_file, old_group_file): - (old_uid, old_gid) = get_object_ids(object) - old_username = get_username_from_uid(old_uid, old_password_file) - old_groupname = get_groupname_from_gid(old_uid, old_group_file) - try: - new_uid = get_new_uid(old_username) - new_gid = get_new_gid(old_groupname) - if old_uid != new_uid: - if old_username in object: - return(True, old_username, new_uid, old_groupname, new_gid) - return(False, old_username, new_uid, old_groupname, old_gid) - except: - return(False, old_username, -1, old_groupname, -1) - - -def recursive_update(directory, new_uid, new_gid): - os.chown(directory, new_uid, new_gid) - for root, dirs, files in os.walk(directory): - for dir in dirs: - os.chown(os.path.join(root, dir), new_uid, new_gid) - for file in files: - os.chown(os.path.join(root, file), new_uid, new_gid) - - -def main(): - usage = "Usage: %prog -f old_password_file -d directory_to_update" - parser = optparse.OptionParser(usage) - parser.add_option( - "-f", - action="store", - default=False, - dest="old_password_file", - help="Path to previous system password file" - ) - parser.add_option( - "-g", - action="store", - default=False, - dest="old_group_file", - help="Path to previous system password file" - ) - parser.add_option( - "-d", - action="store", - default=False, - dest="directory", - help="Directory to check and apply permission updates to" - ) - (options, args) = parser.parse_args() - - if not options.directory: - print("Error: please define a directory to run the program with -d") - parser.print_help() - return -1 - - if not options.old_password_file: - print("Error: please define a directory to run the program with -d") - parser.print_help() - return -1 - - if not options.old_group_file: - print("Error: please define a directory to run the program with -d") - parser.print_help() - return -1 - - - for object in os.listdir(options.directory): - if os.path.isdir(os.path.join(options.directory, object)): - (changed, old_user, new_uid, old_groupname, new_gid) = run_check( - os.path.join(options.directory, object), - options.old_password_file, - options.old_group_file - ) - if changed: - print("Updating %s/%s for ownership to uid %s for %s" % ( - options.directory, - object, - new_uid, - old_user - ) - ) - try: - recursive_update( - os.path.join(options.directory, object), - new_uid, - new_gid - ) - except: - print("Failed to update ownership of %s/%s " % ( - options.directory, - object - ) - ) - else: - print("ignoring %s/%s" % ( - options.directory, - object - ) - ) - else: - print("Ignoring %s/%s as it is not a directory" % ( - options.directory, - object - ) - ) - -main() diff --git a/playbooks/files/create-databases.sh b/playbooks/files/create-databases.sh deleted file mode 100644 index 2a251a6..0000000 --- a/playbooks/files/create-databases.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -set -eux -set -o pipefail - -PATH=/usr/local/bin/:$PATH -# Execute database creation step although suppress output -# that may contain passwords. -sed -i 's/| mysql$/| mysql --defaults-file=\/mnt\/state\/root\/metadata.my.cnf/' /usr/local/bin/os-db-create -reset-db -c 2>&1 |grep -v "db_pass" |grep -v "os-db-create" -reset-db -m 2>&1 |grep -v "db_pass" |grep -v "os-db-create" diff --git a/playbooks/files/explode-deployments.py b/playbooks/files/explode-deployments.py deleted file mode 100644 index 31d3ac5..0000000 --- a/playbooks/files/explode-deployments.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/python - -import argparse -import json -import os - -parser = argparse.ArgumentParser() -parser.add_argument('path', default='/var/lib/os-collect-config/local-data') -parser.add_argument('--deployments-key', default='deployments') - -args = parser.parse_args() - -for fname in os.listdir(args.path): - f = os.path.join(args.path, fname) - with open(f) as infile: - x = json.loads(infile.read()) - dp = args.deployments_key - final_list = [] - if dp in x: - if isinstance(x[dp], list): - for d in x[dp]: - name = d['name'] - if d.get('group', 'Heat::Ungrouped') in ('os-apply-config', 'Heat::Ungrouped'): - final_list.append((name, d['config'])) - for oname, oconfig in final_list: - with open('%s%s' % (f, oname), 'w') as outfile: - outfile.write(json.dumps(oconfig)) diff --git a/playbooks/files/os-collect-config.conf b/playbooks/files/os-collect-config.conf deleted file mode 100644 index 09ebbe3..0000000 --- a/playbooks/files/os-collect-config.conf +++ /dev/null @@ -1,4 +0,0 @@ -[DEFAULT] -collectors = ec2 -collectors = local -command = os-refresh-config diff --git a/playbooks/files/patch-ssh-client-config.sh b/playbooks/files/patch-ssh-client-config.sh deleted file mode 100644 index 2dfe0b1..0000000 --- a/playbooks/files/patch-ssh-client-config.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -set -eux -set -o pipefail - -# This turns on an internal heartbeat mechanism in the ssh client -# to prevent the client from believing inactivity is a connection -# failure. -if ! grep -q '^\s*ServerAliveInterval' /etc/ssh/ssh_config; then - echo " ServerAliveInterval 30" >>/etc/ssh/ssh_config -fi - -# This causes the connection to wait until the defined number of -# heartbeats are missed before terminating the connection. -if ! grep -q '^\s*ServerAliveCountMax' /etc/ssh/ssh_config; then - echo " ServerAliveCountMax 6" >>/etc/ssh/ssh_config -fi - diff --git a/playbooks/files/rabbitmq-server.override b/playbooks/files/rabbitmq-server.override deleted file mode 100644 index 7f2cc26..0000000 --- a/playbooks/files/rabbitmq-server.override +++ /dev/null @@ -1 +0,0 @@ -post-start exec /bin/true diff --git a/playbooks/files/wait_for_database-helion.sh b/playbooks/files/wait_for_database-helion.sh deleted file mode 100644 index 6c2172c..0000000 --- a/playbooks/files/wait_for_database-helion.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -set -eux -set -o pipefail - -# Get and return the wsrep_local_state. -function get_state() { - mysql --defaults-file=/mnt/state/root/metadata.my.cnf --socket /var/run/mysqld/mysqld.sock -N -e "SHOW STATUS LIKE 'wsrep_local_state'"|cut -f2 -} - -# Loop until timed out, exit if wsrep_local_state equals Synced "4" -function wait_for_wsrep_synced() { - COUNT=0 - while true; - do - if [ "4" -eq $(get_state) ]; then - echo "Local wsrep_local_state has reached Synced, breaking out of loop." - break - fi - echo ".... Sleeping 30 seconds" - sleep 30 - COUNT=$((COUNT + 1)) - if [ $COUNT -gt 61 ]; then - echo "Aborting, exiting 1, waited for a 30 minutes. You can re-attempt this setup using ansible-playbook options --start-at-task or --step." - fi - done -} - -if ! which mysql &>/dev/null; then - echo "Failure - MySQL CLI not found" - exit 1 -fi - -echo "Beginning MySQL wait - Time: $(date)" - wait_for_wsrep_synced -echo "Exiting MySQL wait - Time: $(date)" diff --git a/playbooks/galera_status.yml b/playbooks/galera_status.yml deleted file mode 100644 index c83a45e..0000000 --- a/playbooks/galera_status.yml +++ /dev/null @@ -1,38 +0,0 @@ -- name: Rename MySQL upstart script - sudo: yes - command: mv -f /etc/init/mysql.conf /etc/init/mysql-boot-control.conf removes=/etc/init/mysql.conf -- service: name=mysql state=started - ignore_errors: yes -- name: Fetch Galera sync status from MySQL - sudo: yes - command: mysql --defaults-file=/mnt/state/root/metadata.my.cnf --socket /var/run/mysqld/mysqld.sock -N -e "SHOW STATUS LIKE 'wsrep_local_state'" - when: helion is not defined - register: wsrep_local_state -- set_fact: galera_status="Synced" - when: helion is not defined and wsrep_local_state.stdout == "wsrep_local_state\t4" -- set_fact: galera_status="Out of Sync" - when: helion is not defined and wsrep_local_state.stdout != "wsrep_local_state\t4" -- name: Fetch Galera cluster size from MySQL - sudo: yes - shell: mysql --defaults-file=/mnt/state/root/metadata.my.cnf --socket /var/run/mysqld/mysqld.sock -N -e "SHOW STATUS LIKE 'wsrep_cluster_size'"|cut -f2 - when: helion is not defined - register: wsrep_cluster_size -- set_fact: galera_cluster_size="{{wsrep_cluster_size.stdout}}" - when: helion is not defined -- name: Fetch Galera sync status from MySQL - Helion - sudo: yes - command: mysql --defaults-file=/mnt/state/root/metadata.my.cnf -N -e "SHOW STATUS LIKE 'wsrep_local_state'" - when: helion is defined - register: wsrep_local_state -- set_fact: galera_status="Synced" - when: helion is defined and wsrep_local_state.stdout == "wsrep_local_state\t4" -- set_fact: galera_status="Out of Sync" - when: helion is defined and wsrep_local_state.stdout != "wsrep_local_state\t4" -- name: Fetch Galera cluster size from MySQL - Helion - sudo: yes - shell: mysql --defaults-file=/mnt/state/root/metadata.my.cnf -N -e "SHOW STATUS LIKE 'wsrep_cluster_size'"|cut -f2 - when: helion is defined - register: wsrep_cluster_size -- set_fact: galera_cluster_size="{{wsrep_cluster_size.stdout}}" - when: helion is defined - diff --git a/playbooks/library/glance_download b/playbooks/library/glance_download deleted file mode 100644 index a27b0c2..0000000 --- a/playbooks/library/glance_download +++ /dev/null @@ -1,245 +0,0 @@ -#!/usr/bin/env python -# This code is part of Ansible, but is an independent component. -# This particular file snippet, and this file snippet only, is BSD licensed. -# Modules you write using this snippet, which is embedded dynamically by Ansible -# still belong to the author of the module, and may assign their own license -# to the complete work. -# -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -try: - import glanceclient.v2.client as glanceclient -except ImportError: - print("failed=True msg='module glanceclient is required for this module'") -try: - from keystoneclient.v3 import client as ksclient -except ImportError: - print( - "failed=True msg='module keystoneclient is required for this module'" - ) - -import hashlib -import os - -try: - from novaclient.v1_1 import client as nova_client - from novaclient import exceptions -except ImportError: - print("failed=True msg='module novaclient is required for this module'") - -import time - - -DOCUMENTATION = ''' ---- -module: glance_download -short_description: Download file from Glance -description: - - Return the requested file from Glance to a location defined by the user. -options: - login_username: - description: - - login username to authenticate to keystone - required: true - default: admin - login_password: - description: - - Password of login user - required: true - default: 'yes' - login_tenant_name: - description: - - The tenant name of the login user - required: true - default: 'yes' - auth_url: - description: - - The keystone url for authentication - required: false - default: 'http://127.0.0.1:35357/v2.0/' - region_name: - description: - - Name of the region - required: false - default: None - image_id: - description: - - Glance file ID that you wish to download. - required: true - default: None - path: - description: - - Location where to save the file from Glance to - required: true - default: None -requirements: ["glanceclient"] -''' - -EXAMPLES = ''' -# Downloads a glance image to the defined path -- glance_download: - login_username: admin - login_password: admin - login_tenant_name: admin - image_id: 4f905f38-e52a-43d2-b6ec-754a13ffb529 - path: /tmp/4f905f38-e52a-43d2-b6ec-754a13ffb529.qcow2 -''' - - -# The following openstack_ is a copy paste from an upcoming -# core module "lib/ansible/module_utils/openstack.py" Once that's landed, -# these should be replaced with a line at the bottom of the file: -# from ansible.module_utils.openstack import * -def openstack_argument_spec(): - # Consume standard OpenStack environment variables. - # This is mainly only useful for ad-hoc command line operation as - # in playbooks one would assume variables would be used appropriately - OS_AUTH_URL = os.environ.get('OS_AUTH_URL', 'http://127.0.0.1:35357/v2.0/') - OS_PASSWORD = os.environ.get('OS_PASSWORD', None) - OS_REGION_NAME = os.environ.get('OS_REGION_NAME', None) - OS_USERNAME = os.environ.get('OS_USERNAME', 'admin') - OS_TENANT_NAME = os.environ.get('OS_TENANT_NAME', OS_USERNAME) - - spec = dict( - login_username=dict(default=OS_USERNAME), - auth_url=dict(default=OS_AUTH_URL), - region_name=dict(default=OS_REGION_NAME), - availability_zone=dict(default=None), - ) - if OS_PASSWORD: - spec['login_password'] = dict(default=OS_PASSWORD) - else: - spec['login_password'] = dict(required=True) - if OS_TENANT_NAME: - spec['login_tenant_name'] = dict(default=OS_TENANT_NAME) - else: - spec['login_tenant_name'] = dict(required=True) - return spec - - -def _glance_get_image_checksum(glance, image_id): - return glance.images.get(image_id).checksum - - -def _md5sum_file(path): - try: - with open(path) as file_object: - checksum = hashlib.md5() - while True: - data = file_object.read(65535) - if not data: - break - checksum.update(data) - return checksum.hexdigest() - except Excption, e: - print("Checksum operaction failed: %s" % e.message) - - -def _glance_download(module, glance, image_id, path): - image_checksum = _glance_get_image_checksum(glance, image_id) - if os.path.isfile(path): - file_checksum = _md5sum_file(path) - if image_checksum == file_checksum: - module.exit_json( - ansible_facts={ - 'returned_checksum': file_checksum - } - ) - try: - file_data = glance.images.data(image_id) - glanceclient.utils.save_image(file_data, path) - except: - module.fail_json( - msg="Retrieval of image from Glance failed." - ) - file_checksum = _md5sum_file(path) - if image_checksum == file_checksum: - module.exit_json( - ansible_facts={ - 'returned_checksum': file_checksum - } - ) - else: - module.fail_json( - msg="Glance checksum %s != %s checksum %s" % ( - image_checksum, - path, - file_checksum - ) - ) - - -def main(): - argument_spec = openstack_argument_spec() - argument_spec.update(dict( - image_id=dict(required=True), - path=dict(required=True) - )) - module = AnsibleModule(argument_spec=argument_spec) - try: - if '/v2.0' in module.params['auth_url']: - module.params['auth_url'] = module.params['auth_url'].replace( - '/v2.0', - '/v3' - ) - keystone = ksclient.Client( - username=module.params['login_username'], - password=module.params['login_password'], - tenant=module.params['login_tenant_name'], - auth_url=module.params['auth_url'], - region_name=module.params['region_name'] - ) - keystone.authenticate() - except: - module.fail_json( - msg="Failed to Authenticate to Keystone" - ) - try: - glance_endpoint = keystone.service_catalog.url_for( - service_type='image', - endpoint_type='publicURL' - ) - except: - module.fail_json( - msg="Failed to retrieve image server URL" - ) - try: - glance = glanceclient.Client( - endpoint=glance_endpoint, - token=keystone.auth_token - ) - except: - module.fail_json( - msg="Failed to connect to Glance" - ) - - _glance_download( - module, - glance, - module.params['image_id'], - module.params['path'] - ) - - -from ansible.module_utils.basic import * -main() diff --git a/playbooks/library/nova_powercontrol b/playbooks/library/nova_powercontrol deleted file mode 100644 index e38fa2a..0000000 --- a/playbooks/library/nova_powercontrol +++ /dev/null @@ -1,350 +0,0 @@ -#!/usr/bin/env python - -# This code is part of Ansible, but is an independent component. This -# particular file snippet, and this file snippet only, is BSD -# licensed. Modules you write using this snippet, which is embedded -# dynamically by Ansible still belong to the author of the module, and -# may assign their own license to the complete work. -# -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - -import os - -try: - from novaclient.v1_1 import client as nova_client - from novaclient import exceptions - import time -except ImportError: - print("failed=True msg='novaclient is required for this module'") - -DOCUMENTATION = ''' ---- -module: nova_powercontrol -short_description: Stops/Starts virtual machines via nova. -description: - - Controls the power state of virtual machines via nova. -options: - login_username: - description: - - login username to authenticate to keystone - required: true - default: admin - login_password: - description: - - Password of login user - required: true - default: 'yes' - login_tenant_name: - description: - - The tenant name of the login user - required: true - default: 'yes' - auth_url: - description: - - The keystone url for authentication - required: false - default: 'http://127.0.0.1:35357/v2.0/' - region_name: - description: - - Name of the region - required: false - default: None - state: - description: - - The desired state for the instance to be set to. - required: true - default: None - instance_id: - description: - - Instance ID of a single instance to control. - default: None - hypervisor: - description: - - Hypervisor ID of the instances to control. - default: None - zone: - description: - - zone name of the instances to control. - default: None - all_instances: - description: - - Any value to affirm decision to act upon all instances. - default: None -requirements: ["novaclient"] -''' - -EXAMPLES = ''' -# Changes the power state via nova -- nova_power_control: - login_username: admin - login_password: admin - login_tenant_name: admin - instance_id: 4f905f38-e52a-43d2-b6ec-754a13ffb529 - state: stopped -''' - - -# The following two openstack_ are copy pasted from an upcoming -# core module "lib/ansible/module_utils/openstack.py" Once that's landed, -# these should be replaced with a line at the bottom of the file: -# from ansible.module_utils.openstack import * -def openstack_argument_spec(): - # Consume standard OpenStack environment variables. - # This is mainly only useful for ad-hoc command line operation as - # in playbooks one would assume variables would be used appropriately - OS_AUTH_URL = os.environ.get('OS_AUTH_URL', 'http://127.0.0.1:35357/v2.0/') - OS_PASSWORD = os.environ.get('OS_PASSWORD', None) - OS_REGION_NAME = os.environ.get('OS_REGION_NAME', None) - OS_USERNAME = os.environ.get('OS_USERNAME', 'admin') - OS_TENANT_NAME = os.environ.get('OS_TENANT_NAME', OS_USERNAME) - - spec = dict( - login_username=dict(default=OS_USERNAME), - auth_url=dict(default=OS_AUTH_URL), - region_name=dict(default=OS_REGION_NAME), - availability_zone=dict(default=None), - ) - if OS_PASSWORD: - spec['login_password'] = dict(default=OS_PASSWORD) - else: - spec['login_password'] = dict(required=True) - if OS_TENANT_NAME: - spec['login_tenant_name'] = dict(default=OS_TENANT_NAME) - else: - spec['login_tenant_name'] = dict(required=True) - return spec - - -def _get_server(nova, instance_id): - try: - return nova.servers.get(instance_id) - except Exception, e: - module.fail_json( - msg="Error accessing instance %s: %s" % (instance_id, e.message) - ) - - -def _write_metadata(nova, server): - nova.servers.set_meta( - server.id, - {'ansible_previous_state': server.status} - ) - - -def _suspend_instance(nova, instance_id): - try: - server = None - server = _get_server(nova, instance_id) - if server.status != "ACTIVE": - if server.status != "PAUSED": - return False - _write_metadata(nova, server) - nova.servers.suspend(server.id) - return (True, nova.servers.suspend(server.id)) - except Exception, e: - return (False, e.message) - - -def _resume_instance(nova, instance_id): - try: - server = None - server = _get_server(nova, instance_id) - if server.status != "SUSPENDED": - return False - _write_metadata(nova, server) - return (True, nova.servers.resume(server.id)) - except Exception, e: - return (False, e.message) - - -def _stop_instance(nova, instance_id): - try: - server = None - server = _get_server(nova, instance_id) - if server.status != "ACTIVE": - if server.status != "PAUSED": - return False - _write_metadata(nova, server) - return (True, nova.servers.stop(server.id)) - except Exception, e: - return (False, e.message) - - -def _start_instance(nova, instance_id): - try: - server = None - server = _get_server(nova, instance_id) - if server.status != "STOPPED": - if server.status != "SUSPENDED": - if server.status != "PAUSED": - return False - _write_metadata(nova, server) - return (True, nova.servers.start(server.id)) - except Exception, e: - return (False, e.message) - - -def _previous_state(nova, instance_id): - """ - Attempts to return instances to their previous state if they were - stopped or suspended. - """ - try: - server = _get_server(nova, instance_id) - if server.metadata["ansible_previous_state"] == "ACTIVE": - if server.status != "ACTIVE": - if server.status == "STOPPED": - return _start_instance(nova, instance_id) - if server.status == "SUSPENDED": - return _resume_instance(nova, instance_id) - return (False, None) - except Exception, e: - return (False, e.message) - - -def _determine_task(nova, instance_id, action): - choice = { - 'running': _start_instance, - 'start': _start_instance, - 'on': _start_instance, - 'stopped': _stop_instance, - 'stop': _stop_instance, - 'off': _stop_instance, - 'resume': _resume_instance, - 'previous': _previous_state - } - return choice[action](nova, instance_id) - - -def _many_servers(module, nova, servers): - """ - Enumerates through the list of services and calls - _determine_task. - """ - results = [] - for server in servers: - result = _determine_task(nova, server.id, module.params['state']) - results.append(results) - module.exit_json(changed=True, output=results) - - -def _all_instances(module, nova): - """ - Retrieves the entire list of servers and changes and applies the - desired state. - """ - results = [] - for server in nova.servers.list(): - _determine_task(nova, server.id, module.params['state']) - results.append(results) - module.exit_json(changed=True, output=results) - - -def _nova_powercontrol(module, nova): - state = module.params['state'] - if module.params['instance_id'] is not None: - (status, message) = _determine_task( - nova, - module.params['instance_id'], - state - ) - if status: - module.exit_json(changed=True, output=message) - else: - module.fail_json( - msg="Instance %s failed to update with error %s" % ( - module.params['instance_id'], - message - ) - ) - elif module.params['hypervisor'] is not None: - try: - hypervisor = nova.hypervisors.search( - True, - module.params['hypervisor'], - servers=True - ) - _many_servers(module, nova, hypervisor.servers) - except: - module.fail_json( - msg="Unable to find zone %s" % module.params['hypervisor'] - ) - elif module.params['zone'] is not None: - try: - servers = nova.servers.list( - True, - {'OS-EXT-AZ:availability_zone': module.params['zone']} - ) - _many_servers(module, nova, servers) - except: - module.fail_json( - msg="Unable to find zone %s" % module.params['zone'] - ) - elif module.params['all_instances'] is not None: - _all_instances(module, nova) - else: - module.fail_json( - msg="Unable to proceed: Requires instance_id, hypervisor, " - "zone, or special flag all_instances." - ) - - -def main(): - argument_spec = openstack_argument_spec() - argument_spec.update(dict( - state=dict(required=True), - instance_id=dict(), - hypervisor=dict(), - zone=dict(), - all_instances=dict() - )) - module = AnsibleModule(argument_spec=argument_spec) - - nova = nova_client.Client(module.params['login_username'], - module.params['login_password'], - module.params['login_tenant_name'], - module.params['auth_url'], - region_name=module.params['region_name'], - service_type='compute') - try: - nova.authenticate() - except exceptions.Unauthorized, e: - module.fail_json( - msg="Invalid OpenStack Nova credentials.: %s" % e.message - ) - except exceptions.AuthorizationFailure, e: - module.fail_json( - msg="Unable to authorize user: %s" % e.message - ) - - _nova_powercontrol(module, nova) - - -# this is magic, see lib/ansible/module_common.py -from ansible.module_utils.basic import * -main() diff --git a/playbooks/library/nova_rebuild b/playbooks/library/nova_rebuild deleted file mode 100644 index a08e27f..0000000 --- a/playbooks/library/nova_rebuild +++ /dev/null @@ -1,268 +0,0 @@ -#!/usr/bin/env python -# This code is part of Ansible, but is an independent component. -# This particular file snippet, and this file snippet only, is BSD licensed. -# Modules you write using this snippet, which is embedded dynamically by Ansible -# still belong to the author of the module, and may assign their own license -# to the complete work. -# -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import os -import sys -import traceback - -try: - from novaclient.v1_1 import client as nova_client - from novaclient import exceptions - import time -except ImportError: - print("failed=True msg='novaclient is required for this module'") - -DOCUMENTATION = ''' ---- -module: nova_rebuild -short_description: Rebuild VMs from OpenStack -description: - - Rebuild (re-image) virtual machines from Openstack. -options: - login_username: - description: - - login username to authenticate to keystone - required: true - default: admin - login_password: - description: - - Password of login user - required: true - default: 'yes' - login_tenant_name: - description: - - The tenant name of the login user - required: true - default: 'yes' - auth_url: - description: - - The keystone url for authentication - required: false - default: 'http://127.0.0.1:35357/v2.0/' - region_name: - description: - - Name of the region - required: false - default: None - name: - description: - - Name of the instance to be rebuilt - default: None - instance_id: - description: - - Instance ID of the instance to be rebuilt - default: None - image_id: - description: - - The id of the image that has to be cloned - required: true - default: None - preserve_ephemeral: - description: - - Whether to preserve ephemeral storage on the instance - required: false - default: false - wait: - description: - - If the module should wait for the VM to be created. - required: false - default: 'yes' - wait_for: - description: - - Number of seconds the module should wait for the VM to get into active state - required: false - default: 600 -requirements: ["novaclient"] -''' - -EXAMPLES = ''' -# Rebuilds an existing VM with a new image -- nova_rebuild: - login_username: admin - login_password: admin - login_tenant_name: admin - name: vm1 - image_id: 4f905f38-e52a-43d2-b6ec-754a13ffb529 - wait_for: 200 -''' - - -# The following two openstack_ are copy paste from an upcoming -# core module "lib/ansible/module_utils/openstack.py" Once that's landed, -# these should be replaced with a line at the bottom of the file: -# from ansible.module_utils.openstack import * -def openstack_argument_spec(): - # Consume standard OpenStack environment variables. - # This is mainly only useful for ad-hoc command line operation as - # in playbooks one would assume variables would be used appropriately - OS_AUTH_URL=os.environ.get('OS_AUTH_URL', 'http://127.0.0.1:35357/v2.0/') - OS_PASSWORD=os.environ.get('OS_PASSWORD', None) - OS_REGION_NAME=os.environ.get('OS_REGION_NAME', None) - OS_USERNAME=os.environ.get('OS_USERNAME', 'admin') - OS_TENANT_NAME=os.environ.get('OS_TENANT_NAME', OS_USERNAME) - - spec = dict( - login_username = dict(default=OS_USERNAME), - auth_url = dict(default=OS_AUTH_URL), - region_name = dict(default=OS_REGION_NAME), - availability_zone = dict(default=None), - ) - if OS_PASSWORD: - spec['login_password'] = dict(default=OS_PASSWORD) - else: - spec['login_password'] = dict(required=True) - if OS_TENANT_NAME: - spec['login_tenant_name'] = dict(default=OS_TENANT_NAME) - else: - spec['login_tenant_name'] = dict(required=True) - return spec - - -def openstack_find_nova_addresses(addresses, ext_tag, key_name=None): - - ret = [] - for (k, v) in addresses.iteritems(): - if key_name and k == key_name: - ret.extend([addrs['addr'] for addrs in v]) - else: - for interface_spec in v: - if 'OS-EXT-IPS:type' in interface_spec and interface_spec['OS-EXT-IPS:type'] == ext_tag: - ret.append(interface_spec['addr']) - return ret - - -def _rebuild_server(module, nova): - server = None - last_error = None - last_stacktrace = None - try: - if module.params.get('instance_id') is None: - servers = nova.servers.list(True, {'name': module.params['name']}) - if servers: - # the {'name': module.params['name']} will also return servers - # with names that partially match the server name, so we have to - # strictly filter here - servers = [x for x in servers if x.name == module.params['name']] - if servers: - server = servers[0] - else: - server = nova.servers.get(module.params['instance_id']) - except Exception, e: - module.fail_json(msg = "Error in getting the server list: %s" % e.message) - if not server: - module.exit_json(changed = False, result = "not present") - - bootargs = [server, module.params['image_id']] - bootkwargs = { - 'preserve_ephemeral' : module.params['preserve_ephemeral'], - } - try: - server = nova.servers.rebuild(*bootargs, **bootkwargs) - server = nova.servers.get(server.id) - except Exception, e: - module.fail_json( msg = "Error in rebuilding instance: %s " % e.message) - if module.params['wait'] == 'yes': - expire = time.time() + int(module.params['wait_for']) - while time.time() < expire: - try: - server = nova.servers.get(server.id) - except Exception, last_error: - # This logic attempts to retry a failed status query - # once before aborting and returning an error to - # Ansible. This helps prevent momentarilly transient - # issues from creating spurious issues. - # - # Ideally, we would change this logic to something - # along the lines of wait_for, although logging - # would need to be addressed so issues can be - # identified should errors occur. - last_error = traceback.format_exc - time.sleep(2) - try: - server = nova.servers.get(server.id) - except Exception, error: - module.fail_json( - msg = ("Error in getting info for instance: %s\n" - "Initial error: %s\n" - "Stack backtrace: %s\n" - "Terminal error: %s\n" - "Terminal stack backtrace: %s") % ( - last_stracetrace, - last_error.message, - error.message, - traceback.format_exc - ) - ) - - if server.status == 'ACTIVE': - private = openstack_find_nova_addresses(getattr(server, 'addresses'), 'fixed', 'private') - public = openstack_find_nova_addresses(getattr(server, 'addresses'), 'floating', 'public') - module.exit_json(changed = True, id = server.id, private_ip=''.join(private), public_ip=''.join(public), status = server.status, info = server._info) - if server.status == 'ERROR': - module.fail_json(msg = "Instance exited Nova Rebuild in an ERROR state, please check OpenStack logs") - time.sleep(2) - - module.fail_json(msg = "Timeout waiting for the server to come up.. Please check manually") - if server.status == 'ERROR': - module.fail_json(msg = "Error in rebuilding the server.. Please check manually") - private = openstack_find_nova_addresses(getattr(server, 'addresses'), 'fixed', 'private') - public = openstack_find_nova_addresses(getattr(server, 'addresses'), 'floating', 'public') - module.exit_json(changed = True, id = info['id'], private_ip=''.join(private), public_ip=''.join(public), status = server.status, info = server._info) - - -def main(): - argument_spec = openstack_argument_spec() - argument_spec.update(dict( - name = dict(), - instance_id = dict(), - image_id = dict(required=True), - preserve_ephemeral = dict(default=False, choices=[True, False]), - wait = dict(default='yes', choices=['yes', 'no']), - wait_for = dict(default=600), - )) - module = AnsibleModule(argument_spec=argument_spec) - - nova = nova_client.Client(module.params['login_username'], - module.params['login_password'], - module.params['login_tenant_name'], - module.params['auth_url'], - region_name=module.params['region_name'], - service_type='compute') - try: - nova.authenticate() - except exceptions.Unauthorized, e: - module.fail_json(msg = "Invalid OpenStack Nova credentials.: %s" % e.message) - except exceptions.AuthorizationFailure, e: - module.fail_json(msg = "Unable to authorize user: %s" % e.message) - - _rebuild_server(module, nova) - -# this is magic, see lib/ansible/module_common.py -from ansible.module_utils.basic import * -main() diff --git a/playbooks/library/service_facts b/playbooks/library/service_facts deleted file mode 100644 index 426d240..0000000 --- a/playbooks/library/service_facts +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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 subprocess - - -def main(): - - existing_services = set() - for init_filename in os.listdir('/etc/init.d'): - if init_filename[0] == '.': - continue - existing_services.add(init_filename) - try: - initctl_list = subprocess.Popen(['initctl', 'list'], - stdout=subprocess.PIPE) - for upstart_job in initctl_list.stdout: - existing_services.add(upstart_job.split(' ', 1)[0]) - except subprocess.CalledProcessError as e: - if e.errno != 2: - raise e - - module = AnsibleModule(argument_spec={}) - module.exit_json(ansible_facts={'existing_services': - list(existing_services)}) - - -from ansible.module_utils.basic import * -main() diff --git a/playbooks/mysql_access_fix.yml b/playbooks/mysql_access_fix.yml deleted file mode 100644 index f7799df..0000000 --- a/playbooks/mysql_access_fix.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -- name: "Ensure /root/.my.cnf is present" - sudo: yes - command: cp -a /mnt/state/root/metadata.my.cnf /root/.my.cnf creates=/root/.my.cnf diff --git a/playbooks/mysql_init_fix.yml b/playbooks/mysql_init_fix.yml deleted file mode 100644 index f955b73..0000000 --- a/playbooks/mysql_init_fix.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -- name: Rename MySQL upstart script - sudo: yes - command: mv -f /etc/init/mysql.conf /etc/init/mysql-boot-control.conf removes=/etc/init/mysql.conf diff --git a/playbooks/pre-flight_check.yml b/playbooks/pre-flight_check.yml deleted file mode 100644 index 76cbf72..0000000 --- a/playbooks/pre-flight_check.yml +++ /dev/null @@ -1,124 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- hosts: localhost - roles: - - { role: pre_flight_disk_check, fail_percent: 20, exclude_mounts: [] } -- hosts: undercloud - roles: - - { role: pre_flight_disk_check, fail_percent: 20, exclude_mounts: [], when: instance_status == "ACTIVE" } -- hosts: controller - vars: - num_bootstrap_hosts: "{{ groups['controller-bootstrap'] | length }}" - expected_bootstrap_hosts: 1 - num_controller_hosts: "{{ groups['controller'] | length }}" - expected_controller_hosts: 2 - tasks: - - name: "Verify correct number of controller bootstrap nodes" - fail: > - msg="The number of bootstrap nodes is "{{ num_bootstrap_hosts }}" \ - must be exactly "{{ expected_bootstrap_hosts }}"!" - when: num_bootstrap_hosts | int != expected_bootstrap_hosts - - name: "Verify correct number of controller non-bootstrap nodes" - fail: > - msg="The number of controller non-bootstrap nodes is \ - "{{ num_controller_hosts }}" must be exactly \ - "{{ expected_controller_hosts }}"!" - when: num_controller_hosts | int != expected_controller_hosts -- hosts: controller-bootstrap:controller - name: "Check Controller Node Status - Ensuring MySQL is running" - sudo: yes - gather_facts: yes - max_fail_percentage: 0 - tasks: - - name: "Verify controller nodes are ACTIVE" - fail: > - msg="One of more controller nodes don't have a status of \ - ACTIVE in nova, cannot proceed with update" - when: instance_status != "ACTIVE" - - name: "Rename MySQL upstart configuration, if necessary, to obtain correct results." - sudo: yes - command: mv -f /etc/init/mysql.conf /etc/init/mysql-boot-control.conf removes=/etc/init/mysql.conf - when: instance_status == "ACTIVE" - - name: "Ensuring MySQL is running - If this fails, the cluster is likely not in a healthy state, and manual checks/recovery will be required." - service: name=mysql state=started - when: instance_status == "ACTIVE" -- hosts: controller-bootstrap - name: Check RabbitMQ Bootstrap Node - sudo: yes - gather_facts: yes - max_fail_percentage: 0 - tasks: - - name: "Execute RabbitMQ status Check to verify RabbitMQ is running." - sudo: yes - shell: rabbitmqctl -n rabbit@$(hostname) status - when: instance_status == "ACTIVE" - register: rabbitmq_status - ignore_errors: yes - - name: "Attempting to start RabbitMQ - Bootstrap Node" - service: name=rabbitmq-server state=started - when: rabbitmq_status.rc != 0 - - name: "Checking RabbitMQ Cluster Status - Bootstrap Node" - shell: rabbitmqctl -n rabbit@$(hostname) status -- hosts: controller - name: "Check RabbitMQ server status" - sudo: yes - gather_facts: yes - max_fail_percentage: 0 - tasks: - - name: "Execute RabbitMQ status Check to verify RabbitMQ is running." - shell: rabbitmqctl -n rabbit@$(hostname) status - when: instance_status == "ACTIVE" - register: rabbitmq_status - ignore_errors: yes - - name: "Attempting to start RabbitMQ" - service: name=rabbitmq-server state=started - when: rabbitmq_status.rc != 0 - - name: "Checking RabbitMQ Cluster Status" - shell: rabbitmqctl -n rabbit@$(hostname) status -- hosts: controller-bootstrap:controller - name: Check controller MySQL Sync status - gather_facts: no - max_fail_percentage: 0 - tasks: - - name: "Querying MySQL to determine Galera cluster status" - sudo: yes - shell: mysql --defaults-file=/mnt/state/root/metadata.my.cnf --socket /var/run/mysqld/mysqld.sock -N -e "SHOW STATUS LIKE 'wsrep_local_state'"|cut -f2 - when: helion is not defined - register: wsrep_local_state - - name: "Querying MySQL to determine Galera cluster size" - sudo: yes - shell: mysql --defaults-file=/mnt/state/root/metadata.my.cnf --socket /var/run/mysqld/mysqld.sock -N -e "SHOW STATUS LIKE 'wsrep_cluster_size'"|cut -f2 - when: helion is not defined - register: wsrep_cluster_size - - fail: msg="Galera wsrep_local_state is not indicating a healthy state, cluster node may be out of sync, manual intervention required." - when: helion is not defined and wsrep_local_state.stdout != "4" - - fail: msg="Galera cluster size is being reported as a single node. The cluster is in an unsafe, possibly split brain state." - when: helion is not defined and wsrep_cluster_size.stdout == "1" - # Helion - - name: "Querying MySQL to determine Galera cluster status - Helion" - sudo: yes - shell: mysql --defaults-file=/mnt/state/root/metadata.my.cnf -N -e "SHOW STATUS LIKE 'wsrep_local_state'"|cut -f2 - when: helion is defined - register: wsrep_local_state - - name: "Querying MySQL to determine Galera cluster size - Helion" - sudo: yes - shell: mysql --defaults-file=/mnt/state/root/metadata.my.cnf -N -e "SHOW STATUS LIKE 'wsrep_cluster_size'"|cut -f2 - when: helion is defined - register: wsrep_cluster_size - - fail: msg="Galera wsrep_local_state is not indicating a healthy state, cluster node may be out of sync, manual intervention required." - when: helion is defined and wsrep_local_state.stdout != "4" - - fail: msg="Galera cluster size is being reported as a single node. The cluster is in an unsafe, possibly split brain state." - when: helion is defined and wsrep_cluster_size.stdout == "1" diff --git a/playbooks/preserve_ssh_host_keys.yml b/playbooks/preserve_ssh_host_keys.yml deleted file mode 100644 index 236cea9..0000000 --- a/playbooks/preserve_ssh_host_keys.yml +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Removing any pre-existing host key backup directory" - sudo: yes - file: path=/mnt/state/_ssh_host_keys state=absent -- name: "Create ssh host key backup directory" - sudo: yes - file: - path=/mnt/state/_ssh_host_keys - state=directory - owner=root - group=root - mode=0700 -- name: "Preserve ssh host keys" - sudo: yes - action: shell cp -a /etc/ssh/ssh_host_* /mnt/state/_ssh_host_keys/ -- name: "Issue Sync to OS in order to help mitigate unsafe disk caching in virtualized environments." - command: sync -- name: "Pausing for 15 seconds to allow for any delayed IO in unsafe disk caches to be written to disk." - pause: seconds=15 diff --git a/playbooks/rabbitmq_occ_disable.yml b/playbooks/rabbitmq_occ_disable.yml deleted file mode 100644 index c8de6bc..0000000 --- a/playbooks/rabbitmq_occ_disable.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -- name: Determine if node is part of a cluster - shell: grep -q "$(hostname)" "/mnt/state/var/lib/rabbitmq/mnesia/rabbit@$(hostname)/cluster_nodes.config" - ignore_errors: yes - register: rabbit_cluster_test -- name: Collect names of post-configure.d rabbitmq files - shell: ls "{{os_refresh_config_folder}}/post-configure.d/"|grep '\-rabbitmq$' - register: test_rabbitmq_script_list - when: rabbit_cluster_test.rc == 0 -- name: If node rabbitmq cluster config was present, prevent os-refresh-config post-configure.d job from executing. - file: mode=0644 path="{{os_refresh_config_folder}}/post-configure.d/{{item}}" - when: rabbit_cluster_test.rc == 0 - with_items: test_rabbitmq_script_list.stdout_lines diff --git a/playbooks/rabbitmq_rejoin_cluster.yml b/playbooks/rabbitmq_rejoin_cluster.yml deleted file mode 100644 index 6c9b93d..0000000 --- a/playbooks/rabbitmq_rejoin_cluster.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Additional Steps for controller nodes only to rejoin the cluster -- name: Get the bootstrap hostname - set_fact: - bootstrap_hostname={{ hostvars[groups['controller-bootstrap'][0]]['ansible_hostname'] }} -- name: Stop the RabbitMQ application to enable rejoining the cluster - command: rabbitmqctl stop_app - sudo: yes -- name: Re-join the RabbitMQ cluster - command: rabbitmqctl join_cluster "rabbit@{{ bootstrap_hostname }}" - failed_when: bootstrap_hostname is not defined -- name: Start the RabbitMQ application - command: rabbitmqctl start_app - sudo: yes \ No newline at end of file diff --git a/playbooks/rebuild.yml b/playbooks/rebuild.yml deleted file mode 100644 index a51659c..0000000 --- a/playbooks/rebuild.yml +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Setting default fact indicating no rebuild has yet taken place" - set_fact: instance_rebuilt=false -- name: "Call nova_rebuild if instance needs to be updated" - nova_rebuild: - instance_id: "{{ instance_id }}" - image_id: "{{ rebuild_image_id }}" - preserve_ephemeral: true - wait: "yes" - wait_for: 900 - delegate_to: localhost - when: instance_image_id != rebuild_image_id and force_rebuild is not defined - register: test_rebuild_normal -- name: "Record that instance was rebuilt under normal circumstances" - set_fact: instance_rebuilt=true - when: test_rebuild_normal.changed == true -- name: "Call nova_rebuild if rebuild is mandated" - nova_rebuild: - instance_id: "{{ instance_id }}" - image_id: "{{ rebuild_image_id }}" - preserve_ephemeral: true - wait: "yes" - wait_for: 900 - delegate_to: localhost - when: force_rebuild is defined - register: test_rebuild_forced -- name: "Record that instance was rebuilt under normal circumstances" - set_fact: instance_rebuilt=true - when: test_rebuild_forced.changed == true -- name: "If we did not rebuild, and the image IDs already match, trigger the ephemeral disk to remount." - sudo: yes - command: "{{os_refresh_config_folder}}/pre-configure.d/00-fix-ephemeral-mount" - when: instance_image_id == rebuild_image_id and force_rebuild is not defined or instance_rebuilt == false diff --git a/playbooks/refresh_config.yml b/playbooks/refresh_config.yml deleted file mode 100644 index b5594a1..0000000 --- a/playbooks/refresh_config.yml +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -# Update the collect files to contain metadata obtained from Heat -# -- name: "Ensure heat local-data directory exists" - sudo: yes - file: path=/var/lib/os-collect-config/local-data state=directory -- name: "Copy deployments exploder script" - sudo: yes - copy: - src: files/explode-deployments.py - dest: /usr/local/bin/explode-deployments - mode: 0755 -- name: "Write out metadata" - sudo: yes - template: - src: templates/host_metadata.json.j2 - dest: /var/lib/os-collect-config/local-data/host_metadata.json -- name: "Explode deployments" - sudo: yes - command: /usr/local/bin/explode-deployments /var/lib/os-collect-config/local-data diff --git a/playbooks/restart_vms.yml b/playbooks/restart_vms.yml deleted file mode 100644 index 99a21b9..0000000 --- a/playbooks/restart_vms.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -- name: Tell the cloud to shutdown via nova_powercontrol. - nova_powercontrol: - login_username: "{{ lookup('env',OC_OS_USERNAME'}}" - login_password: "{{ lookup('env',OC_OS_PASSWORD'}}" - login_tenant_name: "{{ lookup('env',OC_OS_TENANT_NAME'}}" - auth_url: "{{ lookup('env',OC_OS_AUTH_URL'}}" - all_instances: yes - state: previous - when: use_nova_powercontrol is defined diff --git a/playbooks/restore_ssh_host_keys.yml b/playbooks/restore_ssh_host_keys.yml deleted file mode 100644 index 1aa9696..0000000 --- a/playbooks/restore_ssh_host_keys.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Restore ssh host keys" - sudo: yes - action: shell mv /mnt/state/_ssh_host_keys/ssh_host_* /etc/ssh/ - -- name: "Remove ssh host key backup directory" - sudo: yes - file: - path=/mnt/state/_ssh_host_keys - state=absent diff --git a/playbooks/roles/pre_flight_disk_check/README.rst b/playbooks/roles/pre_flight_disk_check/README.rst deleted file mode 100644 index 092e10d..0000000 --- a/playbooks/roles/pre_flight_disk_check/README.rst +++ /dev/null @@ -1,28 +0,0 @@ -Pre-flight disk check -===================== - -This role can be used to check for sufficient free disk space on -hosts, and will fail if there is not enough space. The amount of space -may be specified as a fixed amount (in bytes) using the `fail_size` -variable, or as a percentage of the total, using the `fail_percent` -variable. Additionally, mounted filesystems can be excluded by mount -name, if specified, in `exclude_mounts`. - -To use the role, either include as usual (to use the default values -specified in defaults/main.yml:: - - - hosts: hostgroup - roles: - - preflight_disk_check - -Or specify your own values when you add the role, as follows:: - - - hosts: hostgroup - roles: - - { role: preflight_disk_check, fail_percent: 10, - exclude_mounts: [ "/mnt" ], when: instance_status == "ACTIVE" - } - -This will allow you to easily set different parameters for different -types of hosts in your playbook. Note that only one of `fail_percent` -or `fail_size` will be used. diff --git a/playbooks/roles/pre_flight_disk_check/defaults/main.yml b/playbooks/roles/pre_flight_disk_check/defaults/main.yml deleted file mode 100644 index e690834..0000000 --- a/playbooks/roles/pre_flight_disk_check/defaults/main.yml +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -fail_percent: 10 -fail_size: -exclude_mounts: [] - - diff --git a/playbooks/roles/pre_flight_disk_check/tasks/main.yml b/playbooks/roles/pre_flight_disk_check/tasks/main.yml deleted file mode 100644 index b11c59a..0000000 --- a/playbooks/roles/pre_flight_disk_check/tasks/main.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: Check if free disk percentage is too low - fail: msg="ERROR - {{ item.size_available|filesizeformat }} is not enough (need at least {{ fail_percent }}% free)" - with_items: "hostvars[inventory_hostname].ansible_mounts" - when: item.mount not in exclude_mounts and fail_percent is defined and "{{ ((item.size_available / item.size_total) * 100)|round|int }}"|int < fail_percent -- name: Check if free disk size is too low - fail: msg="ERROR - {{ item.size_available|filesizeformat }} is not enough (need at least {{ fail_size }} free)" - with_items: "hostvars[inventory_hostname].ansible_mounts" - when: item.mount not in exclude_mounts and fail_size is defined and "{{ item.size_available }}"|int < fail_size \ No newline at end of file diff --git a/playbooks/start_cloud.yml b/playbooks/start_cloud.yml deleted file mode 100644 index d139cb5..0000000 --- a/playbooks/start_cloud.yml +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- hosts: controller - name: Enable Overcloud Controller - sudo: yes - tasks: - - service: name={{ item }} enabled=yes state=started - with_items: overcloud_controller_services -- hosts: nova-compute - name: Enable Overcloud Compute - sudo: yes - tasks: - - name: "Run os-collect-config" - sudo: yes - command: os-collect-config --force --one - - service: name={{ item }} enabled=yes state=started - with_items: overcloud_compute_services -- hosts: undercloud - name: Enable Undercloud - sudo: yes - tasks: - - service: name={{ item }} enabled=yes state=started - with_items: undercloud_services diff --git a/playbooks/start_mysql.yml b/playbooks/start_mysql.yml deleted file mode 100644 index ee51631..0000000 --- a/playbooks/start_mysql.yml +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -- name: Rename MySQL upstart script - sudo: yes - command: mv -f /etc/init/mysql.conf /etc/init/mysql-boot-control.conf removes=/etc/init/mysql.conf -- service: name=mysql state=started enabled=yes - sudo: yes \ No newline at end of file diff --git a/playbooks/start_rabbitmq.yml b/playbooks/start_rabbitmq.yml deleted file mode 100644 index f0d9a96..0000000 --- a/playbooks/start_rabbitmq.yml +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -- name: Determine if node is part of a cluster - shell: grep -q "$(hostname)" "/mnt/state/var/lib/rabbitmq/mnesia/rabbit@$(hostname)/cluster_nodes.config" - ignore_errors: yes - register: rabbit_cluster_test -- name: Collect names of post-configure.d rabbitmq files - shell: ls "{{os_refresh_config_folder}}/post-configure.d/"|grep '\-rabbitmq$' - register: test_rabbitmq_script_list - when: rabbit_cluster_test.rc == 0 -- name: If node rabbitmq cluster config was present, prevent os-refresh-config post-configure.d job from executing. - file: mode=0644 path="{{os_refresh_config_folder}}/post-configure.d/{{item}}" - when: rabbit_cluster_test.rc == 0 - with_items: test_rabbitmq_script_list.stdout_lines - sudo: yes -- name: "Enable rabbitmq" - command: os-svc-enable -n rabbitmq-server - sudo: yes -- name: "Replace rabbitmq-server override to avoid conditions where RabbitMQ can block upgrade." - copy: src=files/rabbitmq-server.override dest=/etc/init/ owner=root group=root mode=0644 - sudo: yes -- name: Start rabbitmq before os-collect-config if previously configured - service: name=rabbitmq-server state=started - sudo: yes -- name: Wait for Rabbit to listen on its usual port - wait_for: port=5672 state=started timeout=90 delay=10 diff --git a/playbooks/step_check_image_vars.yml b/playbooks/step_check_image_vars.yml deleted file mode 100644 index 16e1809..0000000 --- a/playbooks/step_check_image_vars.yml +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- hosts: undercloud - name: Check we have undercloud image ID for rebuild - tasks: - - fail: msg="undercloud_rebuild_image_id is not defined" - when: undercloud_rebuild_image_id is not defined or undercloud_rebuild_image_id == "" or undercloud_rebuild_image_id == None -- hosts: controller - name: Check we have controller image ID for rebuild - tasks: - - fail: msg="controller_rebuild_image_id is not defined" - when: controller_rebuild_image_id is not defined or controller_rebuild_image_id == "" or controller_rebuild_image_id == None -- hosts: swift-storage - name: Check we have swift storage image ID for rebuild - tasks: - - fail: msg="swift_storage_rebuild_image_id is not defined" - when: swift_storage_rebuild_image_id is not defined or swift_storage_rebuild_image_id == "" or swift_storage_rebuild_image_id == None -- hosts: nova-compute - name: Check we have nova compute image ID for rebuild - tasks: - - fail: msg="nova_compute_rebuild_image_id is not defined" - when: nova_compute_rebuild_image_id is not defined or nova_compute_rebuild_image_id == "" or nova_compute_rebuild_image_id == None diff --git a/playbooks/step_cleanup_from_online_upgrade.yml b/playbooks/step_cleanup_from_online_upgrade.yml deleted file mode 100644 index 705c669..0000000 --- a/playbooks/step_cleanup_from_online_upgrade.yml +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Cleaning up /mnt/state/_upgrade_recovery" - sudo: yes - file: - path: /mnt/state/_upgrade_recovery - state: absent -- name: "Cleaning up /tmp/upgrade_image.qcow2" - sudo: yes - file: - path: /tmp/upgrade_image.qcow2 - state: absent diff --git a/playbooks/step_cloud_init.yml b/playbooks/step_cloud_init.yml deleted file mode 100644 index 08dd56f..0000000 --- a/playbooks/step_cloud_init.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Remove ssh from cloud-init job." - sudo: yes - command: sed -i 's/^ - ssh$/# - ssh/' /etc/cloud/cloud.cfg -- name: "Remove ssh-authkey-fingerprints from cloud-init job." - sudo: yes - command: sed -i 's/^ - ssh-authkey-fingerprints$/# - ssh-authkey-fingerprints/' /etc/cloud/cloud.cfg -- name: "Initiate cloudinit" - sudo: yes - command: /usr/bin/cloud-init init diff --git a/playbooks/step_create_databases.yml b/playbooks/step_create_databases.yml deleted file mode 100644 index 06d8d31..0000000 --- a/playbooks/step_create_databases.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Pausing for 60 seconds to give MySQL time to become ready - Helion" - pause: seconds=60 prompt="Pausing for 60 seconds to give MySQL time to become ready" - when: helion is defined -- name: "Execute script to wait for MySQL to enter a Synced state" - sudo: yes - script: files/wait_for_database-helion.sh - when: helion is defined -- name: Triggering os-create-db on databases - sudo: yes - script: files/create-databases.sh - when: helion is defined diff --git a/playbooks/step_fail_unmount.yml b/playbooks/step_fail_unmount.yml deleted file mode 100644 index 88b5373..0000000 --- a/playbooks/step_fail_unmount.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Collect Open File List" - sudo: yes - shell: lsof -n|grep /mnt -- name: "Collect process list" - command: ps auxf -- name: "Fail" - fail: msg="The ephemeral storage of this system failed to be cleaned up properly and processes or files are still in use. The previous ansible play should have information to help troubleshoot this issue." diff --git a/playbooks/step_generate_hosts_file.yml b/playbooks/step_generate_hosts_file.yml deleted file mode 100644 index 789c8f4..0000000 --- a/playbooks/step_generate_hosts_file.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -# This is primarilly due to the fact that we can possibly interrupt existing -# start-up sequences before this is done depending on system performance, and -# as a result be unable later on to start services such as rabbitmq-server. -# -# This at some point should be replaced with comperable code in Ansible -# to have the same end effect. -- name: Trigger hosts file generation - sudo: yes - command: "{{os_refresh_config_folder}}/configure.d/51-hosts" diff --git a/playbooks/step_os-apply-config.yml b/playbooks/step_os-apply-config.yml deleted file mode 100644 index 27126ea..0000000 --- a/playbooks/step_os-apply-config.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -- name: "Initiate os-apply-config" - command: os-collect-config --force --one --command=os-apply-config - ignore_errors: yes - when: instance_rebuilt == true diff --git a/playbooks/step_ping.yml b/playbooks/step_ping.yml deleted file mode 100644 index ab8170b..0000000 --- a/playbooks/step_ping.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: "Test Connectivity to all hosts" - hosts: all - serial: 1 - tasks: - ping: - where: instance_status == "ACTIVE" diff --git a/playbooks/step_post_hook.yml b/playbooks/step_post_hook.yml deleted file mode 100644 index 62b1b0b..0000000 --- a/playbooks/step_post_hook.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Execute LOCAL command on this node" - hosts: localhost - gather_facts: no - sudo: yes - max_fail_percentage: 0 - tasks: - - name: "Execute Locally defined command" - command: "{{ post_hook_command }}" - delegate_to: 127.0.0.1 - when: post_hook_command is defined - diff --git a/playbooks/step_pre_hook.yml b/playbooks/step_pre_hook.yml deleted file mode 100644 index 69c511e..0000000 --- a/playbooks/step_pre_hook.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Execute LOCAL command on this node" - hosts: localhost - sudo: yes - gather_facts: no - max_fail_percentage: 0 - tasks: - - name: "Execute Locally defined command" - command: "{{ pre_hook_command }}" - delegate_to: 127.0.0.1 - when: pre_hook_command is defined - diff --git a/playbooks/step_preserve_iscsi_initiator.yml b/playbooks/step_preserve_iscsi_initiator.yml deleted file mode 100644 index 506bb25..0000000 --- a/playbooks/step_preserve_iscsi_initiator.yml +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Ensure /mnt/state/etc/iscsi/ exists" - sudo: yes - file: path=/mnt/state/etc/iscsi/ state=directory mode=0755 -- name: "Backup /etc/iscsi/initiatorname.iscsi to /mnt/state/etc/iscsi/initiatorname.iscsi" - sudo: yes - command: cp -a /etc/iscsi/initiatorname.iscsi /mnt/state/etc/iscsi/initiatorname.iscsi diff --git a/playbooks/step_preserve_password_file.yml b/playbooks/step_preserve_password_file.yml deleted file mode 100644 index a7228d3..0000000 --- a/playbooks/step_preserve_password_file.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -- name: "Ensure /mnt/state/etc exists" - sudo: yes - file: path=/mnt/state/etc owner=root group=root mode=0755 state=directory -- name: "Saving a copy of /etc/passwd to /mnt/state/etc/passwd.backup" - sudo: yes - command: cp -a /etc/passwd /mnt/state/etc/passwd.backup -- name: "Saving a copy of /etc/group to /mnt/state/etc/passwd.backup" - sudo: yes - command: cp -a /etc/group /mnt/state/etc/group.backup diff --git a/playbooks/step_reset_mnt_state_permissions.yml b/playbooks/step_reset_mnt_state_permissions.yml deleted file mode 100644 index 44f3249..0000000 --- a/playbooks/step_reset_mnt_state_permissions.yml +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -- name: "Correcting Permissions for /mnt/state/var/log" - sudo: yes - script: files/correct_mnt_state_permissions.py -f /mnt/state/etc/passwd.backup -g /mnt/state/etc/group.backup -d /mnt/state/var/log -- name: "Correcting Permissions for /mnt/state/var/lib" - sudo: yes - script: files/correct_mnt_state_permissions.py -f /mnt/state/etc/passwd.backup -g /mnt/state/etc/group.backup -d /mnt/state/var/lib -- include: step_preserve_password_file.yml diff --git a/playbooks/step_restore_iscsi_initiator.yml b/playbooks/step_restore_iscsi_initiator.yml deleted file mode 100644 index e3e701c..0000000 --- a/playbooks/step_restore_iscsi_initiator.yml +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Restoring the open-iscsi initiator name file" - sudo: yes - command: cp -a /mnt/state/etc/iscsi/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi -- name: "Restarting the open-iscsi service" - sudo: yes - service: name=open-iscsi state=restarted diff --git a/playbooks/step_run_occ.yml b/playbooks/step_run_occ.yml deleted file mode 100644 index 6bf5629..0000000 --- a/playbooks/step_run_occ.yml +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: Remove os-collect-config disable sentinel file - file: path=/mnt/state/disable-os-collect-config state=absent - sudo: yes -- name: "Setting default fact to run os-collect-config" - set_fact: test_bypass_os_collect_config="False" -- name: "Evaluate if os-collect-config needs to be run" - command: grep -q -i "Completed phase migration" "{{os_collect_config_log}}" - register: test_did_os_collect_config_complete - ignore_errors: yes - when: online_upgrade is not defined -- name: "Setting fact to bypass os-collect-config if applicable" - set_fact: test_bypass_os_collect_config="True" - when: online_upgrade is not defined and test_did_os_collect_config_complete.rc == 0 -- name: "Execute os-collect-config" - command: os-collect-config --force --one - when: test_bypass_os_collect_config != true - register: test_occ_results - until: test_occ_results.rc == 0 - retries: 2 - delay: 15 diff --git a/playbooks/step_stamp_image_id.yml b/playbooks/step_stamp_image_id.yml deleted file mode 100644 index 83bb9cf..0000000 --- a/playbooks/step_stamp_image_id.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Write image ID to instance disk for online upgrades to check" - sudo: yes - copy: - content: "{{ rebuild_image_id }}" - dest: /etc/tripleo_image_id - owner: root - group: root - mode: 0644 diff --git a/playbooks/step_stop_ns_metadata_proxy.yml b/playbooks/step_stop_ns_metadata_proxy.yml deleted file mode 100644 index afee351..0000000 --- a/playbooks/step_stop_ns_metadata_proxy.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -# -# Work around bug in init script that causes status to malfunction on tgt -# The service will happily start over and over but stopping is tricky ---- -# After shutdown of neutron services, neutron-ns-metadata-proxy is still present -# This services logs to the ephemeral partition, so un-mounting is not possible -# No upstart scripts for this service, so needs to be killed. -- name: Kill neutron metadata proxy service - command: pkill -9 -f neutron-ns-metadata-proxy - ignore_errors: yes diff --git a/playbooks/step_stop_services.yml b/playbooks/step_stop_services.yml deleted file mode 100644 index 4f4cd62..0000000 --- a/playbooks/step_stop_services.yml +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Collect Service Facts" - sudo: yes - service_facts: - when: instance_status == "ACTIVE" -- name: "Stop services" - sudo: yes - service: name={{ item }} enabled=no state=stopped - with_items: services_to_stop - when: instance_status == "ACTIVE" and item in existing_services -- include: stop_tgt.yml - when: instance_status == "ACTIVE" - sudo: yes diff --git a/playbooks/step_undercloud_backup_tftpboot.yml b/playbooks/step_undercloud_backup_tftpboot.yml deleted file mode 100644 index 660b9aa..0000000 --- a/playbooks/step_undercloud_backup_tftpboot.yml +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Purge previous backup folder" - sudo: yes - file: path=/mnt/state/_upgrade_backup_tftpboot.tar.bz state=absent -- name: "Backup /tftpboot" - sudo: yes - command: tar --exclude='pxelinux.0' -cvjf /mnt/state/_upgrade_backup_tftpboot.tar.bz /tftpboot diff --git a/playbooks/step_undercloud_ironic_release_reservations.yml b/playbooks/step_undercloud_ironic_release_reservations.yml deleted file mode 100644 index 86ee58d..0000000 --- a/playbooks/step_undercloud_ironic_release_reservations.yml +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -# These steps are to address Ironic bug -# https://bugs.launchpad.net/ironic/+bug/1382698 -- name: Reset Ironic Reservations - sudo: yes - command: mysql --defaults-file=/mnt/state/root/metadata.my.cnf --socket /var/run/mysqld/mysqld.sock ironic -e 'update nodes set reservation=NULL where reservation="{{ ansible_fqdn }}";' - when: helion is not defined -- name: Reset Ironic Reservations - Helion - sudo: yes - shell: mysql --defaults-file=/mnt/state/root/metadata.my.cnf ironic -e 'update nodes set reservation=NULL where reservation="{{ ansible_fqdn }}";' - when: helion is defined diff --git a/playbooks/step_undercloud_restore_tftpboot.yml b/playbooks/step_undercloud_restore_tftpboot.yml deleted file mode 100644 index cb898d1..0000000 --- a/playbooks/step_undercloud_restore_tftpboot.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Restore /tftpboot contents" - sudo: yes - command: tar -C / -xvjf /mnt/state/_upgrade_backup_tftpboot.tar.bz tftpboot diff --git a/playbooks/step_unmount.yml b/playbooks/step_unmount.yml deleted file mode 100644 index d1ff6b8..0000000 --- a/playbooks/step_unmount.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Change /mnt to be a read-only mount-point" - sudo: yes - command: umount /mnt - ignore_errors: True - register: test_remount - when: instance_status == "ACTIVE" and online_upgrade is not defined -- include: step_fail_unmount.yml - when: instance_status == "ACTIVE" and online_upgrade is not defined and test_remount.rc != 0 diff --git a/playbooks/step_update_online.yml b/playbooks/step_update_online.yml deleted file mode 100644 index 0d8be6b..0000000 --- a/playbooks/step_update_online.yml +++ /dev/null @@ -1,197 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Fail upgrade if node status is not ACTIVE" - fail: "Failure: Node MUST be in ACTIVE state to proceed. Online upgrade cannot be completed, please consider a standard image rebuild upgrade." - when: instance_status != "ACTIVE" -- name: "Setting default fact indicating no rebuild has yet taken place" - set_fact: instance_rebuilt=false -- name: "Setting default policy to run upgrade" - set_fact: test_run_upgrade=true -- name: "Compare, if applicable, the currently deployed image id" - command: grep -q "{{ rebuild_image_id }}" /etc/tripleo_image_id - when: force_rebuild is not defined - register: test_check_version - ignore_errors: yes -- name: "Set action to false if rebuild is not being forced and currently deployed version matches what is being deployed" - set_fact: test_run_upgrade=false - when: force_rebuild is not defined and test_check_version.rc == 0 -- name: "Ensure qemu-utils and rsync are installed" - sudo: yes - # This will require gather_facts to have logic at some point to - # support operating systems that do not use apt. - apt: pkg={{ item }} state=present - with_items: - - qemu-utils - - rsync - when: test_run_upgrade == true -- name: "Load nbd kernel module" - sudo: yes - modprobe: - name: nbd - state: present - params: "max_part=16" - when: test_run_upgrade == true -- name: "Triggering upload of image to node" - sudo: yes - include: step_upload_image.yml - vars: - update_image: "/tmp/image-{{ rebuild_image_id }}.qcow2" - when: online_upgrade is defined and test_run_upgrade == true -- name: "Creating directory for update to run from on node" - sudo: yes - file: - path: /tmp/update_image - state: directory - when: test_run_upgrade == true -- name: "Ensuring that the mountpoint is not already mounted" - sudo: yes - command: umount /tmp/update_image - ignore_errors: yes - when: test_run_upgrade == true -- name: "Ensuring that the image is not already attached" - sudo: yes - command: /usr/bin/qemu-nbd -d /dev/nbd4 - ignore_errors: yes - when: test_run_upgrade == true -- name: "Attaching update image" - sudo: yes - command: /usr/bin/qemu-nbd -c /dev/nbd4 "{{ default_update_file_location }}" - when: test_run_upgrade == true -- name: "Preserving ssh keys in case online upgrade fails and full rebuild is required to recover" - include: preserve_ssh_host_keys.yml - when: online_upgrade is defined and test_run_upgrade == true -- name: "Ensure that a previous online upgrade folder does not exist" - sudo: yes - file: path=/mnt/state/_upgrade_recovery state=absent - when: test_run_upgrade == true -- name: "Make an upgrade recovery folder on the ephemeral disk" - sudo: yes - file: path=/mnt/state/_upgrade_recovery state=directory owner=root group=root mode=0700 - when: test_run_upgrade == true -- name: "Backup /etc to /mnt/state/_upgrade_recovery" - sudo: yes - shell: cp -a /etc /mnt/state/_upgrade_recovery/ -- name: "Backup /var/log to /mnt/state/_upgrade_recovery" - sudo: yes - shell: mkdir /mnt/state/_upgrade_recovery/var ; cp -a /var/log /mnt/state/_upgrade_recovery/var/ -- name: "Attaching image to mount point" - sudo: yes - command: mount /dev/nbd4 /tmp/update_image - when: test_run_upgrade == true -# The next several steps are intended as a feature to prevent an -# image from being utilized in this fashion that is is known to be -# incompatible (i.e. incompatible base library changes that would -# normally result in a system being left in a damaged state). -- name: "Verify that the disk image does not contain a warning flag" - shell: test -x /tmp/update_image/boot/tripleo_incompatible_upgrade - when: test_run_upgrade == true - register: test_abort_incompatible - ignore_errors: yes -- name: "If aborting, detach update image mountpoint" - sudo: yes - command: umount /tmp/update_image - when: test_run_upgrade == true and test_abort_incompatible.rc == 0 -- name: "If aborting, detach image" - sudo: yes - command: /usr/bin/qemu-nbd -d /dev/nbd4 - when: test_run_upgrade == true and test_abort_incompatible.rc == 0 -- name: "If aborting, fail." - fail: "Image is marked as being incompatible for online upgrades. Please attempt a normal upgrade." - when: test_run_upgrade == true and test_abort_incompatible.rc == 0 -- name: "Ensure folder exists for rsync log to be housed" - sudo: yes - file: path=/mnt/state/var/log/online_upgrade state=directory owner=root group=root mode=0700 - when: test_run_upgrade == true -- name: "Pre-flight check that we appear to have an image mounted" - shell: test -e /tmp/update_image/boot - when: test_run_upgrade == true - register: test_is_update_image - ignore_errors: yes -- name: "Fail if image does not appear to be valid" - fail: "ERROR: Upgrade image did not mount, or is not valid." - when: test_run_upgrade == true and test_is_update_image.rc != 0 -- name: "Initiating update of files, this may take a while." - sudo: yes - # The following list of files excluded are to ensure access by Ansible - # and continuation of existing processes with minimal impact. - # * /tmp - Excluded as this is the source folder - # * /etc/hosts - Excluded as it is normally populated with host information - # by os-collect-config, and being in a reverted state causes latency while - # the host is attempting to resolve the IP address of the node connecting. - # * /etc/ssh/ssh_host_* - This is to preserve the ssh host keys so Ansible - # is able to reconnect. - # * /etc/passwd /etc/shadow /etc/group - These are preserved so Ansible - # is able to log back into the system after the system after the sync - # has been completed as the heat-admin user is not bured into the image. - # * /home/heat-admin - Same case as above. - # * /mnt - Excluded as it is the ephemeral volume mount point. - # * /var/log - Excluded to preserve logs. - # * /lib/modules/$(uname -r) - The current running kernel's modules, which - # need to be kept on disk until a kernel upgrade takes place. - # * /var/lib/heat-* /var/lib/os-collect-config /var/lib/cloud - These - # folders are preserved in order to give the instance a head start on - # starting back up. Additionally /var/lib/cloud contains semaphor locks - # that block operations that would be unsafe to perform at the time of an - # upgrade. - # * /dev - Excluded as the image contains a basic /dev folder, but the host - # operates with devfs. Removal of files from devfs will result in - # unpredictable behavior. - # /var/cache/libvirt/qemu/capabilties /var/lib/libvirt - Removal of these - # files will cause the current virtual machines to stop as they contain - # state information. - # * /var/lib/dhcpd/*.leases - Excluded as we want the DHCP client to attempt - # a renewal instead of requesting a new address. - # * /var/lib/openvswitch - Excluded as it contains the state information for - # openvswitch and we want openvswitch to be running as long as possible - # for minimal connectivity impact to the running virtual machines. - shell: rsync -axHAXv /tmp/update_image/ / --exclude=/tmp --exclude=/etc/hosts --exclude='/etc/ssh/ssh_host_*' --exclude=/etc/passwd --exclude=/etc/shadow --exclude=/etc/group --exclude=/etc/sudoers --exclude=/home/heat-admin --exclude=/mnt --exclude=/var/log --exclude="/lib/modules/$(uname -r)" --exclude='/var/lib/heat-*' --exclude='/dev/' --exclude='/var/cache/libvirt/qemu/capabilities' --exclude='/var/lib/os-collect-config' --exclude='/var/lib/cloud' --exclude='/var/lib/libvirt' --exclude='/var/lib/dhcp/*.leases' --exclude='/var/lib/openvswitch' --delete-after | tee -a /mnt/state/var/log/online_upgrade/rsync.log ; cp -at /etc/ssh/ /mnt/state/_ssh_host_keys/ssh_host_* ; cp -at /etc/ /mnt/state/_upgrade_recovery/etc/hosts /mnt/state/_upgrade_recovery/etc/mtab - when: test_run_upgrade == true - register: test_rsync_completed -- name: "Record that instance was rebuilt under normal circumstances" - set_fact: instance_rebuilt=true - when: test_rsync_completed.rc == 0 -- name: "Restart ssh service" - sudo: yes - service: name=ssh state=restarted - # Note: gather_facts will be required to support restarting on - # systems that use different names for their ssh services. - when: test_run_upgrade == true -- name: "Detach update image mountpoint" - sudo: yes - command: umount /tmp/update_image - when: test_run_upgrade == true -# bounce any core services like ssh TODO -- name: "Remove the post-rsync folder" - sudo: yes - file: - path: /tmp/update_image - state: absent - when: test_run_upgrade == true -- name: "Ensure qemu-utils is installed" - sudo: yes - # This will require gather_facts to have logic at some point to - # support operating systems that do not use apt. - apt: pkg={{ item }} state=present - with_items: - - qemu-utils - when: test_run_upgrade == true -- name: "Detach upgrade image" - sudo: yes - command: /usr/bin/qemu-nbd -d /dev/nbd4 - when: test_run_upgrade == true -# NOTE: Should TripleO one day support booting from the local block -# device, then this is roughly the locaion where support for updating -# the boot loader would be added. diff --git a/playbooks/step_update_online_download_image.yml b/playbooks/step_update_online_download_image.yml deleted file mode 100644 index 53bf5d3..0000000 --- a/playbooks/step_update_online_download_image.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -# -# NOTE: This playbook MUST be executed one instance at a time as it -# is notsafe to allow multiple machines to execute this task at one -# time. ---- -- name: "Download Image" - glance_download: - image_id: "{{ nova_compute_rebuild_image_id }}" - path: "/tmp/image-{{ rebuild_image_id }}.qcow2" - delegate_to: localhost diff --git a/playbooks/step_update_rebuild_node.yml b/playbooks/step_update_rebuild_node.yml deleted file mode 100644 index 1023fc4..0000000 --- a/playbooks/step_update_rebuild_node.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -- include: preserve_ssh_host_keys.yml - when: instance_status == "ACTIVE" -- include: step_unmount.yml - when: instance_status == "ACTIVE" -- { include: rebuild.yml, instance_id: "{{ instance_id }}", when: instance_status != "REBUILD" } -- local_action: wait_for port=22 timeout="{{ ssh_timeout }}" host="{{ inventory_hostname }}" search_regex=TRIPLEO_HK_RESTORED delay=10 - when: wait_for_hostkey is defined - ignore_errors: yes -- local_action: wait_for port=22 timeout="{{ ssh_timeout }}" host="{{ inventory_hostname }}" search_regex=OpenSSH delay=10 - when: wait_for_hostkey is not defined - ignore_errors: yes -- include: refresh_config.yml diff --git a/playbooks/step_upload_image.yml b/playbooks/step_upload_image.yml deleted file mode 100644 index 7878dbd..0000000 --- a/playbooks/step_upload_image.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Upload Image to remote host" - synchronize: - compress: yes - checksum: yes - archive: yes - src: "{{ update_image }}" - dest: "{{ default_update_file_location }}" diff --git a/playbooks/stop_cloud.yml b/playbooks/stop_cloud.yml deleted file mode 100644 index 91294fb..0000000 --- a/playbooks/stop_cloud.yml +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- hosts: controller - name: "Disable OpenStack Controller Services" - tasks: - - service: name={{ item }} enabled=no state=stopped - with_items: control-services -- hosts: nova-compute - name: "Disable OpenStack Compute" - tasks: - - service: name={{ item }} enabled=no state=stopped - with_items: compute-services -- hosts: undercloud - name: "Disable OpenStack Undercloud Services" - tasks: - - service: name={{ item }} enabled=no state=stopped - with_items: undercloud-services diff --git a/playbooks/stop_mysql.yml b/playbooks/stop_mysql.yml deleted file mode 100644 index 0e41711..0000000 --- a/playbooks/stop_mysql.yml +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -- name: Stopping mysql and disabling via upstart - service: name=mysql state=stopped enabled=no - sudo: yes -- name: Removing mysql starting via sysv - command: update-rc.d mysql remove - sudo: yes - when: helion is defined diff --git a/playbooks/stop_tgt.yml b/playbooks/stop_tgt.yml deleted file mode 100644 index 3a932f4..0000000 --- a/playbooks/stop_tgt.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -# -# Work around bug in init script that causes status to malfunction on tgt -# The service will happily start over and over but stopping is tricky -- name: Stop TGT - sudo: yes - service: name=tgt state=stopped enabled=no - ignore_errors: yes -- name: Wait for TGT to be down - wait_for: port=3260 state=stopped timeout=300 diff --git a/playbooks/stop_vms.yml b/playbooks/stop_vms.yml deleted file mode 100644 index 4a532c3..0000000 --- a/playbooks/stop_vms.yml +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -- service_facts: - when: instance_status == "ACTIVE" -- name: Ensure libvirt daemon is running - sudo: yes - service: name={{ item }} state=started enabled=yes - when: use_nova_powercontrol is not defined and item in existing_services - with_items: hypervisor_daemons -- name: Collect list of VMs - sudo: yes - virt: command=list_vms - register: virtual_machines - when: use_nova_powercontrol is not defined -- name: Issue graceful shutdowns - sudo: yes - virt: state=shutdown name={{item}} - when: use_nova_powercontrol is not defined - with_items: virtual_machines.list_vms -- name: Tell the cloud to shutdown via nova_powercontrol. - nova_powercontrol: - login_username: "{{ lookup('env',OC_OS_USERNAME'}}" - login_password: "{{ lookup('env',OC_OS_PASSWORD'}}" - login_tenant_name: "{{ lookup('env',OC_OS_TENANT_NAME'}}" - auth_url: "{{ lookup('env',OC_OS_AUTH_URL'}}" - all_instances: yes - state: stopped - when: use_nova_powercontrol is defined -- name: Pausing for 60 seconds to give VMs time to stop. - pause: seconds=60 -- name: Collect list of VMs - sudo: yes - virt: command=list_vms - register: virtual_machines - when: use_nova_powercontrol is not defined -- name: Issue graceful shutdowns - sudo: yes - virt: state=shutdown name={{item}} - when: use_nova_powercontrol is not defined - with_items: virtual_machines.list_vms - register: test_from_second_shutdown_call -- name: "Fail if virtual machines were still running" - fail: msg="If the ansible playbook has failed and exited at this point, virtual machines were still running on the compute node after sixty seconds passed from the shutdown commands having been initiated. Please retry and/or manually ensure that virtual machines on the nodes to be updated have been shut down." - when: use_nova_powercontrol is not defined and test_from_second_shutdown_call.changed == true diff --git a/playbooks/templates/heat_local.json.j2 b/playbooks/templates/heat_local.json.j2 deleted file mode 100644 index 8032e8d..0000000 --- a/playbooks/templates/heat_local.json.j2 +++ /dev/null @@ -1,12 +0,0 @@ -{ - "deployments": [], - "os-collect-config": { - "cfn": { - "stack_name": "{% stack_name %}, - "metadata_url": "{% metadata_url %}, - "access_key_id": "{% access_key_id %}, - "secret_access_key": "{% sercret_access_key %}", - "path": "{% path %}" - } - } -} diff --git a/playbooks/templates/host_metadata.json.j2 b/playbooks/templates/host_metadata.json.j2 deleted file mode 100644 index 9e559ee..0000000 --- a/playbooks/templates/host_metadata.json.j2 +++ /dev/null @@ -1 +0,0 @@ -{{ hostvars[inventory_hostname]['heat_metadata'] | to_nice_json }} diff --git a/playbooks/templates/os_config_files.json.j2 b/playbooks/templates/os_config_files.json.j2 deleted file mode 100644 index 6fdbe25..0000000 --- a/playbooks/templates/os_config_files.json.j2 +++ /dev/null @@ -1 +0,0 @@ -["/var/lib/os-collect-config/heat_local.json"] diff --git a/playbooks/update_cloud.yml b/playbooks/update_cloud.yml deleted file mode 100644 index 8032bf7..0000000 --- a/playbooks/update_cloud.yml +++ /dev/null @@ -1,536 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- include: step_ping.yml -- hosts: localhost - name: "Setup local environment for upgrade processes to run" - gather_facts: no - max_fail_percentage: 0 - tasks: - - include: update_local_ssh_config.yml -- include: step_check_image_vars.yml -- include: step_pre_hook.yml -- hosts: undercloud - name: Disable Undercloud - sudo: yes - gather_facts: no - max_fail_percentage: 0 - tasks: - - fail: "Fail if online_upgrade is defined - online upgrades are not supported on undercloud instances." - when: online_upgrade is defined - - service_facts: - when: instance_status == "ACTIVE" - - command: mv -f /etc/init/mysql.conf /etc/init/mysql-boot-control.conf removes=/etc/init/mysql.conf - when: instance_status == "ACTIVE" - - service: name={{ item }} enabled=no state=stopped - with_items: helion_undercloud_services - when: helion is defined and instance_status == "ACTIVE" and item in existing_services - - service: name={{ item }} enabled=no state=stopped - with_items: undercloud_services - when: helion is not defined and instance_status == "ACTIVE" and item in existing_services - - include: disable_os_collect_config.yml -- hosts: nova-compute - name: Disable Overcloud Compute - tags: shutdown-cloud - sudo: yes - gather_facts: no - max_fail_percentage: 0 - tasks: - - include: disable_os_collect_config.yml - - fail: "FAILURE: Cannot perform an online upgrade on nodes that are not in ACTIVE state" - when: instance_status != "ACTIVE" and online_upgrade is defined - - include: stop_vms.yml - when: instance_status == "ACTIVE" and online_upgrade is not defined - - service_facts: - when: instance_status == "ACTIVE" - - service: name={{ item }} enabled=no state=stopped - with_items: helion_overcloud_compute_services - when: helion is defined and instance_status == "ACTIVE" and item in existing_services - - service: name={{ item }} enabled=no state=stopped - with_items: overcloud_compute_services - when: helion is not defined and instance_status == "ACTIVE" and item in existing_services - - service: name=nova-compute state=stopped enabled=no - when: instance_status == "ACTIVE" - - include: step_stop_ns_metadata_proxy.yml - when: instance_status == "ACTIVE" -- hosts: swift-storage - name: swift-storage - tags: shutdown-cloud - sudo: yes - gather_facts: no - max_fail_percentage: 0 - tasks: - - include: disable_os_collect_config.yml - - fail: "Fail if online_upgrade is defined - online upgrades are not supported on swift instances." - when: online_upgrade is defined - - service_facts: - when: instance_status == "ACTIVE" - - service: name={{ item }} enabled=no state=stopped - with_items: helion_overcloud_swift_services - when: helion is defined and instance_status == "ACTIVE" and item in existing_services - - service: name={{ item }} enabled=no state=stopped - with_items: overcloud_swift_services - when: helion is not defined and instance_status == "ACTIVE" and item in existing_services -- hosts: controller - name: Disable Overcloud Controller - tags: shutdown-cloud - sudo: yes - gather_facts: no - max_fail_percentage: 0 - tasks: - - fail: "Fail if online_upgrade is defined - online upgrades are not supported on controller instances." - when: online_upgrade is defined - - service_facts: - when: instance_status == "ACTIVE" - - service: name={{ item }} enabled=no state=stopped - with_items: helion_overcloud_controller_services - when: helion is defined and instance_status == "ACTIVE" and item in existing_services - - service: name={{ item }} enabled=no state=stopped - with_items: overcloud_controller_services - when: helion is not defined and instance_status == "ACTIVE" and item in existing_services - - include: stop_tgt.yml - when: instance_status == "ACTIVE" - - include: step_stop_ns_metadata_proxy.yml - when: instance_status == "ACTIVE" -- hosts: controller-bootstrap - name: Disable Overcloud Controller Bootstrap node - tags: shutdown-cloud - sudo: yes - gather_facts: no - max_fail_percentage: 0 - tasks: - - fail: "Fail if online_upgrade is defined - online upgrades are not supported on controllerMgmt instances." - when: online_upgrade is defined - - service_facts: - when: instance_status == "ACTIVE" - - service: name={{ item }} enabled=no state=stopped - with_items: overcloud_controller_services - when: instance_status == "ACTIVE" and item in existing_services - - include: stop_tgt.yml - when: instance_status == "ACTIVE" - - include: step_stop_ns_metadata_proxy.yml - when: instance_status == "ACTIVE" -# Critically, we need to select a single node of the galera cluster to -# be the 'last'. So controller-bootstrap fits that bill for now. We will have -# to select one to be the "special" node eventually, we can do that with -# host facts and conditionals. The last to go down must have the -# Galera bootstrap run on it, or none of them will come up. -- hosts: controller - name: Stop MySQL/RabbitMQ on controller nodes - tags: shutdown-cloud - sudo: yes - gather_facts: no - max_fail_percentage: 0 - serial: 1 - tasks: - - include: galera_status.yml - when: instance_status == "ACTIVE" - - name: Stop MySQL under normal circumstances - include: stop_mysql.yml - when: instance_status == "ACTIVE" and galera_status == "Synced" and galera_cluster_size != "1" - - name: Stop MySQL if last node in cluster and single_controller flag has been set. - include: stop_mysql.yml - when: instance_status == "ACTIVE" and single_controller is defined and galera_status == "Synced" and galera_cluster_size == "1" - - fail: msg="Galera Replication is out of sync - cannot safely proceed" - when: single_controller is not defined and instance_status == "ACTIVE" and galera_status == "Out of Sync" - - fail: msg="Galera Replication - Node appears to be the last node in a cluster - cannot safely proceed unless overriden via single_controller setting - See README.rst" - when: instance_status == "ACTIVE" and single_controller is not defined and galera_cluster_size == "1" - - name: Stop RabbitMQ Application for shutdown - command: rabbitmqctl stop_app - - name: Remove the node from the RabbitMQ cluster - command: rabbitmqctl reset - - service: name=rabbitmq-server state=stopped - when: instance_status == "ACTIVE" - - name: "Waiting for MySQL to stop" - wait_for: port=3307 state=stopped timeout=60 delay=10 - when: instance_status == "ACTIVE" and helion is defined and single_controller is not defined and galera_status == 'Synced' - - name: "Waiting for rabbitmq-server to stop" - wait_for: port=5672 state=stopped timeout=60 delay=10 - when: instance_status == "ACTIVE" - - include: disable_os_collect_config.yml -- hosts: controller-bootstrap - name: Stop MySQL/RabbitMQ on Overcloud Controller Bootstrap node - tags: shutdown-cloud - sudo: yes - gather_facts: no - max_fail_percentage: 0 - tasks: - - include: galera_status.yml - when: instance_status == "ACTIVE" - - fail: msg="Galera Replication on controller Management is out of sync - cannot safely proceed" - when: instance_status == "ACTIVE" and single_controller is not defined and galera_status != "Synced" - - fail: msg="Galera Replication on controller Management - cannot safely proceed as another MySQL cluster node is active." - when: instance_status == "ACTIVE" and single_controller is not defined and galera_cluster_size != "1" - - include: stop_mysql.yml - when: instance_status == "ACTIVE" - - service: name=rabbitmq-server enabled=no state=stopped - when: instance_status == "ACTIVE" - - name: "Waiting for rabbitmq-server to stop" - wait_for: port=5672 state=stopped timeout=60 delay=10 - when: instance_status == "ACTIVE" - - include: disable_os_collect_config.yml -# On systems which had MySQL started at boot-up via os-collect-config, os-collect-config -# must be stopped after MySQL is stopped else MySQL will prematurely exit. -- hosts: undercloud:controller:controller-bootstrap:nova-compute:swift-storage:!unknown - tags: shutdown-cloud - gather_facts: no - max_fail_percentage: 0 - tasks: - - include: disable_os_collect_config.yml - when: instance_status == "ACTIVE" -- hosts: undercloud - name: Rebuild and Refresh Undercloud - gather_facts: no - max_fail_percentage: 0 - tasks: - - include: step_preserve_password_file.yml - when: instance_status == "ACTIVE" - - include: step_undercloud_backup_tftpboot.yml - when: instance_status == "ACTIVE" - - include: preserve_ssh_host_keys.yml - when: instance_status == "ACTIVE" - - include: step_unmount.yml - when: instance_status == "ACTIVE" - - { include: rebuild.yml, instance_id: "{{ instance_id }}", rebuild_image_id: "{{ undercloud_rebuild_image_id }}", when: instance_status != "REBUILD" } - - local_action: wait_for port=22 timeout="{{ ssh_timeout }}" host="{{ inventory_hostname }}" search_regex=TRIPLEO_HK_RESTORED delay=10 - when: wait_for_hostkey is defined - ignore_errors: yes - - local_action: wait_for port=22 timeout="{{ ssh_timeout }}" host="{{ inventory_hostname }}" search_regex=OpenSSH delay=10 - when: wait_for_hostkey is not defined - ignore_errors: yes - - include: refresh_config.yml -- hosts: undercloud - name: Enable Undercloud - sudo: yes - max_fail_percentage: 0 - tasks: - - service_facts: - when: instance_status == "ACTIVE" - - include: step_reset_mnt_state_permissions.yml - # Directly call os-apply-config to write out configuration files. - - include: step_os-apply-config.yml - - include: step_undercloud_restore_tftpboot.yml - - include: start_mysql.yml - - include: start_rabbitmq.yml - # Fix Ironic Reservations due to bug: - # https://bugs.launchpad.net/ironic/+bug/1382698 - - include: step_undercloud_ironic_release_reservations.yml - - include: step_run_occ.yml - - service: name={{ item }} enabled=yes state=started - with_items: helion_undercloud_services - when: helion is defined and item in existing_services - - service: name={{ item }} enabled=yes state=started - with_items: undercloud_services - when: helion is not defined and item in existing_services - - include: enable_start_os_collect_config.yml -- hosts: controller-bootstrap - name: Rebuild and Refresh controller-bootstrap - gather_facts: no - max_fail_percentage: 0 - tasks: - - include: step_preserve_password_file.yml - when: instance_status == "ACTIVE" - - include: preserve_ssh_host_keys.yml - when: instance_status == "ACTIVE" - - include: cleanup_cinder_volumes.yml - when: instance_status == "ACTIVE" - - include: step_unmount.yml - when: instance_status == "ACTIVE" - - { include: rebuild.yml, instance_id: "{{ instance_id }}", rebuild_image_id: "{{ controller_rebuild_image_id }}", when: instance_status != "REBUILD" } - - local_action: wait_for port=22 timeout="{{ ssh_timeout }}" host="{{ inventory_hostname }}" search_regex=TRIPLEO_HK_RESTORED delay=10 - when: wait_for_hostkey is defined - ignore_errors: yes - - local_action: wait_for port=22 timeout="{{ ssh_timeout }}" host="{{ inventory_hostname }}" search_regex=OpenSSH delay=10 - when: wait_for_hostkey is not defined - ignore_errors: yes - - pause: seconds=30 prompt="Allowing controller-bootstrap node to settle" -- hosts: controller-bootstrap - name: Start initial cluster node - max_fail_percentage: 0 - sudo: yes - tasks: - - include: activate_cinder_volumes.yml - - include: mysql_init_fix.yml - - include: rabbitmq_occ_disable.yml - - include: refresh_config.yml - - name: "Work around apache2 starting up at boot w/o config..." - service: name=apache2 enabled=no state=stopped - - include: step_reset_mnt_state_permissions.yml - # Directly call os-apply-config to write out configuration files. - - include: step_os-apply-config.yml - - include: step_generate_hosts_file.yml - - name: Wait for cloud-init to Complete - wait_for: path=/run/cloud-init/result.json state=present - - name: Wait for ovs-vswitchd to be started - wait_for: path=/var/run/openvswitch/ovs-vswitchd.pid state=present - - name: Wait for ovs-vswitchd to config during start-up - pause: minutes=1 - - name: Bootstrap the MySQL cluster - shell: /etc/init.d/mysql bootstrap-pxc - when: single_controller is not defined - - include: start_mysql.yml - - name: "Start keepalived if not in single_controller mode" - service: name=keepalived state=started enabled=yes - when: single_controller is not defined - - name: "Set sysctl net.ipv4.ip_nonlocal_bind for controller-bootstrap group" - sysctl: name=net.ipv4.ip_nonlocal_bind value=1 state=present - when: single_controller is not defined - - name: "Start haproxy if not in single_controller mode" - service: name=haproxy state=started enabled=yes - when: single_controller is not defined - - name: "Pause for 60 seconds if not in single_controller mode" - pause: seconds=60 prompt="Pausing for 60 seconds to allow keepalived/haproxy to enter operational states" - when: single_controller is not defined - - include: step_create_databases.yml - - include: start_rabbitmq.yml - - include: step_run_occ.yml - - name: Wait for Rabbit to listen on its usual port - wait_for: port=5672 state=started timeout=90 delay=10 - - include: mysql_access_fix.yml -- hosts: controller - name: Rebuild and Refresh Controller - gather_facts: no - max_fail_percentage: 0 - tasks: - - include: step_preserve_password_file.yml - when: instance_status == "ACTIVE" - - include: preserve_ssh_host_keys.yml - when: instance_status == "ACTIVE" - - include: step_stop_services.yml - vars: - services_to_stop: "{{ overcloud_controller_services }}" - when: instance_status == "ACTIVE" and helion is not defined - - include: step_stop_services.yml - vars: - services_to_stop: "{{ helion_overcloud_controller_services }}" - when: instance_status == "ACTIVE" and helion is defined - - include: cleanup_cinder_volumes.yml - when: instance_status == "ACTIVE" - - include: step_unmount.yml - when: instance_status == "ACTIVE" - - { include: rebuild.yml, instance_id: "{{ instance_id }}", rebuild_image_id: "{{ controller_rebuild_image_id }}", when: instance_status != "REBUILD" } - - local_action: wait_for port=22 timeout="{{ ssh_timeout }}" host="{{ inventory_hostname }}" search_regex=TRIPLEO_HK_RESTORED delay=10 - when: wait_for_hostkey is defined - ignore_errors: yes - - local_action: wait_for port=22 timeout="{{ ssh_timeout }}" host="{{ inventory_hostname }}" search_regex=OpenSSH delay=10 - when: wait_for_hostkey is not defined - ignore_errors: yes - - pause: seconds=30 prompt="Allowing controller node to settle." -- hosts: controller - name: Stop and setup for controller refresh - max_fail_percentage: 0 - sudo: yes - tasks: - - include: activate_cinder_volumes.yml - - name: "Inject Firewall rules for for MySQL to start - tcp/4444" - sudo: yes - command: /sbin/iptables -I INPUT -p tcp --dport 4444 -j ACCEPT - - name: "Inject Firewall rules for for MySQL to start - tcp/4567" - sudo: yes - command: /sbin/iptables -I INPUT -p tcp --dport 4567 -j ACCEPT - - name: "Inject Firewall rules for for MySQL to start - tcp/4568" - sudo: yes - command: /sbin/iptables -I INPUT -p tcp --dport 4568 -j ACCEPT - - name: "Ensure /var/run/rabbitmq is present" - file: path=/var/run/rabbitmq state=directory owner=rabbitmq group=rabbitmq mode=0755 - - name: "Inject Firewall rules for for RabbitMQ to start - tcp/5672" - sudo: yes - command: /sbin/iptables -I INPUT -p tcp --dport 5672 -j ACCEPT - - name: "Inject Firewall rules for for RabbitMQ to start - tcp/61000" - sudo: yes - command: /sbin/iptables -I INPUT -p tcp --dport 61000 -j ACCEPT - - name: "Inject Firewall rules for for RabbitMQ to start - tcp/4369" - sudo: yes - command: /sbin/iptables -I INPUT -p tcp --dport 4369 -j ACCEPT - # This action of stopping prior to starting is to ensure that should - # MySQL started upon boot, then it would hopefully pickup new config - # that os-collect-config and os-apply-config would have put in place. - - include: mysql_init_fix.yml - - include: rabbitmq_occ_disable.yml - - include: step_reset_mnt_state_permissions.yml - - include: refresh_config.yml - - name: "Work around apache2 starting up at boot w/o config..." - service: name=apache2 enabled=no state=stopped - # Directly call os-apply-config to write out configuration files in case - # os-collect-config has failed to reach that step. - - include: step_os-apply-config.yml - - include: step_generate_hosts_file.yml - - name: Wait for cloud-init to Complete - wait_for: path=/run/cloud-init/result.json state=present - - name: Wait for ovs-vswitchd to be started - wait_for: path=/var/run/openvswitch/ovs-vswitchd.pid state=present - - name: Wait for ovs-vswitchd to config during start-up - pause: minutes=1 - - include: start_mysql.yml - - include: mysql_access_fix.yml -- hosts: controller - name: Initiate Database Creation - max_fail_percentage: 0 - serial: 1 - sudo: yes - tasks: - - include: step_create_databases.yml -- hosts: controller - name: Complete Controller Refresh - max_fail_percentage: 0 - sudo: yes - tasks: - - include: start_rabbitmq.yml - - include: rabbitmq_rejoin_cluster.yml - - include: step_run_occ.yml - - name: Wait for Rabbit to listen on its usual port - wait_for: port=5672 state=started timeout=120 delay=10 -- hosts: controller:controller-bootstrap - name: Check RabbitMQ - max_fail_percentage: 0 - tasks: - - pause: seconds=30 prompt="Giving RabbitMQ time to start-up." - - name: Checking rabbitmq cluster status - sudo: yes - command: rabbitmqctl cluster_status - when: single_controller is not defined - - include: cleanup_rabbitmq_start.yml -- hosts: controller-bootstrap - name: Enable Overcloud controller-bootstrap - sudo: yes - max_fail_percentage: 0 - tasks: - - service_facts: - when: instance_status == "ACTIVE" - - service: name={{ item }} enabled=yes state=started - with_items: helion_overcloud_bootstrap_controller_service - when: helion is defined and item in existing_services - - include: enable_start_os_collect_config.yml -- hosts: controller - name: Enable Overcloud Controller - sudo: yes - max_fail_percentage: 0 - tasks: - - service_facts: - when: instance_status == "ACTIVE" - - service: name={{ item }} enabled=yes state=started - with_items: helion_overcloud_controller_services - when: helion is defined and item in existing_services - - service: name={{ item }} enabled=yes state=started - with_items: overcloud_controller_services - when: helion is not defined and item in existing_services - - include: enable_start_os_collect_config.yml -- hosts: swift-storage - name: Rebuild and Refresh swift-storage - gather_facts: no - max_fail_percentage: 0 - tasks: - - include: preserve_ssh_host_keys.yml - when: instance_status == "ACTIVE" - - include: step_unmount.yml - when: instance_status == "ACTIVE" - - { include: rebuild.yml, instance_id: "{{ instance_id }}", rebuild_image_id: "{{ swift_storage_rebuild_image_id }}", when: instance_status != "REBUILD" } - - local_action: wait_for port=22 timeout="{{ ssh_timeout }}" host="{{ inventory_hostname }}" search_regex=TRIPLEO_HK_RESTORED delay=10 - when: wait_for_hostkey is defined - ignore_errors: yes - - local_action: wait_for port=22 timeout="{{ ssh_timeout }}" host="{{ inventory_hostname }}" search_regex=OpenSSH delay=10 - when: wait_for_hostkey is not defined - ignore_errors: yes - - include: refresh_config.yml -- hosts: swift-storage - name: Enable Swift Storage - sudo: yes - max_fail_percentage: 0 - tasks: - - include: step_run_occ.yml - sudo: yes - - service_facts: - when: instance_status == "ACTIVE" - - service: name={{ item }} enabled=yes state=started - with_items: helion_overcloud_swift_services - sudo: yes - when: helion is defined and item in existing_services - - service: name={{ item }} enabled=yes state=started - with_items: overcloud_swift_services - sudo: yes - when: helion is not defined and item in existing_services - - include: enable_start_os_collect_config.yml -- hosts: nova-compute - name: "Download image from glance if online upgrade is being invoked" - gather_facts: no - max_fail_percentage: 0 - # This play must be executed one instance at a time as it downloads - # files to the local machine where ansible is executing. - serial: 1 - tasks: - - include: step_update_online_download_image.yml - vars: - rebuild_image_id: "{{ nova_compute_rebuild_image_id }}" - when: online_upgrade is defined -- hosts: nova-compute - name: Rebuild and Refresh Nova Compute - gather_facts: yes - max_fail_percentage: 0 - tasks: - - include: step_preserve_iscsi_initiator.yml - when: instance_status == "ACTIVE" - - include: step_preserve_password_file.yml - when: instance_status == "ACTIVE" - - include: step_update_rebuild_node.yml - vars: - instance_id: "{{ instance_id }}" - rebuild_image_id: "{{ nova_compute_rebuild_image_id }}" - when: online_upgrade is not defined - - include: step_update_online.yml - vars: - rebuild_image_id: "{{ nova_compute_rebuild_image_id }}" - when: online_upgrade is defined - - include: step_stamp_image_id.yml - vars: - rebuild_image_id: "{{ nova_compute_rebuild_image_id }}" - - include: step_cleanup_from_online_upgrade.yml - when: online_upgrade is defined -- hosts: nova-compute - name: Enable Overcloud Compute - sudo: yes - max_fail_percentage: 0 - tasks: - - include: step_os-apply-config.yml - - include: step_restore_iscsi_initiator.yml - - pause: seconds=45 prompt="Giving the compute node forty-five seconds to complete existing processes" - when: online_upgrade is not defined - # Write out config files in as we might be getting in while the - # system is starting up. - - include: step_cloud_init.yml - when: online_upgrade is defined - - name: Wait for cloud-init to Complete - wait_for: path=/run/cloud-init/result.json state=present - - name: Wait for ovs-vswitchd to be started - wait_for: path=/var/run/openvswitch/ovs-vswitchd.pid state=present - when: online_upgrade is not defined - - name: Wait for ovs-vswitchd to config during start-up - pause: minutes=1 - when: online_upgrade is not defined - - include: step_run_occ.yml - - pause: seconds=30 msg="Pausing for 30 seconds to allow services to complete start-up." - - service_facts: - when: instance_status == "ACTIVE" - - service: name={{ item }} enabled=yes state=started - with_items: helion_overcloud_compute_services - when: helion is defined and item in existing_services - - service: name={{ item }} enabled=yes state=started - with_items: overcloud_compute_services - when: helion is not defined and item in existing_services - - pause: seconds=60 prompt="Giving Open vSwitch time to reconnect" - # nova-compute should already be started, however this step explicitly sets - # the service to start upon boot. - - service: name=nova-compute state=started enabled=yes - - include: enable_start_os_collect_config.yml -- include: step_post_hook.yml diff --git a/playbooks/update_local_ssh_config.yml b/playbooks/update_local_ssh_config.yml deleted file mode 100644 index 35de515..0000000 --- a/playbooks/update_local_ssh_config.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. ---- -- name: "Patching the ssh client configuration to avoid timeout issues." - sudo: yes - script: files/patch-ssh-client-config.sh diff --git a/plugins/inventory/group_vars/all b/plugins/inventory/group_vars/all deleted file mode 100644 index af9202e..0000000 --- a/plugins/inventory/group_vars/all +++ /dev/null @@ -1,263 +0,0 @@ - -# 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. ---- -wait_for: 200 -key_name: ansible_key -#helion: True -#force_rebuild: True -wait_for_hostkey: True -os_refresh_config_folder: /usr/libexec/os-refresh-config/ -os_collect_config_log: /var/log/os-collect-config.log -# This overcloud controller list is for upstream openstack -#single_controller: True -# This option adjusts logic to enable single controllers to be upgraded -# instead of the entire controller cluster. -ssh_timeout: 900 -# Command to be run on the playbook-executing host prior to upgrade -# pre_hook_command: /bin/date -# Command to be run on the playbook-executing host after upgrade -# post_hook_command: /bin/date -# Attempt online upgrade of compute nodes -# online_upgrade: True -default_update_file_location: /tmp/update_image.qcow2 -hypervisor_daemons: - - libvirt-bin - - libvirtd -overcloud_controller_services: - - haproxy - - apache2 - - heat-api - - heat-api-cfn - - heat-api-cloudwatch - - heat-engine - - glance-api - - cinder-api - - nova-api - - keystone - - neutron-server - - swift-proxy - - glance-reg - - cinder-scheduler - - cinder-volume - - nova-scheduler - - nova-conductor - - nova-novncproxy - - nova-cert - - nova-consoleauth - - neutron-l3-agent - - neutron-metadata-agent - - neutron-dhcp-agent - - swift-object - - swift-object-auditor - - swift-object-replicator - - swift-object-updater - - swift-container - - swift-container-auditor - - swift-container-replicator - - swift-container-sync - - swift-container-updater - - swift-account - - swift-account-auditor - - swift-account-reaper - - swift-account-replicator - - swift-container - - swift-container-auditor - - swift-container-replicator - - swift-container-sync - - swift-container-updater - - ceilometer-api - - ceilometer-collector - - ceilometer-agent-notification - - snmpd - - rsync -helion_overcloud_controller_services: - - cron - - apache2 - - beaver - - cinder-api - - cinder-backup - - cinder-scheduler - - cinder-volume - - haproxy - - glance-api - - glance-reg - - heat-api - - heat-api-cfn - - heat-api-cloudwatch - - heat-engine - - neutron-dhcp-agent - - neutron-l3-agent - - neutron-metadata-agent - - neutron-server - - neutron-openvswitch-agent - - nova-api - - nova-cert - - nova-conductor - - nova-novncproxy - - nova-scheduler - - ceilometer-api - - ceilometer-collector - - snmpd - - rsync - - stunnel4 - - rsyslog - - ephemeral-ca -helion_overcloud_bootstrap_controller_services: - - cron - - apache2 - - beaver - - ceilometer-api - - ceilometer-collector - - ceilometer-agent-central - - ceilometer-agent-notification - - ceilometer-alarm-evaluator - - ceilometer-alarm-notifier - - cinder-api - - cinder-backup - - cinder-scheduler - - cinder-volume - - glance-api - - glance-reg - - heat-api - - heat-api-cfn - - heat-api-cloudwatch - - heat-engine - - nova-api - - keystone - - neutron-server - - swift-proxy - - cinder-scheduler - - nova-scheduler - - nova-cert - - nova-conductor - - nova-consoleauth - - nova-novncproxy - - neutron-l3-agent - - neutron-metadata-agent - - neutron-dhcp-agent - - neutron-openvswitch-agent - - stunnel4 - - open-iscsi - - rsyslog - - ephemeral-ca -# This overcloud compute list is for upstream openstack -overcloud_compute_services: - - neutron-openvswitch-agent - - neutron-metadata-agent - - "{{ hypervisor_daemons }}" - - snmpd -helion_overcloud_compute_services: - - beaver - - neutron-openvswitch-agent - - neutron-metadata-agent - - neutron-l3-agent - - "{{ hypervisor_daemons }}" - - open-iscsi - - stunnel4 -# This overcloud swift list is for upstream openstack -overcloud_swift_services: - - swift-account - - swift-account-auditor - - swift-account-reaper - - swift-account-replicator - - swift-container - - swift-container-auditor - - swift-container-replicator - - swift-container-sync - - swift-container-updater - - swift-object - - swift-object-auditor - - swift-object-replicator - - swift-object-updater - - swift-proxy - - snmpd -helion_overcloud_swift_services: - - beaver - - swift-account - - swift-account-auditor - - swift-account-reaper - - swift-account-replicator - - swift-container - - swift-container-auditor - - swift-container-reconciler - - swift-container-replicator - - swift-container-sync - - swift-container-updater - - swift-object - - swift-object-auditor - - swift-object-replicator - - swift-object-updater - - swift-proxy - - open-iscsi - - rsyslog - - stunnel4 -# This undercloud list is derived from upstream openstack -undercloud_services: - - os-collect-config - - apache2 - - glance-api - - heat-api - - heat-api-cfn - - heat-api-cloudwatch - - heat-engine - - ironic-api - - nova-api - - keystone - - neutron-server - - swift-proxy - - glance-reg - - nova-scheduler - - nova-conductor - - nova-novncproxy - - neutron-metadata-agent - - neutron-dhcp-agent - - ironic-conductor - - sirius-api - - logstash - - snmpd - - rabbitmq-server - - mysql -helion_undercloud_services: - - os-collect-config - - apache2 - - beaver - - glance-api - - glance-reg - - heat-api - - heat-api-cfn - - heat-api-cloudwatch - - heat-engine - - eon-api - - eon-conductor - - elasticsearch - - ironic-api - - ironic-conductor - - icinga - - neutron-server - - nova-api - - nova-compute - - nova-cert - - nova-scheduler - - nova-conductor - - nova-novncproxy - - nova-consoleauth - - neutron-dhcp-agent - - sirius-api - - open-iscsi - - logstash - - snmpd - - logstash - - neutron-openvswitch-agent - - rabbitmq-server - - mysql diff --git a/plugins/inventory/heat.py b/plugins/inventory/heat.py deleted file mode 100755 index 0aa2c2a..0000000 --- a/plugins/inventory/heat.py +++ /dev/null @@ -1,280 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. - -DOCUMENTATION = ''' ---- -inventory: heat -short_description: Heat external inventory script -description: - - Generates inventory that Ansible can understand by making API requests to - Heat and Nova API -options: - stack: - description: - - Identifier (name or ID) for heat stack to interrogate. -requirements: [ "heatclient" ] -''' - -import json -import os -import re -import sys - -from oslo.config import cfg - -opts = [ - cfg.StrOpt('host', help='List details about the specific host'), - cfg.BoolOpt('list', help='List active hosts'), - cfg.MultiStrOpt( - 'stack', - help='Stack IDs or Names to inspect', - positional=True - ), - cfg.StrOpt('username'), - cfg.StrOpt('password'), - cfg.StrOpt('auth-url'), - cfg.StrOpt('project-name'), - cfg.StrOpt('group-regex'), -] - -try: - from heatclient.v1 import client as heat_client -except ImportError: - print('heatclient is required') - sys.exit(1) -try: - from novaclient.v1_1 import client as nova_client -except ImportError: - print('novaclient is required') - sys.exit(1) - -try: - from keystoneclient.v3 import client as keystone_client -except ImportError: - print('keystoneclient is required') - sys.exit(1) - - -def _parse_config(): - default_config = os.environ.get('HEAT_INVENTORY_CONFIG') - if default_config: - default_config = [default_config] - - configs = cfg.ConfigOpts() - configs.register_cli_opts(opts) - configs(prog='heat-ansible-inventory', - default_config_files=default_config) - if configs.auth_url is None: - if "OS_AUTH_URL" in os.environ: - configs.auth_url = os.environ.get('OS_AUTH_URL') - else: - print('ERROR: auth-url not defined and OS_AUTH_URL environment variable missing, unable to proceed.') - sys.exit(1) - if configs.username is None: - if "OS_USERNAME" in os.environ: - configs.username = os.environ.get('OS_USERNAME') - if configs.password is None: - if "OS_PASSWORD" in os.environ: - configs.password = os.environ.get('OS_PASSWORD') - if configs.project_name is None: - if "OS_TENANT_NAME" in os.environ: - configs.project_name = os.environ.get('OS_TENANT_NAME') - if '/v2.0' in configs.auth_url: - configs.auth_url = configs.auth_url.replace('/v2.0', '/v3') - return configs - - -class HeatInventory(object): - def __init__(self, configs): - self.configs = configs - self._ksclient = None - self._hclient = None - self._nclient = None - - @property - def stacks(self): - if not self.configs.stack: - return self.hclient.stacks.list() - else: - return [ - self.hclient.stacks.get(stack) for stack in self.configs.stack - ] - - def list(self): - hostvars = {} - groups = {} - # XXX: need to config access details - for stack_obj in self.stacks: - if stack_obj.status != 'COMPLETE': - print("%s stack is incomplete, in state %s" % ( - stack_obj.identifier, - stack_obj.status - )) - sys.exit(1) - stack_id = stack_obj.id - for res in self.hclient.resources.list(stack_id): - if res.resource_type == 'OS::Nova::Server': - server = self.nclient.servers.get(res.physical_resource_id) - private = [ - x['addr'] for x in getattr( - server, - 'addresses' - ).itervalues().next() - if x['OS-EXT-IPS:type'] == 'fixed' - ] - if private: - private = private[0] - public = [ - x['addr'] for x in getattr( - server, - 'addresses' - ).itervalues().next() - if x['OS-EXT-IPS:type'] == 'floating'] - - if public: - public = public[0] - addr = server.accessIPv4 or public or private - groups[res.physical_resource_id] = [addr] - groups[server.name] = [addr] - if self.configs.group_regex: - group_name = re.search( - self.configs.group_regex, res.resource_name - ) - if group_name: - group_name = group_name.group(0) - if group_name in groups: - groups[group_name].append(addr) - else: - groups[group_name] = [addr] - if 'group' in server.metadata: - group_name = server.metadata['group'] - if group_name in groups: - groups[group_name].append(addr) - else: - groups[group_name] = [addr] - hostvars[addr] = { - 'heat_metadata': self.hclient.resources.metadata( - stack_id, - res.resource_name - ) - } - hostvars[addr]['instance_status'] = server.status - hostvars[addr]['instance_image_id'] = server.image['id'] - hostvars[addr]['instance_id'] = res.physical_resource_id - inventory = {'_meta': {'hostvars': hostvars}} - inventory.update(groups) - print(json.dumps(inventory, indent=2)) - - def host(self): - hostvars = {} - - for stack_obj in self.stacks: - if stack_obj.status != 'COMPLETE': - print("%s stack is incomplete, in state %s" % ( - stack_obj.identifier, - stack_obj.status - )) - sys.exit(1) - stack_id = stack_obj.id - for res in self.hclient.resources.list(stack_id): - if res.resource_type == 'OS::Nova::Server': - server = self.nclient.servers.get(res.physical_resource_id) - if self.configs.host in server.name: - hostvars = { - 'heat_metadata': self.hclient.resources.metadata( - stack_id, - res.resource_name - ) - } - hostvars['instance_status'] = server.status - hostvars['instance_image_id'] = server.image['id'] - hostvars['instance_id'] = res.physical_resource_id - print(json.dumps(hostvars, indent=2)) - break - - @property - def ksclient(self): - if self._ksclient is None: - try: - self._ksclient = keystone_client.Client( - auth_url=self.configs.auth_url, - username=self.configs.username, - password=self.configs.password, - project_name=self.configs.project_name) - self._ksclient.authenticate() - except Exception, e: - print("Error connecting to Keystone: %s" % - ( - e.message - ) - ) - sys.exit(1) - return self._ksclient - - @property - def hclient(self): - if self._hclient is None: - ksclient = self.ksclient - endpoint = ksclient.service_catalog.url_for( - service_type='orchestration', endpoint_type='publicURL') - try: - self._hclient = heat_client.Client( - endpoint=endpoint, - token=ksclient.auth_token) - except Exception, e: - print("Error connecting to Heat: %s" % - ( - e.message - ) - ) - sys.exit(1) - return self._hclient - - @property - def nclient(self): - if self._nclient is None: - ksclient = self.ksclient - endpoint = ksclient.service_catalog.url_for( - service_type='compute', endpoint_type='publicURL') - try: - self._nclient = nova_client.Client( - bypass_url=endpoint, - username=None, - api_key=None, - auth_url=self.configs.auth_url, - auth_token=ksclient.auth_token) - except Exception, e: - print("Error connecting to Nova: %s" % - ( - e.message - ) - ) - sys.exit(1) - return self._nclient - - -def main(): - configs = _parse_config() - hi = HeatInventory(configs) - if configs.list: - hi.list() - elif configs.host: - hi.host() - sys.exit(0) - -if __name__ == '__main__': - main() diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index baf7d5d..0000000 --- a/requirements.txt +++ /dev/null @@ -1,7 +0,0 @@ -oslo.config -pbr>=0.6,!=0.7,<1.0 -python-glanceclient -python-heatclient -python-keystoneclient -python-novaclient -Babel>=1.3 diff --git a/scripts/build_tarball.sh b/scripts/build_tarball.sh deleted file mode 100755 index c013f38..0000000 --- a/scripts/build_tarball.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. - -set -o pipefail -set -eu - -if [[ -z "${1:-}" ]] ; then - version=$(git show --oneline|awk 'NR==1 { print $1 }') -else - version=$1 -fi - -echo ============================= >&2 -echo Building with version=$version >&2 -echo ============================= >&2 - -output_filename="../tripleo-ansible-${version}.tar.gz" - -git archive --format=tar.gz --prefix=tripleo-ansible-${version}/ HEAD > $output_filename - -output_filename=$(readlink -f $output_filename) -echo $output_filename diff --git a/scripts/inject_nova_meta.bash b/scripts/inject_nova_meta.bash deleted file mode 100755 index 8830566..0000000 --- a/scripts/inject_nova_meta.bash +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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. -# Example -#+--------------------------------------+------------------------------------------------------+--------+------------+-------------+---------------------+ -#| ID | Name | Status | Task State | Power State | Networks | -#+--------------------------------------+------------------------------------------------------+--------+------------+-------------+---------------------+ -#| adab0d97-9777-4a10-a77a-461e2dfbf0b2 | overcloud-ce-controller-SwiftStorage0-gymliwipqeo2 | ACTIVE | - | Running | ctlplane=192.0.2.21 | -#| 23732305-9e2b-496e-be03-e8ba2b45ffe5 | overcloud-ce-controller-SwiftStorage1-u2r34etwyko6 | ACTIVE | - | Running | ctlplane=192.0.2.24 | -#| 2b17ed0f-d656-41f1-be10-c5a0bb0c3fa5 | overcloud-ce-controller-controller0-wheouferu4ao | ACTIVE | - | Running | ctlplane=192.0.2.27 | -#| 8e080a04-a238-411f-ac7a-754f40ef275b | overcloud-ce-controller-controller1-kt344n4a3ipe | ACTIVE | - | Running | ctlplane=192.0.2.26 | -#| 31c530df-256e-4173-aae8-b4b45c8f8a8a | overcloud-ce-controller-controller2-43lsrcv46e3y | ACTIVE | - | Running | ctlplane=192.0.2.25 | -#| 616a326d-015c-4a2a-979e-294bf322f50d | overcloud-ce-novacompute1-NovaCompute1-yz5gbaptuja3 | ACTIVE | - | Running | ctlplane=192.0.2.28 | -#+--------------------------------------+------------------------------------------------------+--------+------------+-------------+---------------------+ -# Quick and dirty tool to set nova meta based on server names. -set -x - -function get_bootstrap_node() { - IP=$1 - is_bootstrap=$(ssh -n heat-admin@$IP -o StrictHostKeyChecking=no \ - -o UserKnownHostsFile=/dev/null \ - sudo /usr/local/bin/os-is-bootstrap-host; echo $?) - if [ $is_bootstrap -eq 0 ]; then - group="controller-bootstrap" - fi -} - -while read -r instance; do - ID=$(echo $instance | awk '{print $2}') - NAME=$(echo $instance | awk '{print $4}') - IP=$(echo $instance | awk '{print $12}' | sed s/ctlplane=//) - - case $NAME in - *SwiftStorage*) - group="swift-storage" - ;; - *controller*) - group="controller" - get_bootstrap_node $IP - ;; - *NovaCompute*) - group="nova-compute" - ;; - *undercloud*) - group="undercloud" - ;; - *) - group="unknown" - ;; - esac - nova meta $ID set group=$group -done < <(nova list | grep -e 'overcloud' -e 'undercloud') diff --git a/scripts/populate_image_vars b/scripts/populate_image_vars deleted file mode 100755 index 47616c2..0000000 --- a/scripts/populate_image_vars +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. -# -# 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 argparse -import json -import os -import subprocess -import sys -import tempfile -import yaml - -# # Example -# +--------------------------------------+---------------------------+-------------+------------------+------------+--------+ -# | ID | Name | Disk Format | Container Format | Size | Status | -# +--------------------------------------+---------------------------+-------------+------------------+------------+--------+ -# | 2b98a88d-d79e-4a2f-87c1-c8c76c690092 | bm-deploy-kernel | aki | aki | 3170560 | active | -# | 3d2b01b0-bf7a-4000-8d56-cfd1131c32bc | bm-deploy-ramdisk | ari | ari | 22778117 | active | -# | 3dc11dba-f639-42f1-8d54-d8f08268bd25 | overcloud-compute | qcow2 | bare | 614817792 | active | -# | 3276eef3-d128-4ab6-899f-af9201145505 | overcloud-compute-initrd | ari | ari | 9963568 | active | -# | 7cfb3aa9-3f6c-4f20-80a4-9d4694641dec | overcloud-compute-vmlinuz | aki | aki | 3170560 | active | -# | cef3732c-1c6a-4182-8a6e-3960a1acf99e | overcloud-control | qcow2 | bare | 1062666240 | active | -# | a8126d25-305c-47d9-a27e-7fbc3d92bb7d | overcloud-control-initrd | ari | ari | 10726940 | active | -# | c1602866-0664-49f5-b3f8-97dc936dc198 | overcloud-control-vmlinuz | aki | aki | 3170560 | active | -# | 25a6637e-71b3-4bff-95ca-a1a08582c801 | overcloud-swift | qcow2 | bare | 387252224 | active | -# | 1932f035-725f-40b1-827d-20da22686df1 | overcloud-swift-initrd | ari | ari | 9963824 | active | -# | 40d536b3-a0f8-4d33-8077-521db986de5f | overcloud-swift-vmlinuz | aki | aki | 3170560 | active | -# +--------------------------------------+---------------------------+-------------+------------------+------------+--------+ - -def image_list(): - # Using subprocess to avoid glanceclient dep for now - glance_list = subprocess.Popen( - ['glance', 'image-list'], - stdout=subprocess.PIPE - ) - for line in glance_list.stdout: - if line[0] != '|': - continue - if line[2:5] == 'ID ': - continue - (image_id, name, image_type) = [ - x.strip() for x in line.split('|', 4)[1:4] - ] - if image_type != 'qcow2': - continue - yield (image_id, name, image_type) - glance_list.wait() - - -def name_to_class(name): - bits = name.split('-', 1) - stack = bits.pop(0) - new_bits = [] - buildnum = None - # this try-catch block is "intuitively obvious". we use it to find - # the build number by testing for whether we can str->int on that - # part of the name. this keeps "control-mgmt" from being split up in - # the method output. - for bit in bits: - try: - buildnum = int(bit) - except ValueError: - new_bits.append(bit) - if len(new_bits) == 0: - # use stack name if all else fails - return (stack, buildnum) - if new_bits == ['compute']: - return ('nova-compute', buildnum) - if new_bits == ['control']: - return ('controller', buildnum) - if new_bits == ['swift']: - return ('swift-storage', buildnum) - return ('-'.join(new_bits), buildnum) - - -def find_images(target_buildnum=None): - mapping = {} - for (image_id, name, image_type) in image_list(): - (image_class, buildnum) = name_to_class(name) - if image_class in mapping: - if target_buildnum is None: - if mapping[image_class]['buildnum'] >= buildnum: - continue - else: - if buildnum != target_buildnum: - continue - mapping[image_class] = {'buildnum': buildnum, 'id': image_id} - return mapping - - -def keys_to_variables(k, v): - variable_name = '%s_rebuild_image_id' % k.replace('-', '_').lower() - value = v['id'] - return {variable_name: value} - - -def parse_args(argv): - parser = argparse.ArgumentParser() - parser.add_argument('buildnum', type=int, nargs='?', - help='Build number, if left out will take highest. ' - 'If the build is not found, an existing ' - 'image that matches a class will be used.') - parser.add_argument('--output-dir', default='plugins/inventory/group_vars') - return parser.parse_args(argv[1:]) - - -def main(argv): - args = parse_args(argv) - images = find_images(target_buildnum=args.buildnum) - if not images: - print('ERROR: no images found, aborting') - return 2 - print(json.dumps(images, indent=4)) - for k, v in iter(images.items()): - if k == 'all': - continue - the_vars = keys_to_variables(k, v) - output_path = os.path.join(args.output_dir, k) - if os.path.exists(output_path): - print('... Editing %s' % output_path) - with open(output_path, 'r') as input_file: - existing = yaml.load(input_file.read()) - else: - print('... Creating %s' % output_path) - existing = {} - existing.update(the_vars) - prefix = '.%s' % k - with tempfile.NamedTemporaryFile( - prefix=prefix, - dir=args.output_dir, - delete=False - ) as out: - out.write(yaml.dump(existing, default_flow_style=False)) - os.rename(out.name, output_path) - # The conditionals and resulting symlink below is to support the - # execution of the playbook steps with-in the bootstrap node context - # when a user utilizes this script and does not define the controller - # disk image id as a global variable on the playbook command line. - if os.path.isfile(os.path.join( - args.output_dir, - 'controller' - )) and not os.path.islink(os.path.join( - args.output_dir, - 'controller-bootstrap')): - os.symlink( - 'controller', - os.path.join(args.output_dir, 'controller-bootstrap') - ) - - -if __name__ == '__main__': - sys.exit(main(sys.argv)) diff --git a/scripts/retrieve_oc_vars b/scripts/retrieve_oc_vars deleted file mode 100644 index a662af9..0000000 --- a/scripts/retrieve_oc_vars +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -eux -# Execute from the tripleo-ansible folder -ansible $(heat output-show overcloud controller0IP|sed s/\"//g) -s -u heat-admin -m fetch -a "dest=/root/oc-stackrc src=/root/stackrc flat=yes" -i plugins/inventory/heat.py -cat /root/oc-stackrc | sed s/OS_/OC_OS_/ > /root/oc-stackrc-tripleo-ansible - -echo " **** Before Proceeding, Execute: source /root/oc-stackrc-tripleo-ansible" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b90d66e..0000000 --- a/setup.cfg +++ /dev/null @@ -1,46 +0,0 @@ -[metadata] -name = tripleo-ansible -summary = Ansible in TripleO -description-file = - README.rst -author = OpenStack -author-email = openstack-dev@lists.openstack.org -home-page = http://www.openstack.org/ -classifier = - Environment :: OpenStack - Intended Audience :: Information Technology - Intended Audience :: System Administrators - License :: OSI Approved :: Apache Software License - Operating System :: POSIX :: Linux - Programming Language :: Python - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 - Programming Language :: Python :: 2.6 - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.3 - -[files] -packages = - tripleo_ansible - -[build_sphinx] -source-dir = doc/source -build-dir = doc/build -all_files = 1 - -[upload_sphinx] -upload-dir = doc/build/html - -[compile_catalog] -directory = tripleo_ansible/locale -domain = tripleo-ansible - -[update_catalog] -domain = tripleo-ansible -output_dir = tripleo_ansible/locale -input_file = tripleo_ansible/locale/tripleo-ansible.pot - -[extract_messages] -keywords = _ gettext ngettext l_ lazy_gettext -mapping_file = babel.cfg -output_file = tripleo_ansible/locale/tripleo-ansible.pot \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100755 index 70c2b3f..0000000 --- a/setup.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. -# -# 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. - -# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT -import setuptools - -setuptools.setup( - setup_requires=['pbr'], - pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt deleted file mode 100644 index aaae73b..0000000 --- a/test-requirements.txt +++ /dev/null @@ -1,11 +0,0 @@ -hacking>=0.9.2,<0.10 - -coverage>=3.6 -discover -fixtures>=0.3.14 -python-subunit -sphinx>=1.1.2 -oslosphinx -testrepository>=0.0.18 -testscenarios>=0.4 -testtools>=0.9.34 \ No newline at end of file diff --git a/test.sh b/test.sh deleted file mode 100755 index 806ed0c..0000000 --- a/test.sh +++ /dev/null @@ -1,152 +0,0 @@ -#!/bin/bash - -set -eu -set -o pipefail - -SCRIPT_NAME=$(basename $0) - -function show_options { - echo "Usage: $SCRIPT_NAME [options]" - echo - echo "Options:" - echo " -h -- This help" - echo " -c -- Use pre-existing images for TripleO" - echo " -s -- Skip redeployment of TripleO" - exit $1 -} - -OPTS=$(getopt -o c,h,s -n $SCRIPT_NAME -- "$@") - -eval set -- ${OPTS} -while true ; do - case "$1" in - -c) USE_CACHE='-c'; shift 1;; - -s) SKIP_DEPLOY='0'; shift 1;; - -h) show_options 0;; - --) shift ; break ;; - *) echo "Error: unsupported option $1." ; show_options 1;; - esac -done - -set -x - -# Variables -export TRIPLEO_ROOT=${TRIPLEO_ROOT:-"~/tripleo_root"} -export DIB_COMMON_ELEMENTS="stackuser use-ephemeral restore-ssh-host-keys disable-os-collect-config" -export TE_DATAFILE="$TRIPLEO_ROOT/te_datafile.json" -export USE_CACHE=${USE_CACHE:-''} -export SKIP_DEPLOY=${SKIP_DEPLOY:-'1'} - -# Functions -function purge_known_hosts { - local NETWORK=$(os-apply-config -m $TE_DATAFILE --key baremetal-network.cidr --type raw --key-default '192.0.2.0/24'|cut -f 1-3 -d.) - for i in {1..254}; do - ssh-keygen -R ${NETWORK}.$i; - done -} - -function deploy_tripleo { - local USE_CACHED_IMAGES=${1:-''} - - if [ -z ${USE_CACHED_IMAGES} ]; then - if [ -d "${TRIPLEO_ROOT}/tripleo-incubator" ]; then - pushd ${TRIPLEO_ROOT}/tripleo-incubator - git checkout master - git pull --ff-only - else - pushd ${TRIPLEO_ROOT} - git clone https://git.openstack.org/openstack/tripleo-incubator - fi - popd - fi # End if USE_CACHED_IMAGES - - # Build TripleO - pushd ${TRIPLEO_ROOT} - purge_known_hosts - ./tripleo-incubator/scripts/devtest.sh --trash-my-machine ${USE_CACHED_IMAGES} - popd -} # End deploy_tripleo - -function run_upgrade_sequence { - echo "Tagging hosts with metadata in order to execute the update." - ./scripts/inject_nova_meta.bash - echo "Populating vars" - ./scripts/populate_image_vars - - # Attempt to connect to all hosts in order to add any unknown keys - # as to not prompt during the upgrade sequence - echo "Testing connectivity to all nodes" - ANSIBLE_HOST_KEY_CHECKING=False ansible -o -i plugins/inventory/heat.py -u heat-admin -m ping all - - echo "Executing pre-flight check" - ansible-playbook -vvvv -i plugins/inventory/heat.py -u heat-admin playbooks/pre-flight_check.yml - - echo "Executing upgrade sequence" - ansible-playbook -vvvv -i plugins/inventory/heat.py -u heat-admin playbooks/update_cloud.yml -e force_rebuild=true - -} # End run_upgrade_sequence - -function run_compute_online_upgrade { - date - echo "Executing upgrade sequence" - ansible-playbook -vvvv -i plugins/inventory/heat.py -u heat-admin playbooks/update_cloud.yml -e force_rebuild=true -e online_upgrade=true -l nova-compute -} - -function restart_demo_vm { - date - source $TRIPLEO_ROOT/tripleo-incubator/overcloudrc - nova list --all-tenants - sleep 300 - nova list --all-tenants - local INSTANCE_ID=$(nova --os-tenant-name demo list --name demo --minimal|grep demo |awk '{print $2}') - nova start ${INSTANCE_ID} -} - -function ping_demo_vm { - date - source $TRIPLEO_ROOT/tripleo-incubator/overcloudrc - local FLOATING_IP=$(neutron --os-tenant-name demo floatingip-list -f csv -c floating_ip_address| awk -F'"' 'ENDFILE {print $2}') - wait_for -w 600 -d 10 -- ping -c 1 ${FLOATING_IP} - date -} - -# Main - -# Load TripleO variables -source $TRIPLEO_ROOT/tripleo-incubator/scripts/devtest_variables.sh - -# Deploy TripleO to the local system. -if [ ${SKIP_DEPLOY} -eq 1 ]; then - deploy_tripleo ${USE_CACHE} -fi - -# TODO: Place files on the ephemeral disk space to check the existance of after the upgrade. -# TODO: Check files on the ephemeral disk -# TODO: Consider cinder volume attachment -# TODO: Consider updating images in glance with a marker file to ensure that the new image is deployed. - -# Load seed credentials and upgrade the undercloud! -source ${TRIPLEO_ROOT}/tripleo-incubator/seedrc -run_upgrade_sequence - -# Load undercloud credentials and update the overcloud! -source ${TRIPLEO_ROOT}/tripleo-incubator/undercloudrc -run_upgrade_sequence - -# Wait 5 minutes -sleep 300 - -# TODO: Repeat ephermeral disk file creation/check -restart_demo_vm -# Ping the demo VM after the upgrade -ping_demo_vm - -# TODO: Consider testing rebuild of demo VM, but check code path for ironic. - -# Execute an online upgrade of the compute node -source ${TRIPLEO_ROOT}/tripleo-incubator/undercloudrc -run_compute_online_upgrade - -# Attempt to ping the demo VM after the online upgrade attempt on the compute -# node -ping_demo_vm diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 661c846..0000000 --- a/tox.ini +++ /dev/null @@ -1,34 +0,0 @@ -[tox] -minversion = 1.6 -envlist = py33,py26,py27,pypy,pep8 -skipsdist = True - -[testenv] -usedevelop = True -install_command = pip install -U {opts} {packages} -setenv = - VIRTUAL_ENV={envdir} -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt -commands = python setup.py testr --slowest --testr-args='{posargs}' - -[testenv:pep8] -commands = flake8 - -[testenv:venv] -commands = {posargs} - -[testenv:cover] -commands = python setup.py testr --coverage --testr-args='{posargs}' - -[testenv:docs] -commands = python setup.py build_sphinx - -[flake8] -# H803 skipped on purpose per list discussion. -# E123, E125 skipped as they are invalid PEP-8. - -show-source = True -ignore = E123,E125,H803 -builtins = _ -exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build \ No newline at end of file diff --git a/tripleo_ansible/__init__.py b/tripleo_ansible/__init__.py deleted file mode 100644 index 6b863e5..0000000 --- a/tripleo_ansible/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# 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 pbr.version - - -__version__ = pbr.version.VersionInfo( - 'tripleo_ansible').version_string() diff --git a/tripleo_ansible/tests/__init__.py b/tripleo_ansible/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tripleo_ansible/tests/base.py b/tripleo_ansible/tests/base.py deleted file mode 100644 index 3bf12a8..0000000 --- a/tripleo_ansible/tests/base.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2010-2011 OpenStack Foundation -# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. -# -# 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 os - -import fixtures -import testtools - -_TRUE_VALUES = ('True', 'true', '1', 'yes') - - -class TestCase(testtools.TestCase): - - """Test case base class for all unit tests.""" - - def setUp(self): - """Run before each test method to initialize test environment.""" - - super(TestCase, self).setUp() - test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0) - try: - test_timeout = int(test_timeout) - except ValueError: - # If timeout value is invalid do not set a timeout. - test_timeout = 0 - if test_timeout > 0: - self.useFixture(fixtures.Timeout(test_timeout, gentle=True)) - - self.useFixture(fixtures.NestedTempfile()) - self.useFixture(fixtures.TempHomeDir()) - - if os.environ.get('OS_STDOUT_CAPTURE') in _TRUE_VALUES: - stdout = self.useFixture(fixtures.StringStream('stdout')).stream - self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout)) - if os.environ.get('OS_STDERR_CAPTURE') in _TRUE_VALUES: - stderr = self.useFixture(fixtures.StringStream('stderr')).stream - self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr)) - - self.log_fixture = self.useFixture(fixtures.FakeLogger()) \ No newline at end of file diff --git a/tripleo_ansible/tests/test_tripleo_ansible.py b/tripleo_ansible/tests/test_tripleo_ansible.py deleted file mode 100644 index 3b74757..0000000 --- a/tripleo_ansible/tests/test_tripleo_ansible.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- - -# 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. - -""" -test_tripleo_ansible ----------------------------------- - -Tests for `tripleo_ansible` module. -""" - -from tripleo_ansible.tests import base - - -class TestTripleo_ansible(base.TestCase): - - def test_something(self): - pass \ No newline at end of file