openstack-ansible-os_ceilom.../tasks/ceilometer_post_install.yml

103 lines
3.6 KiB
YAML

---
# Copyright 2014, 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.
- name: Find the venv's python version
command: "{{ ceilometer_bin }}/{{ ceilometer_venv_python_executable }} -c 'import ceilometer; print(ceilometer.__file__)'"
changed_when: false
register: _ceilometer_python_venv_details
- name: Set python lib dir fact
set_fact:
ceilometer_lib_dir: "{{ _ceilometer_python_venv_details.stdout | dirname | dirname }}"
- name: Copy ceilometer configuration files
config_template:
content: "{{ item.content | default(omit) }}"
src: "{{ item.src | default(omit) }}"
dest: "{{ item.dest }}"
owner: "{{ item.owner | default(ceilometer_system_user_name) }}"
group: "{{ item.group | default(ceilometer_system_group_name) }}"
mode: "{{ item.mode | default('0644') }}"
config_overrides: "{{ item.config_overrides }}"
config_type: "{{ item.config_type }}"
list_extend: "{{ item.list_extend | default(omit) }}"
with_items:
- src: "ceilometer.conf.j2"
dest: "/etc/ceilometer/ceilometer.conf"
config_overrides: "{{ ceilometer_ceilometer_conf_overrides }}"
config_type: "ini"
- src: "pipeline.yaml.j2"
dest: "/etc/ceilometer/pipeline.yaml"
config_overrides: "{{ ceilometer_pipeline_yaml_overrides }}"
config_type: "yaml"
list_extend: false
notify:
- Restart ceilometer services
# NOTE(cloudnull): This is using "cp" instead of copy with a remote_source
# because we only want to copy the original files once. and we
# don't want to need multiple tasks.
- name: Preserve original configuration file(s)
command: "cp {{ item.source_f }} {{ item.source_f }}.original"
args:
creates: "{{ item.source_f }}.original"
with_items: "{{ ceilometer_core_files }}"
when: item.condition | default(True)
- name: Fetch override files
fetch:
src: "{{ item.source_f }}.original"
dest: "{{ item.tmp_f }}"
flat: yes
changed_when: false
with_items: "{{ ceilometer_core_files }}"
when:
- item.condition | default(True)
- item.tmp_f
- _ceilometer_is_first_play_host
- name: Copy common config
config_template:
src: "{{ (item.tmp_f) | ternary(item.tmp_f, omit) }}"
dest: "{{ item.target_f | default(item.source_f) }}"
owner: "{{ item.owner | default(ceilometer_system_user_name) }}"
group: "{{ item.group | default(ceilometer_system_group_name) }}"
mode: "{{ item.mode | default('0640') }}"
config_overrides: "{{ item.config_overrides }}"
config_type: "{{ item.config_type }}"
content: "{{ item.content | default(omit) }}"
with_items: "{{ ceilometer_core_files }}"
when: item.condition | default(True)
notify:
- Restart ceilometer services
- name: Cleanup fetched temp files
file:
path: "{{ item.tmp_f }}"
state: absent
changed_when: false
delegate_to: localhost
with_items: "{{ ceilometer_core_files }}"
when: item.condition | default(True)
# NOTE(cloudnull): This will ensure strong permissions on all rootwrap files.
- name: Set rootwrap.d permissions
file:
path: "/etc/ceilometer/rootwrap.d"
owner: "root"
group: "root"
mode: "0640"
recurse: true