Merge "Add rsyncd image and related Ansible for Swift"
This commit is contained in:
commit
84535cf15a
@ -40,6 +40,10 @@ swift_object_updater_image: "{{ docker_registry ~ '/' if docker_registry else ''
|
||||
swift_object_updater_tag: "{{ openstack_release }}"
|
||||
swift_object_updater_image_full: "{{ swift_object_updater_image }}:{{ swift_object_updater_tag }}"
|
||||
|
||||
swift_rsyncd_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-swift-rsyncd"
|
||||
swift_rsyncd_tag: "{{ openstack_release }}"
|
||||
swift_rsyncd_image_full: "{{ swift_rsyncd_image }}:{{ swift_rsyncd_tag }}"
|
||||
|
||||
####################
|
||||
# Openstack
|
||||
####################
|
||||
|
@ -82,3 +82,14 @@
|
||||
dest: "{{ node_config_directory }}/swift/container.ring.gz" }
|
||||
- { src: "/etc/kolla/config/swift/account.ring.gz",
|
||||
dest: "{{ node_config_directory }}/swift/account.ring.gz" }
|
||||
|
||||
- name: Ensuring swift-rsyncd config directory exists
|
||||
file:
|
||||
path: "{{ node_config_directory }}/swift-rsyncd/"
|
||||
state: "directory"
|
||||
recurse: "yes"
|
||||
|
||||
- name: Copying over swift-rsyncd config(s)
|
||||
template:
|
||||
src: "rsyncd.conf.j2"
|
||||
dest: "{{ node_config_directory }}/swift-rsyncd/rsyncd.conf"
|
||||
|
@ -1,4 +1,24 @@
|
||||
---
|
||||
- name: Starting Swift-rsyncd container
|
||||
docker:
|
||||
docker_api_version: "{{ docker_api_version }}"
|
||||
net: host
|
||||
pull: "{{ docker_pull_policy }}"
|
||||
restart_policy: "{{ docker_restart_policy }}"
|
||||
restart_policy_retry: "{{ docker_restart_policy_retry }}"
|
||||
state: reloaded
|
||||
registry: "{{ docker_registry }}"
|
||||
username: "{{ docker_registry_username }}"
|
||||
password: "{{ docker_registry_password }}"
|
||||
insecure_registry: "{{ docker_insecure_registry }}"
|
||||
name: swift_rsyncd
|
||||
image: "{{ swift_rsyncd_image_full }}"
|
||||
volumes: "{{ node_config_directory }}/swift-rsyncd/:/opt/kolla/swift-rsyncd/:ro"
|
||||
volumes_from:
|
||||
- swift_data
|
||||
env:
|
||||
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
||||
|
||||
- name: Starting Swift Proxy Server container
|
||||
docker:
|
||||
docker_api_version: "{{ docker_api_version }}"
|
||||
|
27
ansible/roles/swift/templates/rsyncd.conf.j2
Normal file
27
ansible/roles/swift/templates/rsyncd.conf.j2
Normal file
@ -0,0 +1,27 @@
|
||||
uid = swift
|
||||
gid = swift
|
||||
address = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}
|
||||
|
||||
{% if inventory_hostname in groups['swift-account-server'] %}
|
||||
[account]
|
||||
max connections = 2
|
||||
path = {{ swift_devices_mount_point }}
|
||||
read only = false
|
||||
lock file = /var/lock/account.lock
|
||||
{% endif %}
|
||||
|
||||
{% if inventory_hostname in groups['swift-container-server'] %}
|
||||
[container]
|
||||
max connections = 4
|
||||
path = {{ swift_devices_mount_point }}
|
||||
read only = false
|
||||
lock file = /var/lock/container.lock
|
||||
{% endif %}
|
||||
|
||||
{% if inventory_hostname in groups['swift-object-server'] %}
|
||||
[object]
|
||||
max connections = 8
|
||||
path = {{ swift_devices_mount_point }}
|
||||
read only = false
|
||||
lock file = /var/lock/object.lock
|
||||
{% endif %}
|
22
docker/swift/swift-rsyncd/Dockerfile.j2
Normal file
22
docker/swift/swift-rsyncd/Dockerfile.j2
Normal file
@ -0,0 +1,22 @@
|
||||
FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-swift-base:{{ tag }}
|
||||
MAINTAINER Kolla Project (https://launchpad.net/kolla)
|
||||
|
||||
{% if base_distro in ['fedora', 'centos', 'oraclelinux'] %}
|
||||
|
||||
RUN yum install -y rsync \
|
||||
&& yum clean all
|
||||
|
||||
{% elif base_distro in ['ubuntu', 'debian'] %}
|
||||
|
||||
RUN apt-get install -y --no-install-recommends \
|
||||
rsync \
|
||||
&& apt-get clean
|
||||
|
||||
{% endif %}
|
||||
|
||||
COPY start.sh /
|
||||
COPY config-external.sh /opt/kolla/
|
||||
|
||||
CMD ["/start.sh"]
|
||||
|
||||
{{ include_footer }}
|
9
docker/swift/swift-rsyncd/config-external.sh
Normal file
9
docker/swift/swift-rsyncd/config-external.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
OWNER="swift"
|
||||
|
||||
if [[ -f "/opt/kolla/swift-rsyncd/rsyncd.conf" ]]; then
|
||||
cp /opt/kolla/swift-rsyncd/rsyncd.conf /etc/rsyncd.conf
|
||||
chown ${OWNER}: /etc/rsyncd.conf
|
||||
chmod 0640 /etc/rsyncd.conf
|
||||
fi
|
14
docker/swift/swift-rsyncd/start.sh
Executable file
14
docker/swift/swift-rsyncd/start.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -o errexit
|
||||
|
||||
CMD="/usr/bin/rsync"
|
||||
ARGS="--daemon --no-detach --config=/etc/rsyncd.conf"
|
||||
|
||||
# Loading common functions.
|
||||
source /opt/kolla/kolla-common.sh
|
||||
|
||||
# Execute config strategy
|
||||
set_configs
|
||||
|
||||
exec $CMD $ARGS
|
Loading…
Reference in New Issue
Block a user