/
ceilometer_post_install.yml
97 lines (89 loc) · 3.47 KB
/
ceilometer_post_install.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
---
# 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
openstack.config_template.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"
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
run_once: true
- name: Copy common config
openstack.config_template.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