os_* module-ify user creation
diff --git a/xos/synchronizers/openstack/steps/sync_controller_networks.py b/xos/synchronizers/openstack/steps/sync_controller_networks.py
index a2c3797..e83d3e3 100644
--- a/xos/synchronizers/openstack/steps/sync_controller_networks.py
+++ b/xos/synchronizers/openstack/steps/sync_controller_networks.py
@@ -65,7 +65,7 @@
'endpoint_v3': controller_network.controller.auth_url_v3,
'admin_user':slice.creator.email,
'admin_password':slice.creator.remote_password,
- 'project_name':slice.name,
+ 'admin_project':slice.name,
'domain': controller_network.controller.domain,
'name':network_name,
'subnet_name':subnet_name,
diff --git a/xos/synchronizers/openstack/steps/sync_controller_networks.yaml b/xos/synchronizers/openstack/steps/sync_controller_networks.yaml
index 2c8cad4..3a8107f 100644
--- a/xos/synchronizers/openstack/steps/sync_controller_networks.yaml
+++ b/xos/synchronizers/openstack/steps/sync_controller_networks.yaml
@@ -4,7 +4,6 @@
tasks:
- os_network:
name: {{ name }}
- project: {{ project_name }}
shared: true
{% if not delete -%}
state: present
@@ -15,16 +14,16 @@
auth_url: {{ endpoint }}
username: {{ admin_user }}
password: {{ admin_password }}
- project_name: {{ project_name }}
+ project_name: {{ admin_project }}
-{% if not delete -%}
+{% if not delete %}
- os_subnet:
name: {{ subnet_name }}
network_name: {{ name }}
{% if not delete -%}
state: present
- dns_nameservers: 8.8.8.8
cidr: {{ cidr }}
+ dns_nameservers: 8.8.8.8
{% if use_vtn -%}
gateway_ip: {{ gateway }}
{% endif -%}
@@ -35,6 +34,6 @@
auth_url: {{ endpoint }}
username: {{ admin_user }}
password: {{ admin_password }}
- project_name: {{ project_name }}
-{% endif -%}
+ project_name: {{ admin_project }}
+{% endif %}
diff --git a/xos/synchronizers/openstack/steps/sync_controller_users.py b/xos/synchronizers/openstack/steps/sync_controller_users.py
index 9af48e5..448cc2c 100644
--- a/xos/synchronizers/openstack/steps/sync_controller_users.py
+++ b/xos/synchronizers/openstack/steps/sync_controller_users.py
@@ -52,14 +52,14 @@
'admin_user': controller_user.controller.admin_user,
'admin_password': controller_user.controller.admin_password,
'ansible_tag':'%s@%s'%(controller_user.user.email.replace('@','-at-'),controller_user.controller.name),
- 'admin_tenant': controller_user.controller.admin_tenant,
+ 'admin_project': controller_user.controller.admin_tenant,
'roles':roles,
- 'tenant':controller_user.user.site.login_base
+ 'project':controller_user.user.site.login_base
}
return user_fields
- def map_sync_outputs(self, controller_user, res):
- controller_user.kuser_id = res[0]['id']
+ def map_sync_outputs(self, controller_user, res)
+ controller_user.kuser_id = res[0]['openstack']
controller_user.backend_status = '1 - OK'
controller_user.save()
diff --git a/xos/synchronizers/openstack/steps/sync_controller_users.yaml b/xos/synchronizers/openstack/steps/sync_controller_users.yaml
index 4da7e3d..e77b5f5 100644
--- a/xos/synchronizers/openstack/steps/sync_controller_users.yaml
+++ b/xos/synchronizers/openstack/steps/sync_controller_users.yaml
@@ -2,31 +2,37 @@
- hosts: 127.0.0.1
connection: local
tasks:
- - keystone_user:
- endpoint={{ endpoint }}
- login_user={{ admin_user }}
- login_password={{ admin_password }}
- login_tenant_name={{ admin_tenant }}
- user="{{ name }}"
- email="{{ email }}"
- password="{{ password }}"
- tenant="{{ tenant }}"
- - keystone_user:
- endpoint={{ endpoint }}
- login_user={{ admin_user }}
- login_password={{ admin_password }}
- login_tenant_name={{ admin_tenant }}
- tenant="{{ tenant }}"
+ - name: Create user account for "{{ name }}"
+ os_user:
+ name: "{{ name }}"
+ email: "{{ email }}"
+ password: "{{ password }}"
+ auth:
+ auth_url: {{ endpoint }}
+ username: {{ admin_user }}
+ password: {{ admin_password }}
+ project_name: {{ admin_project }}
- {% for role in roles %}
- - keystone_user:
- endpoint={{ endpoint}}
- login_user={{ admin_user }}
- login_password={{ admin_password }}
- login_tenant_name={{ admin_tenant }}
- role="{{ role }}"
- tenant="{{ tenant }}"
- user="{{ name }}"
- {% endfor %}
+ - name: Create project for "{{ project }}"
+ os_project:
+ name: "{{ project }}"
+ auth:
+ auth_url: {{ endpoint }}
+ username: {{ admin_user }}
+ password: {{ admin_password }}
+ project_name: {{ admin_project }}
+
+{% for role in roles -%}
+ - name: Creating role "{{ role }}" for "{{ name }}" on "{{ project }}"
+ os_user_role:
+ user: "{{ name }}"
+ role: "{{ role }}"
+ project: "{{ project }}"
+ auth:
+ auth_url: {{ endpoint }}
+ username: {{ admin_user }}
+ password: {{ admin_password }}
+ project_name: {{ admin_project }}
+{% endfor %}