---
- name: create prometheus directories
  file:
    path: "{{ item }}"
    state: directory
    owner: "{{ prometheus_user_id }}"
  with_items:
   - "{{ prometheus_conf_dir }}"
   - "{{ prometheus_data_dir }}"

- name: write prometheus config file
  template:
    src: prometheus.yml.j2
    dest: "{{ prometheus_conf_dir }}/prometheus.yml"
    owner: "{{ prometheus_user_id }}"
  notify: service handler

- name: make sure the alerting rules directory exists
  file:
    path: "/etc/prometheus/alerting/"
    state: directory
    recurse: yes

- name: copy alerting rules
  copy:
    src: "ceph_dashboard.yml"
    dest: "/etc/prometheus/alerting/ceph_dashboard.yml"
    owner: root
    group: root
    mode: 0644

- name: create alertmanager directories
  file:
    path: "{{ item }}"
    state: directory
    owner: "root"
  with_items:
   - "{{ alertmanager_conf_dir }}"
   - "{{ alertmanager_data_dir }}"

- name: write alertmanager config file
  template:
    src: alertmanager.yml.j2
    dest: "{{ alertmanager_conf_dir }}/alertmanager.yml"
    owner: "root"
  notify: service handler

- name: include setup_container.yml
  include_tasks: setup_container.yml

---
- name: create prometheus directories
  file:
    path: "{{ item }}"
    state: directory
    owner: "{{ prometheus_user_id }}"
  with_items:
   - "{{ prometheus_conf_dir }}"
   - "{{ prometheus_data_dir }}"

- name: write prometheus config file
  template:
    src: prometheus.yml.j2
    dest: "{{ prometheus_conf_dir }}/prometheus.yml"
    owner: "{{ prometheus_user_id }}"
    mode: 0640
  notify: service handler

- name: make sure the alerting rules directory exists
  file:
    path: "/etc/prometheus/alerting/"
    state: directory
    recurse: yes

- name: copy alerting rules
  copy:
    src: "ceph_dashboard.yml"
    dest: "/etc/prometheus/alerting/ceph_dashboard.yml"
    owner: root
    group: root
    mode: 0644

- name: create alertmanager directories
  file:
    path: "{{ item }}"
    state: directory
    owner: "root"
  with_items:
   - "{{ alertmanager_conf_dir }}"
   - "{{ alertmanager_data_dir }}"

- name: write alertmanager config file
  template:
    src: alertmanager.yml.j2
    dest: "{{ alertmanager_conf_dir }}/alertmanager.yml"
    owner: "{{ prometheus_user_id }}"
    mode: 0640
  notify: service handler

- name: include setup_container.yml
  include_tasks: setup_container.yml

Set default permission for prometheus config files
Set default permission for prometheus config files

Regardless of the outcome of Ansible 2.9.12 issue 71200
we can set a default permission for these files.

Closes: https://github.com/ceph/ceph-ansible/issues/5677

Signed-off-by: John Fulton <c68abddc912338061213c57f6b4119c791a079f8@redhat.com>
