Store dedicated replication conditions in var

Create a new default var, swift_dedicated_replication, for storing
conditions used to determine if a replication network is being used for
swift. This allows for removing redundant tasks, reducing role run
times.

Change-Id: Ieb4263035527ff069017d40b95787f934fbd308c
This commit is contained in:
Jimmy McCrory 2016-09-21 06:02:56 -07:00
parent c6dd771198
commit 98cb749139
8 changed files with 33 additions and 121 deletions

View File

@ -215,6 +215,8 @@ swift_proxy_server_program_config_options: /etc/swift/proxy-server/proxy-server.
swift_storage_address: 127.0.0.1 swift_storage_address: 127.0.0.1
swift_replication_address: 127.0.0.1 swift_replication_address: 127.0.0.1
swift_dedicated_replication: "{{ (swift.replication_network is defined and swift.replication_network != swift.storage_network) | bool }}"
swift_service_in_ldap: false swift_service_in_ldap: false
# Basic swift configuration for the cluster # Basic swift configuration for the cluster

View File

@ -13,31 +13,18 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# When using a replication network use the specific replicator configuration
# When not using a replication network use the default configuration # When not using a replication network use the default configuration
- include: swift_init_common.yml - include: swift_init_common.yml
vars: vars:
program_name: "swift-account-replicator" program_name: "swift-account-replicator"
program_config_options: "{{ swift_account_server_program_config_options }}" program_config_options: "{{ swift_dedicated_replication | ternary(
'swift_account_replicator_program_config_options',
'swift_account_server_program_config_options') }}"
service_name: "{{ swift_service_name }}" service_name: "{{ swift_service_name }}"
system_user: "{{ swift_system_user_name }}" system_user: "{{ swift_system_user_name }}"
system_group: "{{ swift_system_group_name }}" system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}" service_home: "{{ swift_system_home_folder }}"
when: >
swift.replication_network is not defined or
swift.replication_network == swift.storage_network
# When using a replication network use the specific replicator configuration
- include: swift_init_common.yml
vars:
program_name: "swift-account-replicator"
program_config_options: "{{ swift_account_replicator_program_config_options }}"
service_name: "{{ swift_service_name }}"
system_user: "{{ swift_system_user_name }}"
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
when:
- swift.replication_network is defined
- swift.replication_network != swift.storage_network
# When using a replication network use a second server for dedicated replicator configuration # When using a replication network use a second server for dedicated replicator configuration
# This will be a blank file if not using dedicated replication network to prevent errors # This will be a blank file if not using dedicated replication network to prevent errors
@ -66,26 +53,13 @@
- include: swift_init_common.yml - include: swift_init_common.yml
vars: vars:
program_name: "swift-account-auditor" program_name: "swift-account-auditor"
program_config_options: "{{ swift_account_server_program_config_options }}" program_config_options: "{{ swift_dedicated_replication | ternary(
'swift_account_replicator_program_config_options',
'swift_account_server_program_config_options') }}"
service_name: "{{ swift_service_name }}" service_name: "{{ swift_service_name }}"
system_user: "{{ swift_system_user_name }}" system_user: "{{ swift_system_user_name }}"
system_group: "{{ swift_system_group_name }}" system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}" service_home: "{{ swift_system_home_folder }}"
when: >
swift.replication_network is not defined or
swift.replication_network == swift.storage_network
- include: swift_init_common.yml
vars:
program_name: "swift-account-auditor"
program_config_options: "{{ swift_account_replicator_program_config_options }}"
service_name: "{{ swift_service_name }}"
system_user: "{{ swift_system_user_name }}"
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
when:
- swift.replication_network is defined
- swift.replication_network != swift.storage_network
- include: swift_init_common.yml - include: swift_init_common.yml
vars: vars:
@ -117,9 +91,7 @@
mode: "0644" mode: "0644"
config_overrides: "{{ swift_account_server_replicator_conf_overrides }}" config_overrides: "{{ swift_account_server_replicator_conf_overrides }}"
config_type: "ini" config_type: "ini"
when: when: swift_dedicated_replication
- swift.replication_network is defined
- swift.replication_network != swift.storage_network
notify: Restart swift account services notify: Restart swift account services
# Remove the dedicated replicator configuration when no dedicated replication network in use # Remove the dedicated replicator configuration when no dedicated replication network in use
@ -127,6 +99,4 @@
file: file:
state: absent state: absent
path: "/etc/swift/account-server/account-server-replicator.conf" path: "/etc/swift/account-server/account-server-replicator.conf"
when: > when: not swift_dedicated_replication
swift.replication_network is not defined or
swift.replication_network == swift.storage_network

View File

