diff --git a/defaults/main.yml b/defaults/main.yml index 47ddf237..37e8ea2f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -215,6 +215,8 @@ swift_proxy_server_program_config_options: /etc/swift/proxy-server/proxy-server. swift_storage_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 # Basic swift configuration for the cluster diff --git a/tasks/swift_storage_hosts_account.yml b/tasks/swift_storage_hosts_account.yml index a1efe8d5..0dd784c1 100644 --- a/tasks/swift_storage_hosts_account.yml +++ b/tasks/swift_storage_hosts_account.yml @@ -13,31 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +# When using a replication network use the specific replicator configuration # When not using a replication network use the default configuration - include: swift_init_common.yml vars: 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 }}" system_user: "{{ swift_system_user_name }}" system_group: "{{ swift_system_group_name }}" 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 # This will be a blank file if not using dedicated replication network to prevent errors @@ -66,26 +53,13 @@ - include: swift_init_common.yml vars: 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 }}" system_user: "{{ swift_system_user_name }}" system_group: "{{ swift_system_group_name }}" 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 vars: @@ -117,9 +91,7 @@ mode: "0644" config_overrides: "{{ swift_account_server_replicator_conf_overrides }}" config_type: "ini" - when: - - swift.replication_network is defined - - swift.replication_network != swift.storage_network + when: swift_dedicated_replication notify: Restart swift account services # Remove the dedicated replicator configuration when no dedicated replication network in use @@ -127,6 +99,4 @@ file: state: absent path: "/etc/swift/account-server/account-server-replicator.conf" - when: > - swift.replication_network is not defined or - swift.replication_network == swift.storage_network + when: not swift_dedicated_replication diff --git a/tasks/swift_storage_hosts_container.yml b/tasks/swift_storage_hosts_container.yml index 953943df..adddcef6 100644 --- a/tasks/swift_storage_hosts_container.yml +++ b/tasks/swift_storage_hosts_container.yml @@ -13,31 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +# When using a replication network use the specific replicator configuration # When not using a replication network use the default configuration - include: swift_init_common.yml vars: 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 }}" system_user: "{{ swift_system_user_name }}" system_group: "{{ swift_system_group_name }}" 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 # This will be a blank file if not using dedicated replication network to prevent errors @@ -66,26 +53,13 @@ - include: swift_init_common.yml vars: 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 }}" system_user: "{{ swift_system_user_name }}" system_group: "{{ swift_system_group_name }}" 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 vars: @@ -158,9 +132,7 @@ mode: "0644" config_overrides: "{{ swift_container_server_replicator_conf_overrides }}" config_type: "ini" - when: - - swift.replication_network is defined - - swift.replication_network != swift.storage_network + when: swift_dedicated_replication notify: Restart swift container services # Remove the dedicated replicator configuration when no dedicated replication network in use @@ -168,6 +140,4 @@ file: state: absent path: "/etc/swift/container-server/container-server-replicator.conf" - when: > - swift.replication_network is not defined or - swift.replication_network == swift.storage_network + when: not swift_dedicated_replication diff --git a/tasks/swift_storage_hosts_object.yml b/tasks/swift_storage_hosts_object.yml index 5b9a250c..23a455f0 100644 --- a/tasks/swift_storage_hosts_object.yml +++ b/tasks/swift_storage_hosts_object.yml @@ -13,31 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +# When using a replication network use the specific replicator configuration # When not using a replication network use the default configuration - include: swift_init_common.yml vars: 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 }}" system_user: "{{ swift_system_user_name }}" system_group: "{{ swift_system_group_name }}" 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 # This will be a blank file if not using dedicated replication network to prevent errors @@ -66,26 +53,13 @@ - include: swift_init_common.yml vars: 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 }}" system_user: "{{ swift_system_user_name }}" system_group: "{{ swift_system_group_name }}" 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 vars: @@ -135,9 +109,7 @@ mode: "0644" config_overrides: "{{ swift_object_server_replicator_conf_overrides }}" config_type: "ini" - when: - - swift.replication_network is defined - - swift.replication_network != swift.storage_network + when: swift_dedicated_replication notify: Restart swift object services # Remove the dedicated replicator configuration when no dedicated replication network in use @@ -145,9 +117,7 @@ file: state: absent path: "/etc/swift/object-server/object-server-replicator.conf" - when: > - swift.replication_network is not defined or - swift.replication_network == swift.storage_network + when: not swift_dedicated_replication - name: Deploy drive-audit configuration file config_template: diff --git a/templates/account-server.conf.j2 b/templates/account-server.conf.j2 index 367ac54f..5fb76344 100644 --- a/templates/account-server.conf.j2 +++ b/templates/account-server.conf.j2 @@ -34,7 +34,7 @@ log_facility = LOG_LOCAL2 recon_cache_path = /var/cache/swift 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] log_facility = LOG_LOCAL2 per_diff = 10000 diff --git a/templates/container-server.conf.j2 b/templates/container-server.conf.j2 index 5f8161a8..3b29dab0 100644 --- a/templates/container-server.conf.j2 +++ b/templates/container-server.conf.j2 @@ -35,7 +35,7 @@ log_facility = LOG_LOCAL3 recon_cache_path = /var/cache/swift 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] log_facility = LOG_LOCAL3 reclaim_age = {{ reclaim_age | default(604800) }} diff --git a/templates/object-server.conf.j2 b/templates/object-server.conf.j2 index 65017531..34e8e36b 100644 --- a/templates/object-server.conf.j2 +++ b/templates/object-server.conf.j2 @@ -36,7 +36,7 @@ log_facility = LOG_LOCAL4 recon_cache_path = /var/cache/swift 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] log_facility = LOG_LOCAL4 concurrency = 6 diff --git a/templates/swift-upstart-init.j2 b/templates/swift-upstart-init.j2 index 77bcc940..80fc655c 100644 --- a/templates/swift-upstart-init.j2 +++ b/templates/swift-upstart-init.j2 @@ -1,5 +1,5 @@ # {{ 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 {% else %}