CORD-790: Replaced jinja variables with native ansible vars
Change-Id: I2ed3653c70ad495582db300c8eecc86659ecff35
diff --git a/xos/synchronizer/steps/sync_controller_slice_privileges.yaml b/xos/synchronizer/steps/sync_controller_slice_privileges.yaml
index 4e0d767..e681c41 100644
--- a/xos/synchronizer/steps/sync_controller_slice_privileges.yaml
+++ b/xos/synchronizer/steps/sync_controller_slice_privileges.yaml
@@ -3,13 +3,8 @@
connection: local
# These variables are expanded by the Synchronizer framework
# and used to create the TOSCA recipe from a template
- vars:
- slice_name: "{{ slice_name }}"
- user_name: "{{ user_name }}"
- role: "{{ role }}"
+
tasks:
- {% if delete -%}
- {% else -%}
- name: Lookup local name of remote site
uri:
url: "{{ endpoint }}/api/core/sites/"
@@ -22,11 +17,11 @@
- name: Save site name in local_site variable
set_fact:
- local_site: "{{ '{{' }} sites.json[0]['name'] {{ '}}' }}"
+ local_site: "{{ sites.json[0]['name'] }}"
- name: Save local name of slice in local_slice_name variable
set_fact:
- local_slice_name: "{{ '{{' }} local_site {{ '}}' }}_{{ slice_name }}"
+ local_slice_name: "{{ local_site }}_{{ slice_name }}"
- name: Get list of users
uri:
@@ -70,7 +65,6 @@
method: POST
user: "{{ admin_user }}"
password: "{{ admin_password }}"
- body: { "recipe": "{{ '{{' }} lookup('file', '/opt/xos/synchronizers/globalxos/tosca/slice_privileges/{{ ansible_tag }}.yml') {{ '}}' }}" }
+ body: { "recipe": "{{ lookup('file', '/opt/xos/synchronizers/globalxos/tosca/slice_privileges/{{ ansible_tag }}.yml') }}" }
force_basic_auth: yes
body_format: json
- {% endif %}
diff --git a/xos/synchronizer/steps/sync_controller_slices.yaml b/xos/synchronizer/steps/sync_controller_slices.yaml
index 7c85872..03a7b88 100644
--- a/xos/synchronizer/steps/sync_controller_slices.yaml
+++ b/xos/synchronizer/steps/sync_controller_slices.yaml
@@ -3,17 +3,7 @@
connection: local
# These variables are expanded by the Synchronizer framework
# and used to create the TOSCA recipe from a template
- vars:
- slice_name: "{{ slice_name }}"
- slice_description: "{{ slice_description }}"
- image: "{{ image }}"
- addresses: "{{ addresses }}"
- gateway_ip: "{{ gateway_ip }}"
- gateway_mac: "{{ gateway_mac }}"
- max_instances: "{{ max_instances }}"
tasks:
- {% if delete -%}
- {% else -%}
- name: Lookup local name of remote site
uri:
url: "{{ endpoint }}/api/core/sites/"
@@ -26,7 +16,7 @@
- name: Save site name in local_site variable
set_fact:
- local_site: "{{ '{{' }} sites.json[0]['name'] {{ '}}' }}"
+ local_site: "{{ sites.json[0]['name'] }}"
- name: Get list of images
uri:
@@ -51,7 +41,7 @@
force_basic_auth: yes
register: networks
- - fail: msg="Network {{ '{{' }} item {{ '}}' }} is not present at {{ endpoint }}"
+ - fail: msg="Network {{ item }} is not present at {{ endpoint }}"
when: not ((networks.json | selectattr('name', 'equalto', item)) | list)
with_items:
- "management"
@@ -73,7 +63,6 @@
method: POST
user: "{{ admin_user }}"
password: "{{ admin_password }}"
- body: { "recipe": "{{ '{{' }} lookup('file', '/opt/xos/synchronizers/globalxos/tosca/slices/{{ ansible_tag }}.yml') {{ '}}' }}" }
+ body: { "recipe": "{{ lookup('file', '/opt/xos/synchronizers/globalxos/tosca/slices/{{ ansible_tag }}.yml') }}" }
force_basic_auth: yes
body_format: json
- {% endif %}
diff --git a/xos/synchronizer/steps/sync_controller_users.yaml b/xos/synchronizer/steps/sync_controller_users.yaml
index 2d4cc00..96b1a4d 100644
--- a/xos/synchronizer/steps/sync_controller_users.yaml
+++ b/xos/synchronizer/steps/sync_controller_users.yaml
@@ -3,19 +3,6 @@
connection: local
# These variables are expanded by the Synchronizer framework
# and used to create the TOSCA recipe from a template
- vars:
- name: "{{ name }}"
- email: "{{ email }}"
- password: "{{ password }}"
- firstname: "{{ firstname }}"
- lastname: "{{ lastname }}"
- phone: "{{ phone }}"
- user_url: "{{ user_url }}"
- public_key: "{{ public_key }}"
- is_active: "{{ is_active }}"
- is_admin: "{{ is_admin }}"
- is_readonly: "{{ is_readonly }}"
- is_appuser: "{{ is_appuser }}"
tasks:
- name: Lookup local name of remote site
@@ -30,7 +17,7 @@
- name: Save site name in local_site variable
set_fact:
- local_site: "{{ '{{' }} sites.json[0]['name'] {{ '}}' }}"
+ local_site: "{{ sites.json[0]['name'] }}"
- name: Ensure TOSCA directory exists
file:
@@ -48,6 +35,6 @@
method: POST
user: "{{ admin_user }}"
password: "{{ admin_password }}"
- body: { "recipe": "{{ '{{' }} lookup('file', '/opt/xos/synchronizers/globalxos/tosca/users/{{ ansible_tag }}.yml') {{ '}}' }}" }
+ body: { "recipe": "{{ lookup('file', '/opt/xos/synchronizers/globalxos/tosca/users/{{ ansible_tag }}.yml') }}" }
force_basic_auth: yes
body_format: json