ansible/roles/openshift/secret-file/tasks/main.yml
Patrick Uiterwijk 328a30b31f The notfound is on stderr
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
2018-05-31 03:42:41 +02:00

26 lines
1.1 KiB
YAML

- name: Copy template {{template}}
template: src={{roles_path}}/openshift-apps/{{app}}/templates/{{template}} dest=/etc/openshift_apps/{{app}}/{{key}}
when: template is defined
register: secret_template
- name: Copy file {{file}}
copy: src={{roles_path}}/openshift-apps/{{app}}/files/{{file}} dest=/etc/openshift_apps/{{app}}/{{key}}
when: file is defined
register: secret_file
- name: Copy private file {{privatefile}}
copy: src={{private}}/files/{{privatefile}} dest=/etc/openshift_apps/{{app}}/{{key}}
when: privatefile is defined
register: secret_privatefile
- name: Delete existing secrets
shell: oc -n {{app}} delete secret/{{secret_name}}
register: delete_out
changed_when: "'NotFound' in delete_out.stderr"
failed_when: "('NotFound' not in delete_out.stderr) and (delete_out.rc != 0)"
when: secret_template.changed or secret_file.changed or secret_privatefile.changed
- name: Call `oc secrets new` on the copied file
shell: oc -n {{app}} secrets new {{secret_name}} {{key}}=/etc/openshift_apps/{{app}}/{{key}}
register: create_out
when: secret_template.changed or secret_file.changed or secret_privatefile.changed