summaryrefslogtreecommitdiff
path: root/openstack/usr/share/openstack/swift-controller.yml
blob: 3a09396e3595b66175f876485c95abe36328b1c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
- hosts: localhost
  vars_files:
    - swift-vars.yml
  remote_user: root
  tasks:
    - user: name=swift comment="Swift user"
    - file: path=/etc/swift owner=swift group=swift

    - keystone_user: >
        user=swift
        password={{ SWIFT_ADMIN_PASSWORD }}
        tenant=service
        token={{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}

    - keystone_user: >
        role=admin
        user=swift
        tenant=service
        token={{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}

    - keystone_service: >
        name=swift
        type=object-store
        description="OpenStack Object Storage"
        publicurl={{ SWIFT_PUBLIC_URL }}
        internalurl={{ SWIFT_INTERNAL_URL 
            | default('http://127.0.0.1:8080/v1/AUTH_%(tenant_id)s') }}
        adminurl={{ SWIFT_ADMIN_URL }}
        region='RegionOne'
        token={{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}

    - name: Create account ring
      shell: swift-ring-builder account.builder create {{ SWIFT_PART_POWER }}
         {{ SWIFT_REPLICAS }}  {{ SWIFT_MIN_PART_HOURS }}

    - name: Add each storage node to the ring
      shell: swift-ring-builder account.builder
        add r1z1-{{ item.ip }}:6002/{{ item.device}} {{ item.weight }}
      with_items: "{{ SWIFT_STORAGE_DEVICES }}"

    - name: Rebalance the ring
      shell: swift-ring-builder account.builder rebalance