---

- name: directory /etc/sensu
  file:
    path: '/etc/sensu'
    state: directory
    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
    group: sensu
    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: 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

Use a custom user/group for /etc/sensu
Use a custom user/group for /etc/sensu

  * We don't have a sensu user on atomic, so we need to use root and keep sensu for rhel
