blob: 96b1a4d35beff6ca575950430bfe5a77234afa18 [file] [log] [blame]
Andy Bavier89a95422016-11-02 14:38:39 -04001---
2- hosts: 127.0.0.1
3 connection: local
4 # These variables are expanded by the Synchronizer framework
5 # and used to create the TOSCA recipe from a template
Andy Bavier89a95422016-11-02 14:38:39 -04006 tasks:
7
8 - name: Lookup local name of remote site
9 uri:
10 url: "{{ endpoint }}/api/core/sites/"
11 method: GET
12 user: "{{ admin_user }}"
13 password: "{{ admin_password }}"
14 return_content: yes
15 force_basic_auth: yes
16 register: sites
17
18 - name: Save site name in local_site variable
19 set_fact:
Sapan Bhatiaa6ae7d62017-02-09 16:49:22 -080020 local_site: "{{ sites.json[0]['name'] }}"
Andy Bavier89a95422016-11-02 14:38:39 -040021
22 - name: Ensure TOSCA directory exists
23 file:
24 path=/opt/xos/synchronizers/globalxos/tosca/users/
25 state=directory
26
27 - name: Create TOSCA recipe from the template
28 template:
29 src=/opt/xos/synchronizers/globalxos/templates/user.yaml.j2
30 dest=/opt/xos/synchronizers/globalxos/tosca/users/{{ ansible_tag }}.yml
31
32 - name: Create user account for "{{ name }}"
33 uri:
34 url: "{{ endpoint }}/api/utility/tosca/run/"
35 method: POST
36 user: "{{ admin_user }}"
37 password: "{{ admin_password }}"
Sapan Bhatiaa6ae7d62017-02-09 16:49:22 -080038 body: { "recipe": "{{ lookup('file', '/opt/xos/synchronizers/globalxos/tosca/users/{{ ansible_tag }}.yml') }}" }
Andy Bavier89a95422016-11-02 14:38:39 -040039 force_basic_auth: yes
40 body_format: json