---
- name: import osbs secret
  command: >
    oc replace
    --namespace={{ osbs_namespace }}
    --force=true
    --filename={{ osbs_secret_remote_dir }}/openshift-secret-{{ inventory_hostname }}-{{ osbs_namespace }}-{{ osbs_secret_name }}.yml
  environment: "{{ osbs_environment }}"
  notify: allow service account

- name: allow service account
  command: >
    oc secrets
    add serviceaccount/{{ osbs_secret_service_account }} secrets/{{ osbs_secret_name }}
    --for=mount
    --namespace={{ osbs_namespace }}
  environment: "{{ osbs_environment }}"

- name: delete secret resource file
  file:
    path: "{{ osbs_secret_remote_dir }}/openshift-secret-{{ inventory_hostname }}-{{ osbs_namespace }}-{{ osbs_secret_name }}.yml"
    state: absent
