Escape invalid JSON characters during deployment.
By first quoting the JSON query, it is possible to easily pass
it to the json_query plugin. This allows elements with special
characters, such as a hyphen -, to be resolvable.
Conflicts:
tripleo_common/templates/deployments.yaml
Change-Id: I56f3e5f96dc25f16aed585ca6678de53721071b7
Closes-Bug: #1853321
Signed-off-by: Luke Short <ekultails@gmail.com>
(cherry picked from commit 7cebd8b3e1
)
This commit is contained in:
parent
7b46f4d70b
commit
c2a83c1cd5
|
@ -1,11 +1,16 @@
|
|||
- name: Quote the JSON queries to escape invalid characters
|
||||
set_fact:
|
||||
item_id: '"{{ item }}".id'
|
||||
item_group: '"{{ item }}".group'
|
||||
item_only: '"{{ item }}"'
|
||||
|
||||
- name: Lookup deployment UUID
|
||||
set_fact:
|
||||
deployment_uuid: "{{ lookup('file', tripleo_role_name ~ '/' ~ ansible_hostname | lower ~ '/' ~ item) | from_yaml | json_query(item ~ '.id')}}"
|
||||
deployment_uuid: "{{ lookup('file', tripleo_role_name ~ '/' ~ ansible_hostname | lower ~ '/' ~ item) | from_yaml | json_query(item_id) }}"
|
||||
|
||||
- name: Lookup deployment group
|
||||
set_fact:
|
||||
deployment_group: "{{ lookup('file', tripleo_role_name ~ '/' ~ ansible_hostname | lower ~ '/' ~ item) | from_yaml | json_query(item ~ '.group')}}"
|
||||
|
||||
deployment_group: "{{ lookup('file', tripleo_role_name ~ '/' ~ ansible_hostname | lower ~ '/' ~ item) | from_yaml | json_query(item_group) }}"
|
||||
|
||||
- name: Hiera check and diff mode
|
||||
block:
|
||||
|
@ -30,7 +35,7 @@
|
|||
|
||||
- name: "Render deployment file for {{ item }} for check-mode"
|
||||
copy:
|
||||
content: "[ {{ lookup('file', tripleo_role_name ~ '/' ~ ansible_hostname | lower ~ '/' ~ item) | from_yaml | json_query(item) }} ]"
|
||||
content: "[ {{ lookup('file', tripleo_role_name ~ '/' ~ ansible_hostname | lower ~ '/' ~ item) | from_yaml | json_query(item_only) }} ]"
|
||||
dest: "/var/lib/heat-config/tripleo-config-download/check-mode/{{ item ~ '-' ~ deployment_uuid }}"
|
||||
become: true
|
||||
check_mode: no
|
||||
|
@ -101,7 +106,7 @@
|
|||
|
||||
- name: "Render deployment file for {{ item }}"
|
||||
copy:
|
||||
content: "[ {{ lookup('file', tripleo_role_name ~ '/' ~ ansible_hostname | lower ~ '/' ~ item) | from_yaml | json_query(item) }} ]"
|
||||
content: "[ {{ lookup('file', tripleo_role_name ~ '/' ~ ansible_hostname | lower ~ '/' ~ item) | from_yaml | json_query(item_only) }} ]"
|
||||
dest: "/var/lib/heat-config/tripleo-config-download/{{ item ~ '-' ~ deployment_uuid }}"
|
||||
become: true
|
||||
|
||||
|
|
Loading…
Reference in New Issue