summaryrefslogtreecommitdiff
path: root/openstack/usr/share/openstack/swift-controller.yml
blob: 272f0b50482318ed744dd9e30b61a87f4ad9c086 (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
44
45
46
47
48
49
50
51
52
53
54
---
- hosts: localhost
  vars_files:
    - swift-vars.yml
    - rings: ['account', 'container', 'object']
  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 ring
      shell: swift-ring-builder {{ item }}.builder create {{ SWIFT_PART_POWER }}
         {{ SWIFT_REPLICAS }}  {{ SWIFT_MIN_PART_HOURS }}
      with_items: rings

    - name: Add each storage node to the ring
      shell: swift-ring-builder {{ item[0] }}.builder
        add r1z1-{{ item[1].ip }}:6002/{{ item[1].device }} {{ item[1].weight }}
      with_nested:
        - rings
        - "{{ SWIFT_STORAGE_DEVICES }}"

    - name: Rebalance the ring
      shell: swift-ring-builder {{ item }}.builder rebalance
      with_items:
        - rings

    - name: Transfer ring to /etc/swift on each node
      shell: cp {{ item }}.builder /etc/swift
      with_items:
        - rings