@ -13,31 +13,18 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# When using a replication network use the specific replicator configuration
# When not using a replication network use the default configuration # When not using a replication network use the default configuration
- include: swift_init_common.yml - include: swift_init_common.yml
vars: vars:
program_name: "swift-container-replicator" program_name: "swift-container-replicator"
program_config_options: "{{ swift_container_server_program_config_options }}" program_config_options: "{{ swift_dedicated_replication | ternary(
'swift_container_replicator_program_config_options',
'swift_container_server_program_config_options') }}"
service_name: "{{ swift_service_name }}" service_name: "{{ swift_service_name }}"
system_user: "{{ swift_system_user_name }}" system_user: "{{ swift_system_user_name }}"
system_group: "{{ swift_system_group_name }}" system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}" service_home: "{{ swift_system_home_folder }}"
when: >
swift.replication_network is not defined or
swift.replication_network == swift.storage_network
# When using a replication network use the specific replicator configuration
- include: swift_init_common.yml
vars:
program_name: "swift-container-replicator"
program_config_options: "{{ swift_container_replicator_program_config_options }}"
service_name: "{{ swift_service_name }}"
system_user: "{{ swift_system_user_name }}"
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
when:
- swift.replication_network is defined
- swift.replication_network != swift.storage_network
# When using a replication network create a second server for dedicated replicator configuration # When using a replication network create a second server for dedicated replicator configuration
# This will be a blank file if not using dedicated replication network to prevent errors # This will be a blank file if not using dedicated replication network to prevent errors
@ -66,26 +53,13 @@
- include: swift_init_common.yml - include: swift_init_common.yml
vars: vars:
program_name: "swift-container-auditor" program_name: "swift-container-auditor"
program_config_options: "{{ swift_container_server_program_config_options }}" program_config_options: "{{ swift_dedicated_replication | ternary(
'swift_container_replicator_program_config_options',
'swift_container_server_program_config_options') }}"
service_name: "{{ swift_service_name }}" service_name: "{{ swift_service_name }}"
system_user: "{{ swift_system_user_name }}" system_user: "{{ swift_system_user_name }}"
system_group: "{{ swift_system_group_name }}" system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}" service_home: "{{ swift_system_home_folder }}"
when: >
swift.replication_network is not defined or
swift.replication_network == swift.storage_network
- include: swift_init_common.yml
vars:
program_name: "swift-container-auditor"
program_config_options: "{{ swift_container_replicator_program_config_options }}"
service_name: "{{ swift_service_name }}"
system_user: "{{ swift_system_user_name }}"
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
when:
- swift.replication_network is defined
- swift.replication_network != swift.storage_network
- include: swift_init_common.yml - include: swift_init_common.yml
vars: vars:
@ -158,9 +132,7 @@
mode: "0644" mode: "0644"
config_overrides: "{{ swift_container_server_replicator_conf_overrides }}" config_overrides: "{{ swift_container_server_replicator_conf_overrides }}"
config_type: "ini" config_type: "ini"
when: when: swift_dedicated_replication
- swift.replication_network is defined
- swift.replication_network != swift.storage_network
notify: Restart swift container services notify: Restart swift container services
# Remove the dedicated replicator configuration when no dedicated replication network in use # Remove the dedicated replicator configuration when no dedicated replication network in use
@ -168,6 +140,4 @@
file: file:
state: absent state: absent
path: "/etc/swift/container-server/container-server-replicator.conf" path: "/etc/swift/container-server/container-server-replicator.conf"
when: > when: not swift_dedicated_replication
swift.replication_network is not defined or
swift.replication_network == swift.storage_network

View File

