diff --git a/rpc_deployment/roles/swift_storage_setup/handlers/main.yml b/rpc_deployment/roles/swift_storage_setup/handlers/main.yml new file mode 100644 index 0000000000..3aa0d701cf --- /dev/null +++ b/rpc_deployment/roles/swift_storage_setup/handlers/main.yml @@ -0,0 +1,23 @@ +--- +# Copyright 2014, Rackspace US, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- name: Restart rsync service + service: name=rsync state=restarted pattern=rsync + register: service_restart + failed_when: "'msg' in service_restart and 'FAIL' in service_restart.msg|upper" + notify: Ensure rsync service running + +- name: Ensure rsync service running + service: name=rsync state=started pattern=rsync diff --git a/rpc_deployment/roles/swift_storage_setup/tasks/main.yml b/rpc_deployment/roles/swift_storage_setup/tasks/main.yml index 4722d8efce..edf48fdd3b 100644 --- a/rpc_deployment/roles/swift_storage_setup/tasks/main.yml +++ b/rpc_deployment/roles/swift_storage_setup/tasks/main.yml @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +- include: rsync_setup.yml + - name: "Set ownership on mounted drives" file: dest: "{{ swift_vars.mount_point | default(swift.mount_point) }}/{{ item.name }}" diff --git a/rpc_deployment/roles/swift_storage_setup/tasks/rsync_setup.yml b/rpc_deployment/roles/swift_storage_setup/tasks/rsync_setup.yml new file mode 100644 index 0000000000..6ef217c3ba --- /dev/null +++ b/rpc_deployment/roles/swift_storage_setup/tasks/rsync_setup.yml @@ -0,0 +1,29 @@ +--- +# Copyright 2014, Rackspace US, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- name: "Put /etc/rsyncd.conf in place" + template: > + src=rsyncd.conf.j2 + dest=/etc/rsyncd.conf + owner=root + mode=0644 + notify: Restart rsync service + +- name: "Enable rsync in defaults" + lineinfile: > + dest=/etc/default/rsync + line="RSYNC_ENABLE=true" + regexp="^RSYNC_ENABLE*" + notify: Restart rsync service diff --git a/rpc_deployment/roles/swift_storage_setup/templates/rsyncd.conf.j2 b/rpc_deployment/roles/swift_storage_setup/templates/rsyncd.conf.j2 new file mode 100644 index 0000000000..f87d281e3a --- /dev/null +++ b/rpc_deployment/roles/swift_storage_setup/templates/rsyncd.conf.j2 @@ -0,0 +1,30 @@ +{% if is_metal == true and swift.replication_network is defined %} +{% set repl_bridge = 'ansible_' + swift.replication_network|replace('-', '_') %} +{% set bind_ip = hostvars[inventory_hostname][repl_bridge]['ipv4']['address'] %} +{% elif is_metal == true and swift.storage_network is defined %} +{% set storage_bridge = 'ansible_' + swift.storage_network|replace('-', '_') %} +{% set bind_ip = hostvars[inventory_hostname][storage_bridge]['ipv4']['address'] %} +{% endif %} +uid = {{ system_user }} +gid = {{ system_user }} +log file = /var/log/rsyncd.log +pid file = /var/run/rsyncd.pid +address = {{ bind_ip | default(container_address) }} + +[account] +max connections = 2 +path = {{ swift_vars.mount_point | default(swift.mount_point) }} +read only = false +lock file = /var/lock/account.lock + +[container] +max connections = 2 +path = {{ swift_vars.mount_point | default(swift.mount_point) }} +read only = false +lock file = /var/lock/container.lock + +[object] +max connections = 2 +path = {{ swift_vars.mount_point | default(swift.mount_point) }} +read only = false +lock file = /var/lock/object.lock