---

- set_fact:
    sensu_owner: sensu
    sensu_group: sensu
  when: not ansible_local.system.is_atomic | bool 

- set_fact:
    sensu_owner: root
    sensu_group: root
  when: ansible_local.system.is_atomic | bool 

- name: directory /etc/sensu
  file:
    path: '/etc/sensu'
    state: directory
    owner: "{{ sensu_owner }}"
    group: "{{ sensu_group }}"
    mode: 0755

- name: add token file
  copy:
    content: "{{ hostvars[groups['masters'][0]]['ansible_local'].openshift_data.tokens.metrics }}"
    dest: /etc/sensu/openshift_token
    owner: "{{ sensu_owner }}"
    group: "{{ sensu_group }}"
    mode: 0600
  when: hostvars[groups['masters'][0]]['ansible_local'].openshift_data.tokens.metrics is defined

---

- set_fact:
    sensu_owner: sensu
    sensu_group: sensu
  when: not ansible_local.system.is_atomic | bool 

- set_fact:
    sensu_owner: root
    sensu_group: adm
  when: ansible_local.system.is_atomic | bool 

- name: directory /etc/sensu
  file:
    path: '/etc/sensu'
    state: directory
    owner: "{{ sensu_owner }}"
    group: "{{ sensu_group }}"
    mode: 0755

- name: add token file
  copy:
    content: "{{ hostvars[groups['masters'][0]]['ansible_local'].openshift_data.tokens.metrics }}"
    dest: /etc/sensu/openshift_token
    owner: "{{ sensu_owner }}"
    group: "{{ sensu_group }}"
    mode: 0640
  when: hostvars[groups['masters'][0]]['ansible_local'].openshift_data.tokens.metrics is defined

Change the sensu group to adm on atomic
Change the sensu group to adm on atomic

  * Use adm group for sensu and add read on group on the openshift token file to be able to read it with the sensu user inside the container on atomic.
