---
- name: Creating the Swift service and endpoint
  kolla_toolbox:
    module_name: "kolla_keystone_service"
    module_args:
      service_name: "swift"
      service_type: "object-store"
      description: "Openstack Object Storage"
      endpoint_region: "{{ openstack_region_name }}"
      url: "{{ item.url }}"
      interface: "{{ item.interface }}"
      region_name: "{{ openstack_region_name }}"
      auth: "{{ openstack_swift_auth }}"
      endpoint_type: "{{ openstack_interface }}"
  run_once: True
  with_items:
    - {'interface': 'admin', 'url': '{{ swift_admin_endpoint }}'}
    - {'interface': 'internal', 'url': '{{ swift_internal_endpoint }}'}
    - {'interface': 'public', 'url': '{{ swift_public_endpoint }}'}

- name: Creating the Swift project, user, and role
  kolla_toolbox:
    module_name: "kolla_keystone_user"
    module_args:
      project: "service"
      user: "{{ swift_keystone_user }}"
      password: "{{ swift_keystone_password }}"
      role: "{{ swift_admin_tenant_name }}"
      region_name: "{{ openstack_region_name }}"
      auth: "{{ openstack_swift_auth }}"
      endpoint_type: "{{ openstack_interface }}"
  run_once: True

- name: Creating the ResellerAdmin role
  kolla_toolbox:
    module_name: "os_keystone_role"
    module_args:
      name: "ResellerAdmin"
      region_name: "{{ openstack_region_name }}"
      auth: "{{ openstack_swift_auth }}"
      endpoint_type: "{{ openstack_interface }}"
  run_once: True
