Merge "Adjust the network rings are syncd on"

This commit is contained in:
Jenkins 2015-07-20 11:15:37 +00:00 committed by Gerrit Code Review
commit 037829465e
4 changed files with 43 additions and 8 deletions

View File

@ -15,6 +15,8 @@
- include: swift_rings_md5sum.yml
- include: swift_storage_address.yml
- include: swift_rings_check.yml
when: >
inventory_hostname == groups['swift_hosts'][0]

View File

@ -17,7 +17,7 @@
shell: |
rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' \
-avz \
{{ swift_system_user_name }}@{{ hostvars[groups['swift_hosts'][0]]['ansible_ssh_host'] }}:/etc/swift/ring_build_files/ \
{{ swift_system_user_name }}@{{ hostvars[groups['swift_hosts'][0]]['swift_storage_address'] }}:/etc/swift/ring_build_files/ \
/etc/swift/
sudo: yes
sudo_user: "{{ swift_system_user_name }}"
@ -30,7 +30,7 @@
shell: |
rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' \
-avz \
{{ swift_system_user_name }}@{{ hostvars[groups['swift_hosts'][0]]['ansible_ssh_host'] }}:/etc/swift/ring_build_files/ \
{{ swift_system_user_name }}@{{ hostvars[groups['swift_hosts'][0]]['swift_storage_address'] }}:/etc/swift/ring_build_files/ \
/etc/swift/ring_build_files/
sudo: yes
sudo_user: "{{ swift_system_user_name }}"

View File

@ -0,0 +1,37 @@
---
# 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.
# We need the storage network for replication of the ring
# We find the IP on the "storage_bridge" network for storage hosts
- name: Register a fact for the default storage IP swift hosts
set_fact:
swift_storage_address: "{{ hostvars[inventory_hostname]['swift_vars']['storage_ip'] | default(hostvars[inventory_hostname]['ansible_' + swift.storage_network|replace('-','_')]['ipv4']['address'] | default(hostvars[inventory_hostname]['ansible_ssh_host'])) }}"
when: inventory_hostname in groups['swift_hosts'] and
swift.storage_network is defined
# For proxy servers this is mapped to an interface that isn't the bridge
- name: Register a fact for the default storage IP on proxy servers
set_fact:
swift_storage_address: "{{ item.value.address }}"
with_dict: container_networks
when: inventory_hostname in groups['swift_proxy'] and
swift.storage_network is defined and
item.value.bridge == swift.storage_network
# A catchall, and for remote hosts the IP is just the ansible_ssh_host IP
- name: Register a fact for the default storage IP when no storage-network is defined or for remote hosts
set_fact:
swift_storage_address: "{{ hostvars[inventory_hostname]['ansible_ssh_host'] }}"
when: swift.storage_network is not defined

View File

@ -47,11 +47,7 @@
{### Loop through the swift_hosts #}
{% for host in groups['swift_hosts'] %}
{### Set the default storage_ip #}
{% set def_storage_ip = hostvars[host]['ansible_ssh_host'] %}
{% if swift.storage_network is defined %}
{% set storage_bridge = 'ansible_' + swift.storage_network|replace('-', '_') %}
{% set def_storage_ip = hostvars[host][storage_bridge]['ipv4']['address'] | default(hostvars[host]['ansible_ssh_host']) %}
{% endif %}
{% set def_storage_ip = hostvars[host]['swift_storage_address'] %}
{### Set the default replication_ip #}
{% set def_repl_ip = def_storage_ip %}
{% if swift.replication_network is defined %}
@ -80,7 +76,7 @@
{% set zone = drive.zone | default(swift_vars.zone | default(swift.zone | default(swift_default_host_zone))) %}
{% set repl_ip = drive.repl_ip | default(swift_vars.repl_ip | default(def_repl_ip)) %}
{% set repl_port = drive.repl_port | default(swift_vars.repl_port | default(port)) %}
{% set storage_ip = drive.storage_ip | default(swift_vars.storage_ip | default(def_storage_ip)) %}
{% set storage_ip = drive.storage_ip | default(def_storage_ip) %}
{% set storage_port = drive.storage_port | default(swift_vars.storage_port | default(port)) %}
{### Update the device with the appropriate values #}
{% set _update = device.update({'device':drive.name}) %}