Remove plan parameter update playbook
This also removes the modules ``tripleo_reset_params`` module that was used to reset parameters in plan and changed ``tripleo_derived_parameters`` role to not try and update the plan with derived parameters. Change-Id: I9b087452ef56b9ff53d08406158d8e1e5a3328f0
This commit is contained in:
parent
ad5a1f9577
commit
12c7014aeb
|
@ -1,14 +0,0 @@
|
||||||
=============================
|
|
||||||
Module - tripleo_reset_params
|
|
||||||
=============================
|
|
||||||
|
|
||||||
|
|
||||||
This module provides for the following ansible plugin:
|
|
||||||
|
|
||||||
* tripleo_reset_params
|
|
||||||
|
|
||||||
|
|
||||||
.. ansibleautoplugin::
|
|
||||||
:module: tripleo_ansible/ansible_plugins/modules/tripleo_reset_params.py
|
|
||||||
:documentation: true
|
|
||||||
:examples: true
|
|
|
@ -93,12 +93,6 @@ EXAMPLES = '''
|
||||||
debug:
|
debug:
|
||||||
msg: "{{ derived_parameters_result['derived_parameters']['ComputeHCIParameters']['NovaCPUAllocationRatio'] }}"
|
msg: "{{ derived_parameters_result['derived_parameters']['ComputeHCIParameters']['NovaCPUAllocationRatio'] }}"
|
||||||
|
|
||||||
- name: Update deployment plan with derived_parameters
|
|
||||||
tripleo_plan_parameters_update:
|
|
||||||
container: "{{ plan }}"
|
|
||||||
parameter_key: 'derived_parameters'
|
|
||||||
parameters: "{{ derived_parameters_result['derived_parameters'] }}"
|
|
||||||
validate: true
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
|
|
|
@ -1,98 +0,0 @@
|
||||||
# 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.
|
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible.module_utils import tripleo_common_utils as tc
|
|
||||||
from ansible.module_utils.openstack import openstack_full_argument_spec
|
|
||||||
from ansible.module_utils.openstack import openstack_module_kwargs
|
|
||||||
from ansible.module_utils.openstack import openstack_cloud_from_module
|
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = """
|
|
||||||
---
|
|
||||||
module: tripleo_reset_params
|
|
||||||
short_description: Reset params
|
|
||||||
extends_documentation_fragment: openstack
|
|
||||||
author:
|
|
||||||
- "Kevin Carter (@cloudnull)"
|
|
||||||
version_added: "2.10"
|
|
||||||
description:
|
|
||||||
- This method will reset params for a given parmeter key.
|
|
||||||
options:
|
|
||||||
container:
|
|
||||||
description:
|
|
||||||
- Name of plan / container
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
parameter_key:
|
|
||||||
description:
|
|
||||||
- Heat parameter key
|
|
||||||
type: str
|
|
||||||
default: parameter_defaults
|
|
||||||
requirements: ["openstacksdk", "tripleo-common"]
|
|
||||||
"""
|
|
||||||
|
|
||||||
EXAMPLES = """
|
|
||||||
- name: configure boot
|
|
||||||
tripleo_reset_params:
|
|
||||||
cloud: undercloud
|
|
||||||
container: overcloud
|
|
||||||
parameter_key: parameter_defaults
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
import yaml
|
|
||||||
|
|
||||||
from tripleo_common.utils import stack_parameters as stack_param_utils
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
result = dict(
|
|
||||||
success=False,
|
|
||||||
changed=False,
|
|
||||||
error=None,
|
|
||||||
)
|
|
||||||
module = AnsibleModule(
|
|
||||||
openstack_full_argument_spec(
|
|
||||||
**yaml.safe_load(DOCUMENTATION)['options']
|
|
||||||
),
|
|
||||||
**openstack_module_kwargs()
|
|
||||||
)
|
|
||||||
_, conn = openstack_cloud_from_module(module)
|
|
||||||
tripleo = tc.TripleOCommon(session=conn.session)
|
|
||||||
object_client = tripleo.get_object_client()
|
|
||||||
try:
|
|
||||||
stack_param_utils.reset_parameters(
|
|
||||||
swift=object_client,
|
|
||||||
container=module.params["container"],
|
|
||||||
key=module.params["parameter_key"]
|
|
||||||
)
|
|
||||||
result['changed'] = True
|
|
||||||
except Exception as exp:
|
|
||||||
result['error'] = str(exp)
|
|
||||||
result['msg'] = 'Error resetting params for plan {}: {}'.format(
|
|
||||||
module.params["container"],
|
|
||||||
exp
|
|
||||||
)
|
|
||||||
module.fail_json(**result)
|
|
||||||
else:
|
|
||||||
result['success'] = True
|
|
||||||
module.exit_json(**result)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
|
@ -1,47 +0,0 @@
|
||||||
---
|
|
||||||
# Copyright 2019 Red Hat, Inc.
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
- name: Update Parameters
|
|
||||||
connection: "{{ (tripleo_target_host is defined) | ternary('ssh', 'local') }}"
|
|
||||||
hosts: "{{ tripleo_target_host | default('localhost') }}"
|
|
||||||
remote_user: "{{ tripleo_target_user | default(lookup('env', 'USER')) }}"
|
|
||||||
gather_facts: "{{ (tripleo_target_host is defined) | ternary(true, false) }}"
|
|
||||||
any_errors_fatal: true
|
|
||||||
vars:
|
|
||||||
container: overcloud
|
|
||||||
parameter_key: parameter_defaults
|
|
||||||
validate: true
|
|
||||||
|
|
||||||
pre_tasks:
|
|
||||||
- name: Check for required inputs
|
|
||||||
fail:
|
|
||||||
msg: >-
|
|
||||||
Required input `parameters` is undefined.
|
|
||||||
when:
|
|
||||||
- parameters is undefined
|
|
||||||
|
|
||||||
- name: Set parameters fact
|
|
||||||
set_fact:
|
|
||||||
rendered_parameters: "{{ parameters }}"
|
|
||||||
run_once: true
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- name: Update parameters
|
|
||||||
tripleo_plan_parameters_update:
|
|
||||||
container: "{{ container }}"
|
|
||||||
parameters: "{{ rendered_parameters }}"
|
|
||||||
parameter_key: "{{ parameter_key }}"
|
|
||||||
validate: "{{ validate }}"
|
|
|
@ -214,23 +214,3 @@
|
||||||
when:
|
when:
|
||||||
- derived_parameters_result is defined
|
- derived_parameters_result is defined
|
||||||
- derived_parameters_result|length >0
|
- derived_parameters_result|length >0
|
||||||
|
|
||||||
- name: Update derived params block
|
|
||||||
when:
|
|
||||||
- derived_parameters_result is defined
|
|
||||||
- derived_parameters_result|length >0
|
|
||||||
- tripleo_plan_name is defined
|
|
||||||
- tripleo_plan_name|length >0
|
|
||||||
- derived_parameters_result['derived_parameters'] is defined
|
|
||||||
block:
|
|
||||||
- name: Reset params
|
|
||||||
tripleo_reset_params:
|
|
||||||
container: "{{ tripleo_plan_name }}"
|
|
||||||
parameter_key: derived_parameters
|
|
||||||
|
|
||||||
- name: Update derive_parameters in plan
|
|
||||||
tripleo_plan_parameters_update:
|
|
||||||
container: "{{ tripleo_plan_name }}"
|
|
||||||
parameter_key: 'derived_parameters'
|
|
||||||
parameters: "{{ derived_parameters_result['derived_parameters'] }}"
|
|
||||||
validate: true
|
|
||||||
|
|
Loading…
Reference in New Issue