Execution
Date 14 Dec 2025 10:21:40 +0000
Duration 00:43:55.98
Controller aio1.openstack.local
User root
Versions
Ansible 2.18.6
ara 1.7.4 / 1.7.4
Python 3.13.5
Summary
13 Hosts
2438 Tasks
2413 Results
107 Plays
511 Files
0 Records

File: /home/zuul/src/opendev.org/openstack/openstack-ansible-os_ceilometer/tasks/ceilometer_post_install.yml

---
# 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
  ansible.builtin.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
  ansible.builtin.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)
  ansible.builtin.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
  ansible.builtin.fetch:
    src: "{{ item.source_f }}.original"
    dest: "{{ item.tmp_f }}"
    flat: true
  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
  ansible.builtin.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
  ansible.builtin.file:
    path: "/etc/ceilometer/rootwrap.d"
    owner: "root"
    group: "root"
    mode: "0640"
    recurse: true