ansible-libvirtsecret/tasks/main.yml

27 lines
751 B
YAML
Raw Normal View History

2020-07-30 07:43:29 +00:00
- name: Check if libvirt RBD secret set
2020-08-20 09:08:36 +00:00
command: virsh secret-get-value {{ rbd_secret_uuid }}
2020-07-30 07:43:29 +00:00
register: virsh_secret_result
changed_when: false
failed_when: false
tags: libvirt-secret
- name: Generate libvirt RBD secret definition
template:
src: templates/rbd_secret.xml.j2
dest: /tmp/secret.xml
2022-12-02 05:44:40 +00:00
when: virsh_secret_result.rc != 0
2022-07-20 15:24:19 +00:00
ignore_errors: true
2020-07-30 07:43:29 +00:00
tags: libvirt-secret
- name: Define libvirt RBD secret
command: virsh secret-define /tmp/secret.xml
2022-12-02 05:44:40 +00:00
when: virsh_secret_result.rc != 0
2022-07-20 15:24:19 +00:00
ignore_errors: true
2020-07-30 07:43:29 +00:00
tags: libvirt-secret
- name: Set libvirt RBD secret
2020-08-20 09:08:36 +00:00
command: virsh secret-set-value {{ rbd_secret_uuid }} {{ rbd_secret_key }}
2022-12-02 05:44:40 +00:00
when: virsh_secret_result.rc != 0
2022-07-20 15:24:19 +00:00
ignore_errors: true
2020-07-30 07:43:29 +00:00
tags: libvirt-secret