From 16900c2e37ecdb23111ae57997413c229fab9740 Mon Sep 17 00:00:00 2001 From: caoyuan Date: Sun, 29 Apr 2018 13:15:02 +0800 Subject: [PATCH] Add ceilometer_ipmi container into ceilometer role refer to [0] [0]: https://docs.openstack.org/ceilometer/latest/install/install-compute-rdo.html Co-Authored-By: zhulingjie Change-Id: I4cda336dedb3d807b80d13bcc219268a8d667b4d --- ansible/group_vars/all.yml | 1 + ansible/inventory/all-in-one | 3 ++ ansible/inventory/multinode | 3 ++ ansible/roles/ceilometer/defaults/main.yml | 18 +++++++++++ ansible/roles/ceilometer/handlers/main.yml | 26 ++++++++++++++++ ansible/roles/ceilometer/tasks/config.yml | 4 +++ .../templates/ceilometer-ipmi.json.j2 | 30 +++++++++++++++++++ ansible/site.yml | 1 + etc/kolla/globals.yml | 1 + .../add-ceilometer-ipmi-b646f886666889a1.yaml | 4 +++ tests/templates/inventory.j2 | 3 ++ 11 files changed, 94 insertions(+) create mode 100644 ansible/roles/ceilometer/templates/ceilometer-ipmi.json.j2 create mode 100644 releasenotes/notes/add-ceilometer-ipmi-b646f886666889a1.yaml diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index c227b14edf..c47ffbf814 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -506,6 +506,7 @@ enable_barbican: "no" enable_blazar: "no" enable_cadf_notifications: "no" enable_ceilometer: "no" +enable_ceilometer_ipmi: "no" enable_central_logging: "no" enable_ceph: "no" enable_ceph_mds: "no" diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one index ced3eee5f4..9215b26d6a 100644 --- a/ansible/inventory/all-in-one +++ b/ansible/inventory/all-in-one @@ -580,6 +580,9 @@ ceilometer [ceilometer-compute:children] compute +[ceilometer-ipmi:children] +compute + # Congress [congress-api:children] congress diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode index 19f37d0c55..1c0160cef2 100644 --- a/ansible/inventory/multinode +++ b/ansible/inventory/multinode @@ -562,6 +562,9 @@ ceilometer [ceilometer-compute:children] compute +[ceilometer-ipmi:children] +compute + # Aodh [aodh-api:children] aodh diff --git a/ansible/roles/ceilometer/defaults/main.yml b/ansible/roles/ceilometer/defaults/main.yml index a9da4a2275..05cfe730e6 100644 --- a/ansible/roles/ceilometer/defaults/main.yml +++ b/ansible/roles/ceilometer/defaults/main.yml @@ -40,6 +40,18 @@ ceilometer_services: - "nova_libvirt:/var/lib/libvirt" - "{{ kolla_dev_repos_directory ~ '/ceilometer/ceilometer:/var/lib/kolla/venv/lib/python2.7/site-packages/ceilometer' if ceilometer_dev_mode | bool else '' }}" dimensions: "{{ ceilometer_compute_dimensions }}" + ceilometer-ipmi: + container_name: ceilometer_ipmi + group: ceilometer-ipmi + enabled: "{{ enable_ceilometer_ipmi }}" + image: "{{ ceilometer_ipmi_image_full }}" + volumes: + - "{{ node_config_directory }}/ceilometer-ipmi/:{{ container_config_directory }}/:ro" + - "/etc/localtime:/etc/localtime:ro" + - "ceilometer:/var/lib/ceilometer/" + - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/ceilometer/ceilometer:/var/lib/kolla/venv/lib/python2.7/site-packages/ceilometer' if ceilometer_dev_mode | bool else '' }}" + dimensions: "{{ ceilometer_ipmi_dimensions }}" #################### @@ -60,9 +72,15 @@ ceilometer_compute_image: "{{ docker_registry ~ '/' if docker_registry else '' } ceilometer_compute_tag: "{{ ceilometer_tag }}" ceilometer_compute_image_full: "{{ ceilometer_compute_image }}:{{ ceilometer_compute_tag }}" +ceilometer_ipmi_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ ceilometer_install_type }}-ceilometer-ipmi" +ceilometer_ipmi_tag: "{{ ceilometer_tag }}" +ceilometer_ipmi_image_full: "{{ ceilometer_ipmi_image }}:{{ ceilometer_ipmi_tag }}" + ceilometer_notification_dimensions: "{{ default_container_dimensions }}" ceilometer_central_dimensions: "{{ default_container_dimensions }}" ceilometer_compute_dimensions: "{{ default_container_dimensions }}" +ceilometer_ipmi_dimensions: "{{ default_container_dimensions }}" + #################### # OpenStack diff --git a/ansible/roles/ceilometer/handlers/main.yml b/ansible/roles/ceilometer/handlers/main.yml index 5348beab33..f782c94487 100644 --- a/ansible/roles/ceilometer/handlers/main.yml +++ b/ansible/roles/ceilometer/handlers/main.yml @@ -87,3 +87,29 @@ or policy_overwriting.changed | bool or vcenter_ca_file.changed | bool or ceilometer_compute_container.changed | bool + +- name: Restart ceilometer-ipmi container + vars: + service_name: "ceilometer-ipmi" + service: "{{ ceilometer_services[service_name] }}" + config_json: "{{ ceilometer_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}" + ceilometer_conf: "{{ ceilometer_confs.results|selectattr('item.key', 'equalto', service_name)|first }}" + ceilometer_pipeline: "{{ ceilometer_pipelines.results|selectattr('item.key', 'equalto', service_name)|first }}" + policy_overwriting: "{{ ceilometer_policy_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}" + ceilometer_ipmi_container: "{{ check_ceilometer_containers.results|selectattr('item.key', 'equalto', service_name)|first }}" + kolla_docker: + action: "recreate_or_restart_container" + common_options: "{{ docker_common_options }}" + name: "{{ service.container_name }}" + image: "{{ service.image }}" + volumes: "{{ service.volumes }}" + dimensions: "{{ service.dimensions }}" + when: + - kolla_action != "config" + - inventory_hostname in groups[service.group] + - service.enabled | bool + - config_json.changed | bool + or ceilometer_conf.changed | bool + or ceilometer_pipeline.changed | bool + or policy_overwriting.changed | bool + or ceilometer_ipmi_container.changed | bool diff --git a/ansible/roles/ceilometer/tasks/config.yml b/ansible/roles/ceilometer/tasks/config.yml index b427561097..5af1067818 100644 --- a/ansible/roles/ceilometer/tasks/config.yml +++ b/ansible/roles/ceilometer/tasks/config.yml @@ -70,6 +70,7 @@ - Restart ceilometer-notification container - Restart ceilometer-central container - Restart ceilometer-compute container + - Restart ceilometer-ipmi container - name: Copying over ceilometer.conf vars: @@ -93,6 +94,7 @@ - Restart ceilometer-notification container - Restart ceilometer-central container - Restart ceilometer-compute container + - Restart ceilometer-ipmi container - name: Copying over event yaml for notification service vars: @@ -186,6 +188,7 @@ - Restart ceilometer-notification container - Restart ceilometer-central container - Restart ceilometer-compute container + - Restart ceilometer-ipmi container # check whether the containers parameter is changed. If yes, trigger the handler. - name: Check ceilometer containers @@ -208,3 +211,4 @@ - Restart ceilometer-notification container - Restart ceilometer-central container - Restart ceilometer-compute container + - Restart ceilometer-ipmi container diff --git a/ansible/roles/ceilometer/templates/ceilometer-ipmi.json.j2 b/ansible/roles/ceilometer/templates/ceilometer-ipmi.json.j2 new file mode 100644 index 0000000000..3a643cf03d --- /dev/null +++ b/ansible/roles/ceilometer/templates/ceilometer-ipmi.json.j2 @@ -0,0 +1,30 @@ +{ + "command": "ceilometer-polling --polling-namespaces ipmi", + "config_files": [ + { + "source": "{{ container_config_directory }}/ceilometer.conf", + "dest": "/etc/ceilometer/ceilometer.conf", + "owner": "ceilometer", + "perm": "0600" + }{% if ceilometer_polling_file_path is defined %}, + { + "source": "{{ container_config_directory }}/polling.yaml", + "dest": "/etc/ceilometer/polling.yaml", + "owner": "ceilometer", + "perm": "0600" + }{% endif %}{% if ceilometer_policy_file is defined %}, + { + "source": "{{ container_config_directory }}/{{ ceilometer_policy_file }}", + "dest": "/etc/ceilometer/{{ ceilometer_policy_file }}", + "owner": "ceilometer", + "perm": "0600" + }{% endif %} + ], + "permissions": [ + { + "path": "/var/log/kolla/ceilometer", + "owner": "ceilometer:ceilometer", + "recurse": true + } + ] +} diff --git a/ansible/site.yml b/ansible/site.yml index 5814e1b646..19395e9f2e 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -913,6 +913,7 @@ - ceilometer-central - ceilometer-notification - ceilometer-compute + - ceilometer-ipmi - '&enable_ceilometer_True' serial: '{{ kolla_serial|default("0") }}' roles: diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml index f900232add..f7938c817e 100644 --- a/etc/kolla/globals.yml +++ b/etc/kolla/globals.yml @@ -189,6 +189,7 @@ kolla_internal_vip_address: "10.10.10.254" #enable_barbican: "no" #enable_blazar: "no" #enable_ceilometer: "no" +#enable_ceilometer_ipmi: "no" #enable_central_logging: "no" #enable_ceph: "no" #enable_ceph_mds: "no" diff --git a/releasenotes/notes/add-ceilometer-ipmi-b646f886666889a1.yaml b/releasenotes/notes/add-ceilometer-ipmi-b646f886666889a1.yaml new file mode 100644 index 0000000000..6d0030a502 --- /dev/null +++ b/releasenotes/notes/add-ceilometer-ipmi-b646f886666889a1.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Add ceilometer_ipmi into ceilometer role. diff --git a/tests/templates/inventory.j2 b/tests/templates/inventory.j2 index 42f7dcad20..a1a8635233 100644 --- a/tests/templates/inventory.j2 +++ b/tests/templates/inventory.j2 @@ -523,6 +523,9 @@ ceilometer [ceilometer-compute:children] compute +[ceilometer-ipmi:children] +compute + # Congress [congress-api:children] congress