From b4c22dfff7cf4bac4d1b77af12e89ca82301b978 Mon Sep 17 00:00:00 2001 From: pkomarov Date: Thu, 21 Dec 2017 23:33:06 +0200 Subject: [PATCH] Adds InfraRed plugin support for Instance-Ha deployment on OpenStack Change-Id: Ib4f3a1f3953339dcebb62bd4cced688d5d9e039b --- infrared/README.md | 52 +++++++++++++++++++ infrared/infrared_instance-ha_plugin_main.yml | 32 ++++++++++++ plugin.spec | 37 +++++++++++++ 3 files changed, 121 insertions(+) create mode 100644 infrared/README.md create mode 100644 infrared/infrared_instance-ha_plugin_main.yml create mode 100644 plugin.spec diff --git a/infrared/README.md b/infrared/README.md new file mode 100644 index 0000000..3eade8b --- /dev/null +++ b/infrared/README.md @@ -0,0 +1,52 @@ +Infrared Intance-ha Plugin Playbook +==================================== + +This Plugin deploys Instance-Ha on OpenStack using InfraRed + +The Tasks in infrared_instance-ha_plugin_main.yml, along with the +plugin.spec at tripleo-quickstart-utils/plugin.spec provide support +for running this repo's roles and playbooks as an Infrared plugin. + +[InfraRed](http://infrared.readthedocs.io/en/stable/) is a plugin based system + that aims to provide an easy-to-use CLI for Ansible based projects and + OpenStack deployment. + +The plugin provides infrared plugin integration for +two OpenStack High-Availability features: + + [instance-ha](https://github.com/redhat-openstack/tripleo-quickstart-utils/tree/master/roles/instance-ha) + + [stonith-config](https://github.com/redhat-openstack/tripleo-quickstart-utils/tree/master/roles/stonith-config) + +Usage: +===== + +**Installation and deployment:** + +[Setup InfraRed](http://infrared.readthedocs.io/en/stable/bootstrap.html) + +ir plugin add https://github.com/redhat-openstack/tripleo-quickstart-utils + +export ANSIBLE_ROLES_PATH='plugins/tripleo-quickstart-utils/roles' + +ir instance-ha-deploy -v --release 12 --stonith_devices all + +*notice: a fail & warning will be issued if the plugin's specific ANSIBLE_ROLES_PATH is not defined * + + +**Plugin help:** + +ir instance-ha-deploy -h + + +**Plugin Uninstall:** + +ir plugin remove instance-ha-deploy + + + + +Author Information +------------------ + +Pini Komarov pkomarov@redhat.com \ No newline at end of file diff --git a/infrared/infrared_instance-ha_plugin_main.yml b/infrared/infrared_instance-ha_plugin_main.yml new file mode 100644 index 0000000..427fb37 --- /dev/null +++ b/infrared/infrared_instance-ha_plugin_main.yml @@ -0,0 +1,32 @@ +--- +- name: check ANSIBLE_ROLES_PATH variable + hosts: localhost + tasks: + + - shell: | + echo $ANSIBLE_ROLES_PATH + name: check $ANSIBLE_ROLES_PATH variable + register: ansible_roles_path_out + + - fail: + msg: Please export ANSIBLE_ROLES_PATH='plugins/tripleo-quickstart-utils/roles' ; Before running this playbook with infrared. + when: '"tripleo-quickstart-utils" not in ansible_roles_path_out.stdout' + + + +- name: Configure Instance HA + hosts: undercloud + gather_facts: yes + + tasks: + + - include_role: + name: instance-ha + + vars: + + instance_ha_action: '{{ install.instance_ha_action }}' + release: '{{ install.release }}' + stonith_devices: '{{ install.stonith_devices }}' + instance_ha_shared_storage: '{{ install.instance_ha_shared_storage }}' + diff --git a/plugin.spec b/plugin.spec new file mode 100644 index 0000000..4876089 --- /dev/null +++ b/plugin.spec @@ -0,0 +1,37 @@ +--- +config: + entry_point: ./infrared/infrared_instance-ha_plugin_main.yml + plugin_type: install +subparsers: + instance-ha-deploy: + description: Collection of instance-ha configuration tasks + include_groups: ["Ansible options", "Inventory", "Common options", "Answers file"] + groups: + + - title: Instance HA + options: + instance_ha_action: + type: Value + default: install + help: | + Can be 'install' or 'uninstall' + + release: + type: Value + help: | + A rhos release - version_number. + Example: "rhos-10". + required: yes + stonith_devices: + type: Value + default: controllers + help: | + Can be all, controllers or computes + + instance_ha_shared_storage: + type: Bool + help: | + Do we have a shared storage or not? + default: False + +