openstack-ansible-os_swift/templates/rsyncd.conf.j2
2021-11-30 12:42:47 +02:00

64 lines
2.3 KiB
Django/Jinja

# {{ ansible_managed }}
uid = {{ swift_system_user_name }}
gid = {{ swift_system_group_name }}
pid file = /var/run/rsyncd.pid
reverse lookup = {{ swift_rsync_reverse_lookup | bool }}
address = {{ swift_replication_address }}
[account]
max connections = {{ swift_account_max_rsync_connections }}
path = {{ swift_vars.mount_point | default(swift.mount_point) }}
read only = false
lock file = {{ swift_lock_dir }}/account.lock
[container]
max connections = {{ swift_container_max_rsync_connections }}
path = {{ swift_vars.mount_point | default(swift.mount_point) }}
read only = false
lock file = {{ swift_lock_dir }}/container.lock
{% if swift_rsync_module_per_drive %}
{### Set up per drive rsync modules #}
{### Lets get the default groups for drives and find the default storage_policy #}
{% set def_groups = [ 'account', 'container' ] %}
{% for policy in swift.storage_policies %}
{% if policy.policy.default is defined and policy.policy.default == True %}
{% set _update = def_groups.append(policy.policy.name) %}
{% endif %}
{% endfor %}
{### swift_vars needs to exist for swift_vars[setting] checks to work #}
{% if swift_vars is not defined %}
{% set swift_vars = {} %}
{% endif %}
{% set drives = swift_vars.drives | default(swift.drives | default([])) %}
{### Loop through the drives to determine if they are in the object group #}
{% for drive in drives %}
{% set devAdded = False %}
{### Check if groups is defined per host or drive #}
{% set groups = drives.groups | default(swift_vars.groups | default(swift.groups | default(def_groups))) %}
{% for group in groups %}
{% if group not in ['account', 'container'] %}
{### We only want to add a device once so check if it was added already #}
{% if not devAdded | bool %}
[object_{{ drive.name }}]
max connections = {{ swift_object_max_rsync_connections }}
path = {{ swift_vars.mount_point | default(swift.mount_point) }}
read only = false
lock file = {{ swift_lock_dir }}/object_{{ drive.name }}.lock
{% endif %}
{% set devAdded = True %}
{% endif %}
{% endfor %}
{% endfor %}
{% else %}
[object]
max connections = {{ swift_object_max_rsync_connections }}
path = {{ swift_vars.mount_point | default(swift.mount_point) }}
read only = false
lock file = {{ swift_lock_dir }}/object.lock
{% endif %}
&include /etc/rsync.d