From 8cf39b11ff0dab230b6ad2698b7512679d05e2e1 Mon Sep 17 00:00:00 2001 From: Andy McCrae Date: Tue, 3 Mar 2015 11:15:54 +0000 Subject: [PATCH] Ensure replication_network is not required for swift * Adjust config location variables for account, container, object variables, to name them more clearly. * Adjust config placement order, to happen after init scripts are created so that the service restart handler will work appropriately. * Ensure the init scripts for the replicator service are created appropriately whether a dedicated replication_network is or isn't used. * Ensure the dedicated replication network configuration is only created when replication_network is specified and different to storage_network. * Ensure the appropriate configuration section in the server.conf is only added when the replication_network is specified and different to the storage_network. Change-Id: I4b204a974bb0a217f5222b6aa0fa36aa8c23b999 Closes-Bug: #1427599 --- playbooks/roles/os_swift/defaults/main.yml | 6 +-- .../os_swift/tasks/swift_proxy_hosts.yml | 16 +++--- .../tasks/swift_storage_hosts_account.yml | 50 ++++++++++++------- .../tasks/swift_storage_hosts_container.yml | 50 ++++++++++++------- .../swift_storage_hosts_object_server.yml | 50 ++++++++++++------- .../os_swift/templates/account-server.conf.j2 | 2 +- .../templates/container-server.conf.j2 | 2 +- .../os_swift/templates/object-server.conf.j2 | 2 +- 8 files changed, 113 insertions(+), 65 deletions(-) diff --git a/playbooks/roles/os_swift/defaults/main.yml b/playbooks/roles/os_swift/defaults/main.yml index 10f397f1dc..93e9ea8ebf 100644 --- a/playbooks/roles/os_swift/defaults/main.yml +++ b/playbooks/roles/os_swift/defaults/main.yml @@ -67,13 +67,13 @@ swift_service_admin_tenant_name: "service" swift_service_admin_username: "swift" swift_account_server_program_config_options: /etc/swift/account-server/account-server.conf -swift_account_server_replicator_program_config_options: /etc/swift/account-server/account-server-replicator.conf +swift_account_replicator_program_config_options: /etc/swift/account-server/account-server-replicator.conf swift_container_server_program_config_options: /etc/swift/container-server/container-server.conf -swift_container_server_replicator_program_config_options: /etc/swift/container-server/container-server-replicator.conf +swift_container_replicator_program_config_options: /etc/swift/container-server/container-server-replicator.conf swift_object_server_program_config_options: /etc/swift/object-server/object-server.conf -swift_object_server_replicator_program_config_options: /etc/swift/object-server/object-server-replicator.conf +swift_object_replicator_program_config_options: /etc/swift/object-server/object-server-replicator.conf swift_proxy_server_program_config_options: /etc/swift/proxy-server/proxy-server.conf diff --git a/playbooks/roles/os_swift/tasks/swift_proxy_hosts.yml b/playbooks/roles/os_swift/tasks/swift_proxy_hosts.yml index 083db23003..053314442c 100644 --- a/playbooks/roles/os_swift/tasks/swift_proxy_hosts.yml +++ b/playbooks/roles/os_swift/tasks/swift_proxy_hosts.yml @@ -13,14 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: swift proxy server configuration - template: - src: "proxy-server.conf.j2" - dest: "/etc/swift/proxy-server/proxy-server.conf" - owner: "{{ swift_system_user_name }}" - mode: "0644" - notify: Restart swift services - - include: swift_upstart_common_init.yml vars: program_name: "swift-proxy-server" @@ -29,3 +21,11 @@ system_user: "{{ swift_system_user_name }}" system_group: "{{ swift_system_group_name }}" service_home: "{{ swift_system_home_folder }}" + +- name: swift proxy server configuration + template: + src: "proxy-server.conf.j2" + dest: "/etc/swift/proxy-server/proxy-server.conf" + owner: "{{ swift_system_user_name }}" + mode: "0644" + notify: Restart swift services diff --git a/playbooks/roles/os_swift/tasks/swift_storage_hosts_account.yml b/playbooks/roles/os_swift/tasks/swift_storage_hosts_account.yml index 33e56fa3f2..760d0aa784 100644 --- a/playbooks/roles/os_swift/tasks/swift_storage_hosts_account.yml +++ b/playbooks/roles/os_swift/tasks/swift_storage_hosts_account.yml @@ -13,34 +13,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: "Swift account server config with replication" - template: - src: "{{ item.src }}" - dest: "{{ item.dest }}" - owner: "{{ swift_system_user_name }}" - group: "{{ swift_system_group_name }}" - mode: "0644" - with_items: - - { src: "account-server.conf.j2", dest: "/etc/swift/account-server/account-server.conf" } - - { src: "account-server-replicator.conf.j2", dest: "/etc/swift/account-server/account-server-replicator.conf" } - notify: Restart swift services - +# When not using a replication network use the default configuration - include: swift_upstart_common_init.yml vars: - program_name: "swift-account-server-replicator" - program_config_options: "{{ swift_account_server_replicator_program_config_options }}" + program_name: "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 defined and - swift.replication_network != swift.storage_network + 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_upstart_common_init.yml vars: program_name: "swift-account-replicator" - program_config_options: "{{ swift_account_server_replicator_program_config_options }}" + 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 }}" @@ -75,3 +65,29 @@ system_user: "{{ swift_system_user_name }}" system_group: "{{ swift_system_group_name }}" service_home: "{{ swift_system_home_folder }}" + +- name: "Swift account server configuration" + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "{{ swift_system_user_name }}" + group: "{{ swift_system_group_name }}" + mode: "0644" + with_items: + - { src: "account-server.conf.j2", dest: "/etc/swift/account-server/account-server.conf" } + notify: Restart swift services + +# We only create the dedicated replicator configuration when using a dedicated replication_network +- name: "Swift account server replicator configuration" + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "{{ swift_system_user_name }}" + group: "{{ swift_system_group_name }}" + mode: "0644" + with_items: + - { src: "account-server-replicator.conf.j2", dest: "/etc/swift/account-server/account-server-replicator.conf" } + when: > + swift.replication_network is defined and + swift.replication_network != swift.storage_network + notify: Restart swift services diff --git a/playbooks/roles/os_swift/tasks/swift_storage_hosts_container.yml b/playbooks/roles/os_swift/tasks/swift_storage_hosts_container.yml index 9e315b184e..2a3c22e79a 100644 --- a/playbooks/roles/os_swift/tasks/swift_storage_hosts_container.yml +++ b/playbooks/roles/os_swift/tasks/swift_storage_hosts_container.yml @@ -13,34 +13,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: "Swift container server configuration" - template: - src: "{{ item.src }}" - dest: "{{ item.dest }}" - owner: "{{ swift_system_user_name }}" - group: "{{ swift_system_group_name }}" - mode: "0644" - with_items: - - { src: "container-server.conf.j2", dest: "/etc/swift/container-server/container-server.conf" } - - { src: "container-server-replicator.conf.j2", dest: "/etc/swift/container-server/container-server-replicator.conf" } - notify: Restart swift services - +# When not using a replication network use the default configuration - include: swift_upstart_common_init.yml vars: - program_name: "swift-container-server-replicator" - program_config_options: "{{ swift_container_server_replicator_program_config_options }}" + program_name: "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 defined and - swift.replication_network != swift.storage_network + 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_upstart_common_init.yml vars: program_name: "swift-container-replicator" - program_config_options: "{{ swift_container_server_replicator_program_config_options }}" + 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 }}" @@ -84,3 +74,29 @@ system_user: "{{ swift_system_user_name }}" system_group: "{{ swift_system_group_name }}" service_home: "{{ swift_system_home_folder }}" + +- name: "Swift container server configuration" + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "{{ swift_system_user_name }}" + group: "{{ swift_system_group_name }}" + mode: "0644" + with_items: + - { src: "container-server.conf.j2", dest: "/etc/swift/container-server/container-server.conf" } + notify: Restart swift services + +# We only create the dedicated replicator configuration when using a dedicated replication_network +- name: "Swift container server configuration" + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "{{ swift_system_user_name }}" + group: "{{ swift_system_group_name }}" + mode: "0644" + with_items: + - { src: "container-server-replicator.conf.j2", dest: "/etc/swift/container-server/container-server-replicator.conf" } + when: > + swift.replication_network is defined and + swift.replication_network != swift.storage_network + notify: Restart swift services diff --git a/playbooks/roles/os_swift/tasks/swift_storage_hosts_object_server.yml b/playbooks/roles/os_swift/tasks/swift_storage_hosts_object_server.yml index 6a19c46110..7f3e747e39 100644 --- a/playbooks/roles/os_swift/tasks/swift_storage_hosts_object_server.yml +++ b/playbooks/roles/os_swift/tasks/swift_storage_hosts_object_server.yml @@ -13,34 +13,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: "Swift object server configuration" - template: - src: "{{ item.src }}" - dest: "{{ item.dest }}" - owner: "{{ swift_system_user_name }}" - group: "{{ swift_system_group_name }}" - mode: "0644" - with_items: - - { src: "object-server.conf.j2", dest: "/etc/swift/object-server/object-server.conf" } - - { src: "object-server-replicator.conf.j2", dest: "/etc/swift/object-server/object-server-replicator.conf" } - notify: Restart swift services - +# When not using a replication network use the default configuration - include: swift_upstart_common_init.yml vars: - program_name: "swift-object-server-replicator" - program_config_options: "{{ swift_object_server_replicator_program_config_options }}" + program_name: "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 defined and - swift.replication_network != swift.storage_network + 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_upstart_common_init.yml vars: program_name: "swift-object-replicator" - program_config_options: "{{ swift_object_server_replicator_program_config_options }}" + 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 }}" @@ -75,3 +65,29 @@ system_user: "{{ swift_system_user_name }}" system_group: "{{ swift_system_group_name }}" service_home: "{{ swift_system_home_folder }}" + +- name: "Swift object server configuration" + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "{{ swift_system_user_name }}" + group: "{{ swift_system_group_name }}" + mode: "0644" + with_items: + - { src: "object-server.conf.j2", dest: "/etc/swift/object-server/object-server.conf" } + notify: Restart swift services + +# We only create the dedicated replicator configuration when using a dedicated replication_network +- name: "Swift object server configuration" + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "{{ swift_system_user_name }}" + group: "{{ swift_system_group_name }}" + mode: "0644" + with_items: + - { src: "object-server-replicator.conf.j2", dest: "/etc/swift/object-server/object-server-replicator.conf" } + when: > + swift.replication_network is defined and + swift.replication_network != swift.storage_network + notify: Restart swift services diff --git a/playbooks/roles/os_swift/templates/account-server.conf.j2 b/playbooks/roles/os_swift/templates/account-server.conf.j2 index 49f8c9850f..13bfc6d903 100644 --- a/playbooks/roles/os_swift/templates/account-server.conf.j2 +++ b/playbooks/roles/os_swift/templates/account-server.conf.j2 @@ -33,7 +33,7 @@ log_facility = LOG_LOCAL2 recon_cache_path = /var/cache/swift recon_lock_path = /var/lock/swift -{% if swift.replication_network is not defined %} +{% if swift.replication_network is not defined or swift.replication_network == swift.storage_network %} [account-replicator] log_facility = LOG_LOCAL2 per_diff = 10000 diff --git a/playbooks/roles/os_swift/templates/container-server.conf.j2 b/playbooks/roles/os_swift/templates/container-server.conf.j2 index dd0621b953..81c4bb2b02 100644 --- a/playbooks/roles/os_swift/templates/container-server.conf.j2 +++ b/playbooks/roles/os_swift/templates/container-server.conf.j2 @@ -33,7 +33,7 @@ log_facility = LOG_LOCAL3 recon_cache_path = /var/cache/swift recon_lock_path = /var/lock/swift -{% if swift.replication_network is not defined %} +{% if swift.replication_network is not defined or swift.replication_network == swift.storage_network %} [container-replicator] log_facility = LOG_LOCAL3 {% endif %} diff --git a/playbooks/roles/os_swift/templates/object-server.conf.j2 b/playbooks/roles/os_swift/templates/object-server.conf.j2 index 2cdac80358..549f092ae1 100644 --- a/playbooks/roles/os_swift/templates/object-server.conf.j2 +++ b/playbooks/roles/os_swift/templates/object-server.conf.j2 @@ -35,7 +35,7 @@ log_facility = LOG_LOCAL4 recon_cache_path = /var/cache/swift recon_lock_path = /var/lock/swift -{% if swift.replication_network is not defined %} +{% if swift.replication_network is not defined or swift.replication_network == swift.storage_network %} [object-replicator] log_facility = LOG_LOCAL4 concurrency = 6