openstack-ansible-os_ceilom.../vars/main.yml
Jesse Pretorius 9e96b65126 Source template files from git or deploy host
Instead of sourcing the paste/policy files from the role,
the deploy host will first be checked, then the git source.

The current mechanism uses a lookup, causing the fetch of
the default templates to happen via curl from the deployment
node. This causes problems if the deployment node does not
have access to the repo server web service, which may be the
case in high security environments.

This patch changes the mechanism to only use the lookup
module for the file content that is on the deployment node,
then falls back to using the uri module to fetch the default
content. This ensures that the deployment node does not have
to reach into the environment for the content.

Additionally, the following variables and related tasks are
removed as the files they applied to no longer exist in the
source git repository:
- ceilometer_event_definitions_yaml_overrides
- ceilometer_event_pipeline_yaml_overrides

The pattern applied is the same as that used in the
combination of the following two reference patches:
- https://review.openstack.org/446235
- https://review.openstack.org/463390

The rootwrap.conf template is re-added because it cannot be
used verbatim from the upstream repository. It requires the
addition of the service venv bin in the exec_dirs. A mechanism
to implement this dynamically will be figured out in a later
review along with an implementation which will fetch the
rootwrap files directly from the git source too.

Change-Id: I248910a544f611b590bc93449aea98434802cae3
2017-05-19 16:12:28 +00:00

37 lines
3.0 KiB
YAML

---
# Copyright 2017, Rackspace US, Inc.
#
# 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 vars find a file on the deployment node, if it exists - otherwise the result is empty.
ceilometer_api_paste_user_content: "{{ lookup('pipe', 'cat ' ~ ceilometer_api_paste_default_file_path ~ ' 2>/dev/null || true') }}"
ceilometer_gnocchi_resources_user_content: "{{ lookup('pipe', 'cat ' ~ ceilometer_gnocchi_resources_default_file_path ~ ' 2>/dev/null || true') }}"
ceilometer_loadbalancer_v2_meter_definitions_user_content: "{{ lookup('pipe', 'cat ' ~ ceilometer_loadbalancer_v2_meter_definitions_default_file_path ~ ' 2>/dev/null || true') }}"
ceilometer_osprofiler_event_definitions_user_content: "{{ lookup('pipe', 'cat ' ~ ceilometer_osprofiler_event_definitions_default_file_path ~ ' 2>/dev/null || true') }}"
ceilometer_policy_user_content: "{{ lookup('pipe', 'cat ' ~ ceilometer_policy_default_file_path ~ ' 2>/dev/null || true') }}"
ceilometer_polling_user_content: "{{ lookup('pipe', 'cat ' ~ ceilometer_polling_default_file_path ~ ' 2>/dev/null || true') }}"
# These vars find the appropriate result content from the with_items loop
ceilometer_api_paste_default_content: |
{{ _git_file_fetch.results | selectattr('item', 'equalto', ceilometer_git_config_lookup_location ~ '/' ~ ceilometer_api_paste_git_file_path) | map(attribute='content') | first }}
ceilometer_gnocchi_resources_default_content: |
{{ _git_file_fetch.results | selectattr('item', 'equalto', ceilometer_git_config_lookup_location ~ '/' ~ ceilometer_gnocchi_resources_git_file_path) | map(attribute='content') | first }}
ceilometer_loadbalancer_v2_meter_definitions_default_content: |
{{ _git_file_fetch.results | selectattr('item', 'equalto', ceilometer_git_config_lookup_location ~ '/' ~ ceilometer_loadbalancer_v2_meter_definitions_git_file_path) | map(attribute='content') | first }}
ceilometer_osprofiler_event_definitions_default_content: |
{{ _git_file_fetch.results | selectattr('item', 'equalto', ceilometer_git_config_lookup_location ~ '/' ~ ceilometer_osprofiler_event_definitions_git_file_path) | map(attribute='content') | first }}
ceilometer_policy_default_content: |
{{ _git_file_fetch.results | selectattr('item', 'equalto', ceilometer_git_config_lookup_location ~ '/' ~ ceilometer_policy_git_file_path) | map(attribute='content') | first }}
ceilometer_polling_default_content: |
{{ _git_file_fetch.results | selectattr('item', 'equalto', ceilometer_git_config_lookup_location ~ '/' ~ ceilometer_polling_git_file_path) | map(attribute='content') | first }}