blob: 23a804bcbe8c4f4464d684888101363d3e96ebfa (
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
25
26
27
28
29
30
31
32
33
34
|
---
- name: Pre-deployment tagging
block:
- name: Gather tags
set_fact:
tag_exist: "{{ tags }}"
tag_append: "['active-deployment']"
- name: Merge tags
set_fact:
tag_merged: "{{ tag_merged + [item] }}"
with_items:
- "{{ tag_exist }}"
- "{{ tag_append }}"
- name: Construct body for tagging
set_fact:
body1: ' {% for tag in tag_merged %}{% if loop.last %}{"slug": "{{ tag }}"}{% else %}{"slug": "{{ tag }}"},{% endif %}{% endfor %}'
- name: Set pre-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": [ {{ body1 }}]}'
delegate_to: localhost
no_log: true
|