blob: 9b24ca3e60e183264798ddcefa15bb9aeb377314 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
---
- name: Post-deployment tagging
block:
- name: Construct body for tagging
set_fact:
body2: ' {% for tag in tag_exist %}{% if loop.last %}{"slug": "{{ tag }}"}{% else %}{"slug": "{{ tag }}"},{% endif %}{% endfor %}'
when: tag_exist is defined
- name: Set post-deployment tags
ansible.builtin.uri:
url: "{{ endpoint }}/virtualization/virtual-machines/{{ id }}/"
client_cert: "{{ cert }}"
client_key: "{{ key }}"
method: PATCH
return_content: yes
headers:
Accept: application/json
Authorization: "Token {{ token }}"
body_format: json
body: ' {"tags": [ {{ body2 }}]}'
delegate_to: localhost
when: body2 is defined
no_log: true
|