csmart.swift

Swift Overview

This role is for setting up and managing OpenStack Swift clusters. It currently supports PACO nodes that run all Swift services: Proxy, Account, Container, and Object.

What It Will Do

  • Set up Swift nodes, configure SELinux, and ensure SSH access.
  • Add software repositories and install necessary packages.
  • Set up services that Swift depends on, like logging, rsyncd, and memcached.
  • Configure keepalived for backup of proxy VIPs.
  • Set up Swift PACO services.
  • Create initial account, container, and object rings.
  • Prepare disks by formatting and mounting them based on the rings.
  • Build and distribute the rings.
  • Configure data dispersion.
  • Carry out simple operational tasks such as:
    • Updating and distributing the rings.
    • Re-configuring PACO services.
    • Creating reports on data dispersion and replication.

Requirements

You need an inventory of existing CentOS 8 Stream nodes with their networking set up. You'll also need an admin box (part of the swift_admin group) from which all Swift nodes are managed. This can be one of your Swift nodes if you don't have a separate admin host.

For creating a virtual Swift cluster, check the csmart.virt_infra Ansible role at csmart/ansible-role-virt-infra.

You can find sample inventory and playbooks for both csmart.virt_infra and csmart.swift at csmart/virt-infra-swift.

Role Variables

This role comes with default variables stored in individual files under defaults/main/. These include common and specific settings for a Swift cluster:

  • account-rings.yml
  • account.yml
  • container-rings.yml
  • container.yml
  • dispersion.yml
  • hash.yml
  • networks.yml
  • object-rings.yml
  • object.yml
  • packages.yml
  • proxy.yml
  • swift.yml
  • tempauth.yml

Required Global Variables

You need to define these global variables:

  • swift_hash_suffix: The cluster's hash suffix (default: 07b4ef9c-2e01-4ea2-a109-5ffc5273225f, cannot be changed once set).
  • swift_hash_prefix: The cluster's hash prefix (default: f9175259-ace0-48bb-af9d-e7ac505b89d2, cannot be changed once set).
  • swift_outward_subnet: Routable CIDR subnet for external connections (for proxy nodes, default: 203.0.113.0/24).
  • swift_cluster_subnet: CIDR subnet for cluster communication (default: 192.0.2.0/24).
  • swift_replication_subnet: CIDR subnet for replication (default: 198.51.100.0/24, can be the same as the cluster).

Required Node-Specific Variables

Define these for each node:

  • swift_outward_ip: IP on the outward network (e.g., 203.0.113.11).

  • swift_cluster_ip: IP on the cluster network (e.g., 192.0.2.11).

  • swift_replication_ip: IP on the replication network (e.g., 198.51.100.11).

  • swift_vips: List of proxy VIPs, specifying the 4th octet of the IP in order of preference. For example:

    swift_vips:
      - 111
      - 112
      - 113
    
  • swift_rings_disks: List defining disks for each ring. Each entry should state the path and weight for the specific ring. Example:

    swift_rings_disks:
      - disk:
          device: sdb
          rings:
          - name: account
            weight: 0
          - name: container
            weight: 0
          - name: object
            weight: 100
      - disk:
          device: nvme0n1
          rings:
          - name: account
            weight: 100
          - name: container
            weight: 100
          - name: object
            weight: 0
    

Dependencies

None.

Example Playbook

The virt-infra-swift repository at csmart/virt-infra-swift has example playbooks and sample inventory.

Your inventory should have these groups:

  • swift (or all)
  • swift_admin
  • swift_proxy
  • swift_account
  • swift_container
  • swift_object

Here’s an example inventory for a three-node PACO Swift cluster:

swift:
  hosts:
    swift-admin:
    swift-[01:03]:
  children:
    swift_admin:
      hosts:
        swift-admin:
    swift_proxy:
      hosts:
        swift-[01:03]:
    swift_account:
      hosts:
        swift-[01:03]:
    swift_container:
      hosts:
        swift-[01:03]:
    swift_object:
      hosts:
        swift-[01:03]:

Creating a basic playbook with that inventory is straightforward:

---
- hosts: swift
  tasks:
    - include_role:
        name: csmart.swift

Run the playbook like this to execute all tasks:

ansible-playbook -i inventory/ site.yml

You can also tag each type of task and create multiple playbooks for specific tasks. Example:

---
- hosts: swift
  tasks:
    - include_role:
        name: csmart.swift
      tags:
        - account
        - common
        ...

Run a specific task with this command:

ansible-playbook -i inventory/ site.yml --tags account

License

GPLv3+

Author Information

Chris Smart blog

Informazioni sul progetto

Define and manage guests and networks on a KVM host with Ansible

Installa
ansible-galaxy install csmart.swift
Licenza
gpl-3.0
Download
99
Proprietario
Just another Linux guy.