@ -13,31 +13,18 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# When using a replication network use the specific replicator configuration
# When not using a replication network use the default configuration # When not using a replication network use the default configuration
- include: swift_init_common.yml - include: swift_init_common.yml
vars: vars:
program_name: "swift-object-replicator" program_name: "swift-object-replicator"
program_config_options: "{{ swift_object_server_program_config_options }}" program_config_options: "{{ swift_dedicated_replication | ternary(
'swift_object_replicator_program_config_options',
'swift_object_server_program_config_options') }}"
service_name: "{{ swift_service_name }}" service_name: "{{ swift_service_name }}"
system_user: "{{ swift_system_user_name }}" system_user: "{{ swift_system_user_name }}"
system_group: "{{ swift_system_group_name }}" system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}" service_home: "{{ swift_system_home_folder }}"
when: >
swift.replication_network is not defined or
swift.replication_network == swift.storage_network
# When using a replication network use the specific replicator configuration
- include: swift_init_common.yml
vars:
program_name: "swift-object-replicator"
program_config_options: "{{ swift_object_replicator_program_config_options }}"
service_name: "{{ swift_service_name }}"
system_user: "{{ swift_system_user_name }}"
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
when:
- swift.replication_network is defined
- swift.replication_network != swift.storage_network
# When using a replication network use a second server for dedicated replicator configuration # When using a replication network use a second server for dedicated replicator configuration
# This will be a blank file if not using dedicated replication network to prevent errors # This will be a blank file if not using dedicated replication network to prevent errors
@ -66,26 +53,13 @@
- include: swift_init_common.yml - include: swift_init_common.yml
vars: vars:
program_name: "swift-object-auditor" program_name: "swift-object-auditor"
program_config_options: "{{ swift_object_server_program_config_options }}" program_config_options: "{{ swift_dedicated_replication | ternary(
'swift_object_replicator_program_config_options',
'swift_object_server_program_config_options') }}"
service_name: "{{ swift_service_name }}" service_name: "{{ swift_service_name }}"
system_user: "{{ swift_system_user_name }}" system_user: "{{ swift_system_user_name }}"
system_group: "{{ swift_system_group_name }}" system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}" service_home: "{{ swift_system_home_folder }}"
when: >
swift.replication_network is not defined or
swift.replication_network == swift.storage_network
- include: swift_init_common.yml
vars:
program_name: "swift-object-auditor"
program_config_options: "{{ swift_object_replicator_program_config_options }}"
service_name: "{{ swift_service_name }}"
system_user: "{{ swift_system_user_name }}"
system_group: "{{ swift_system_group_name }}"
service_home: "{{ swift_system_home_folder }}"
when:
- swift.replication_network is defined
- swift.replication_network != swift.storage_network
- include: swift_init_common.yml - include: swift_init_common.yml
vars: vars:
@ -135,9 +109,7 @@
mode: "0644" mode: "0644"
config_overrides: "{{ swift_object_server_replicator_conf_overrides }}" config_overrides: "{{ swift_object_server_replicator_conf_overrides }}"
config_type: "ini" config_type: "ini"
when: when: swift_dedicated_replication
- swift.replication_network is defined
- swift.replication_network != swift.storage_network
notify: Restart swift object services notify: Restart swift object services
# Remove the dedicated replicator configuration when no dedicated replication network in use # Remove the dedicated replicator configuration when no dedicated replication network in use
@ -145,9 +117,7 @@
file: file:
state: absent state: absent
path: "/etc/swift/object-server/object-server-replicator.conf" path: "/etc/swift/object-server/object-server-replicator.conf"
when: > when: not swift_dedicated_replication
swift.replication_network is not defined or
swift.replication_network == swift.storage_network
- name: Deploy drive-audit configuration file - name: Deploy drive-audit configuration file
config_template: config_template:

View File

@ -34,7 +34,7 @@ log_facility = LOG_LOCAL2
recon_cache_path = /var/cache/swift recon_cache_path = /var/cache/swift
recon_lock_path = /var/lock recon_lock_path = /var/lock
{% if swift.replication_network is not defined or swift.replication_network == swift.storage_network %} {% if not swift_dedicated_replication %}
[account-replicator] [account-replicator]
log_facility = LOG_LOCAL2 log_facility = LOG_LOCAL2
per_diff = 10000 per_diff = 10000

View File

@ -35,7 +35,7 @@ log_facility = LOG_LOCAL3
recon_cache_path = /var/cache/swift recon_cache_path = /var/cache/swift
recon_lock_path = /var/lock recon_lock_path = /var/lock
{% if swift.replication_network is not defined or swift.replication_network == swift.storage_network %} {% if not swift_dedicated_replication %}
[container-replicator] [container-replicator]
log_facility = LOG_LOCAL3 log_facility = LOG_LOCAL3
reclaim_age = {{ reclaim_age | default(604800) }} reclaim_age = {{ reclaim_age | default(604800) }}

View File

@ -36,7 +36,7 @@ log_facility = LOG_LOCAL4
recon_cache_path = /var/cache/swift recon_cache_path = /var/cache/swift
recon_lock_path = /var/lock recon_lock_path = /var/lock
{% if swift.replication_network is not defined or swift.replication_network == swift.storage_network %} {% if not swift_dedicated_replication %}
[object-replicator] [object-replicator]
log_facility = LOG_LOCAL4 log_facility = LOG_LOCAL4
concurrency = 6 concurrency = 6

View File

@ -1,5 +1,5 @@
# {{ ansible_managed }} # {{ ansible_managed }}
{% if (swift.replication_network is not defined or swift.replication_network == swift.storage_network) and 'replicator-server' in program_name %} {% if not swift_dedicated_replication and 'replicator-server' in program_name %}
# Blank script - dedicated replication network not in use # Blank script - dedicated replication network not in use
{% else %} {% else %}