openstack-ansible-os_monasc.../tasks/monasca_agent_post_install.yml

81 lines
2.7 KiB
YAML

---
# 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: Create monasca-agent conf dir
file:
path: "/etc/monasca/agent/conf.d"
state: directory
owner: "{{ monasca_agent_system_user_name }}"
group: "{{ monasca_agent_system_group_name }}"
mode: "0755"
- name: Drop monasca-agent Config(s)
config_template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "{{ monasca_agent_system_user_name }}"
group: "{{ monasca_agent_system_group_name }}"
mode: "{{ item.mode|default('0644') }}"
config_overrides: "{{ item.config_overrides }}"
config_type: "{{ item.config_type }}"
with_items:
- src: "agent.yaml.j2"
dest: "/etc/monasca/agent/agent.yaml"
config_overrides: "{{ monasca_agent_yaml_overrides }}"
config_type: "yaml"
- src: "supervisor.conf.j2"
dest: "/etc/monasca/agent/supervisor.conf"
config_overrides: "{{ monasca_agent_supervisor_conf_overrides }}"
config_type: "ini"
- src: "monasca-reconfigure.j2"
dest: "/usr/local/bin/monasca-reconfigure"
config_overrides: "{{ monasca_agent_reconfigure_overrides }}"
config_type: "ini"
mode: "0750"
notify:
- Restart monasca-agent services
- name: Drop monasca-agent plugin config(s)
template:
src: "conf.d/{{ item.name }}.yaml.j2"
dest: "/etc/monasca/agent/conf.d/{{ item.name }}.yaml"
owner: "{{ monasca_agent_system_user_name }}"
group: "{{ monasca_agent_system_group_name }}"
mode: "0644"
with_items: "{{ monasca_agent_plugins }}"
when: inventory_hostname in groups[item.where] | default([])
notify:
- Restart monasca-agent services
- name: Add monasca-agent user to ceph group
user:
name: "monasca-agent"
groups: "ceph"
append: yes
when: inventory_hostname in groups['ceph-mon'] | default([])
- name: Add read permission on ceph key to group
file:
path: "/etc/ceph/ceph.client.admin.keyring"
mode: 0640
when: inventory_hostname in groups['ceph-mon'] | default([])
- name: Allow monasca user to have passwordless find
lineinfile:
dest: /etc/sudoers
state: present
regexp: "^monasca-agent"
line: "monasca-agent ALL=(ALL) NOPASSWD:/usr/bin/find"
validate: "visudo -cf %s"
when: inventory_hostname in groups['monasca_api'] | default([])