Use dictionary for service mappings
Change the 'swift_x_program_names' from a list to a dictionary mapping of services, groups that install those services. This brings the method into line with that used in the os_neutron role in order to implement a more standardised method. The init tasks have been updated to run once and loop through this mapping rather than being included multiple times and re-run against each host. This may potentially reduce role run times. Currently the reload of upstart/systemd scripts may not happen if only one script changes as the task uses a loop with only one result register. This patch implements handlers to reload upstart/systemd scripts to ensure that this happens when any one of the scripts change. The handler to reload the services now only tries to restart the service if the host is in the group for the service according to the service group mapping. This allows us to ensure that handler failures are no longer ignored and that no execution time is wasted trying to restart services which do not exist on the host. Finally: - Common variables shared by each service's template files have been updated to use the service namespaced variables. - Unused handlers have been removed. - Unused variables have been removed. Change-Id: Id35de501acf6b3164221085f8f9e142234ea0d73
This commit is contained in:
parent
4c1fbcd8e5
commit
bf1ab1750a
@ -169,19 +169,6 @@ swift_rabbitmq_telemetry_servers: "127.0.0.1"
|
||||
# For now swift ceilometer does not work with SSL - this is a speculative option in the hope it gets added
|
||||
swift_rabbitmq_telemetry_use_ssl: "False"
|
||||
|
||||
swift_account_server_program_config_options: /etc/swift/account-server/account-server.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_replicator_program_config_options: /etc/swift/container-server/container-server-replicator.conf
|
||||
swift_container_reconciler_program_config_options: /etc/swift/container-server/container-reconciler.conf
|
||||
|
||||
swift_object_server_program_config_options: /etc/swift/object-server/object-server.conf
|
||||
swift_object_replicator_program_config_options: /etc/swift/object-server/object-server-replicator.conf
|
||||
swift_object_expirer_program_config_options: /etc/swift/object-server/object-expirer.conf
|
||||
|
||||
swift_proxy_server_program_config_options: /etc/swift/proxy-server/proxy-server.conf
|
||||
|
||||
## General Swift configuration
|
||||
# If ``swift_account_server_replicator_workers`` is unset the system will use half the number
|
||||
# of available VCPUS to compute the number of api workers to use.
|
||||
@ -299,32 +286,86 @@ swift_pip_packages:
|
||||
- python-swiftclient
|
||||
- swift
|
||||
|
||||
swift_account_program_names:
|
||||
- swift-account-server
|
||||
- swift-account-auditor
|
||||
- swift-account-replicator
|
||||
- swift-account-reaper
|
||||
- swift-account-replicator-server
|
||||
|
||||
swift_container_program_names:
|
||||
- swift-container-server
|
||||
- swift-container-auditor
|
||||
- swift-container-replicator
|
||||
- swift-container-sync
|
||||
- swift-container-updater
|
||||
- swift-container-replicator-server
|
||||
- swift-container-reconciler
|
||||
|
||||
swift_object_program_names:
|
||||
- swift-object-server
|
||||
- swift-object-auditor
|
||||
- swift-object-replicator
|
||||
- swift-object-updater
|
||||
- swift-object-replicator-server
|
||||
- swift-object-expirer
|
||||
|
||||
swift_proxy_program_names:
|
||||
- swift-proxy-server
|
||||
swift_services:
|
||||
swift-account-replicator:
|
||||
group: swift_acc
|
||||
program_name: "swift-account-replicator"
|
||||
program_config_options: "{{ swift_dedicated_replication | ternary('/etc/swift/account-server/account-server-replicator.conf', '/etc/swift/account-server/account-server.conf') }}"
|
||||
swift-account-replicator-server:
|
||||
group: swift_acc
|
||||
program_name: "swift-account-replicator-server"
|
||||
program_binary: "swift-account-server"
|
||||
program_config_options: "/etc/swift/account-server/account-server-replicator.conf"
|
||||
swift-account-server:
|
||||
group: swift_acc
|
||||
program_name: "swift-account-server"
|
||||
program_config_options: "/etc/swift/account-server/account-server.conf"
|
||||
swift-account-auditor:
|
||||
group: swift_acc
|
||||
program_name: "swift-account-auditor"
|
||||
program_config_options: "{{ swift_dedicated_replication | ternary('/etc/swift/account-server/account-server-replicator.conf', '/etc/swift/account-server/account-server.conf') }}"
|
||||
swift-account-reaper:
|
||||
group: swift_acc
|
||||
program_name: "swift-account-reaper"
|
||||
program_config_options: "/etc/swift/account-server/account-server.conf"
|
||||
swift-container-replicator:
|
||||
group: swift_cont
|
||||
program_name: "swift-container-replicator"
|
||||
program_config_options: "{{ swift_dedicated_replication | ternary('/etc/swift/container-server/container-server-replicator.conf', '/etc/swift/container-server/container-server.conf') }}"
|
||||
swift-container-replicator-server:
|
||||
group: swift_cont
|
||||
program_name: "swift-container-replicator-server"
|
||||
program_binary: "swift-container-server"
|
||||
program_config_options: "/etc/swift/container-server/container-server-replicator.conf"
|
||||
swift-container-server:
|
||||
group: swift_cont
|
||||
program_name: "swift-container-server"
|
||||
program_config_options: "/etc/swift/container-server/container-server.conf"
|
||||
swift-container-auditor:
|
||||
group: swift_cont
|
||||
program_name: "swift-container-auditor"
|
||||
program_config_options: "{{ swift_dedicated_replication | ternary('/etc/swift/container-server/container-server-replicator.conf', '/etc/swift/container-server/container-server.conf') }}"
|
||||
swift-container-sync:
|
||||
group: swift_cont
|
||||
program_name: "swift-container-sync"
|
||||
program_config_options: "/etc/swift/container-server/container-server.conf"
|
||||
swift-container-updater:
|
||||
group: swift_cont
|
||||
program_name: "swift-container-updater"
|
||||
program_config_options: "/etc/swift/container-server/container-server.conf"
|
||||
swift-container-reconciler:
|
||||
group: swift_cont
|
||||
program_name: "swift-container-reconciler"
|
||||
program_config_options: "/etc/swift/container-server/container-reconciler.conf"
|
||||
swift-object-replicator:
|
||||
group: swift_obj
|
||||
program_name: "swift-object-replicator"
|
||||
program_config_options: "{{ swift_dedicated_replication | ternary('/etc/swift/object-server/object-server-replicator.conf', '/etc/swift/object-server/object-server.conf') }}"
|
||||
swift-object-replicator-server:
|
||||
group: swift_obj
|
||||
program_name: "swift-object-replicator-server"
|
||||
program_binary: "swift-object-server"
|
||||
program_config_options: "/etc/swift/object-server/object-server-replicator.conf"
|
||||
swift-object-server:
|
||||
group: swift_obj
|
||||
program_name: "swift-object-server"
|
||||
program_config_options: "/etc/swift/object-server/object-server.conf"
|
||||
swift-object-auditor:
|
||||
group: swift_obj
|
||||
program_name: "swift-object-auditor"
|
||||
program_config_options: "{{ swift_dedicated_replication | ternary('/etc/swift/object-server/object-server-replicator.conf', '/etc/swift/object-server/object-server.conf') }}"
|
||||
swift-object-updater:
|
||||
group: swift_obj
|
||||
program_name: "swift-object-updater"
|
||||
program_config_options: "/etc/swift/object-server/object-server.conf"
|
||||
swift-object-expirer:
|
||||
group: swift_obj
|
||||
program_name: "swift-object-expirer"
|
||||
program_config_options: "/etc/swift/object-server/object-expirer.conf"
|
||||
swift-proxy-server:
|
||||
group: swift_proxy
|
||||
program_name: "swift-proxy-server"
|
||||
program_config_options: "/etc/swift/proxy-server/proxy-server.conf"
|
||||
|
||||
# Set to True to reset the clock on the last time a rebalance happened,
|
||||
# circumventing the min_part_hours check.
|
||||
|
@ -13,49 +13,24 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Restart swift account services
|
||||
service:
|
||||
name: "{{ item }}"
|
||||
state: "restarted"
|
||||
pattern: "{{ item }}"
|
||||
register: service_restart
|
||||
with_items: "{{ swift_account_program_names }}"
|
||||
failed_when: false
|
||||
- name: Reload systemd daemon
|
||||
command: "systemctl daemon-reload"
|
||||
notify:
|
||||
- Restart swift services
|
||||
|
||||
- name: Restart swift container services
|
||||
service:
|
||||
name: "{{ item }}"
|
||||
state: "restarted"
|
||||
pattern: "{{ item }}"
|
||||
register: service_restart
|
||||
with_items: "{{ swift_container_program_names }}"
|
||||
failed_when: false
|
||||
- name: Reload upstart init scripts
|
||||
shell: |
|
||||
initctl reload-configuration
|
||||
notify:
|
||||
- Restart swift services
|
||||
|
||||
- name: Restart swift object services
|
||||
- name: Restart swift services
|
||||
service:
|
||||
name: "{{ item }}"
|
||||
name: "{{ item.value.program_name }}"
|
||||
state: "restarted"
|
||||
pattern: "{{ item }}"
|
||||
register: service_restart
|
||||
with_items: "{{ swift_object_program_names }}"
|
||||
failed_when: false
|
||||
|
||||
- name: Restart swift proxy services
|
||||
service:
|
||||
name: "{{ item }}"
|
||||
state: "restarted"
|
||||
pattern: "{{ item }}"
|
||||
register: service_restart
|
||||
with_items: "{{ swift_proxy_program_names }}"
|
||||
failed_when: false
|
||||
|
||||
- name: Restart service
|
||||
service:
|
||||
name: "{{ item }}"
|
||||
state: "restarted"
|
||||
pattern: "{{ item }}"
|
||||
enabled: "yes"
|
||||
when: item is defined
|
||||
pattern: "{{ item.value.program_name }}"
|
||||
with_dict: "{{ swift_services }}"
|
||||
when: inventory_hostname in groups[item.value.group]
|
||||
|
||||
- name: Restart rsyslog
|
||||
service:
|
||||
|
@ -95,6 +95,10 @@
|
||||
- swift-config
|
||||
- swift-install
|
||||
|
||||
- include: swift_init_common.yml
|
||||
tags:
|
||||
- swift-install
|
||||
|
||||
- include: swift_service_setup.yml
|
||||
when:
|
||||
- inventory_hostname == groups['swift_all'][0]
|
||||
|
@ -23,7 +23,9 @@
|
||||
|
||||
- name: Load service
|
||||
service:
|
||||
name: "{{ program_name }}"
|
||||
name: "{{ item.value.program_name }}"
|
||||
enabled: "yes"
|
||||
state: restarted
|
||||
when: init_script|changed
|
||||
with_dict: "{{ swift_services }}"
|
||||
when: inventory_hostname in groups[item.value.group]
|
||||
notify:
|
||||
- Restart swift services
|
||||
|
@ -15,19 +15,23 @@
|
||||
|
||||
- name: Create TEMP run dir
|
||||
file:
|
||||
path: "/var/run/{{ program_name }}"
|
||||
path: "/var/run/{{ item.value.program_name }}"
|
||||
state: directory
|
||||
owner: "{{ system_user }}"
|
||||
group: "{{ system_group }}"
|
||||
owner: "{{ swift_system_user_name }}"
|
||||
group: "{{ swift_system_group_name }}"
|
||||
mode: "02755"
|
||||
with_dict: "{{ swift_services }}"
|
||||
when: inventory_hostname in groups[item.value.group]
|
||||
|
||||
- name: Create TEMP lock dir
|
||||
file:
|
||||
path: "/var/lock/{{ program_name }}"
|
||||
path: "/var/lock/{{ item.value.program_name }}"
|
||||
state: directory
|
||||
owner: "{{ system_user }}"
|
||||
group: "{{ system_group }}"
|
||||
owner: "{{ swift_system_user_name }}"
|
||||
group: "{{ swift_system_group_name }}"
|
||||
mode: "02755"
|
||||
with_dict: "{{ swift_services }}"
|
||||
when: inventory_hostname in groups[item.value.group]
|
||||
|
||||
- name: Create tempfile.d entry
|
||||
template:
|
||||
@ -36,16 +40,17 @@
|
||||
mode: "0644"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
with_dict: "{{ swift_services }}"
|
||||
when: inventory_hostname in groups[item.value.group]
|
||||
|
||||
- name: Place the systemd init script
|
||||
template:
|
||||
src: "swift-systemd-init.j2"
|
||||
dest: "/etc/systemd/system/{{ program_name }}.service"
|
||||
dest: "/etc/systemd/system/{{ item.value.program_name }}.service"
|
||||
mode: "0644"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
register: init_script
|
||||
|
||||
- name: Reload the systemd daemon
|
||||
command: "systemctl daemon-reload"
|
||||
when: init_script | changed
|
||||
with_dict: "{{ swift_services }}"
|
||||
when: inventory_hostname in groups[item.value.group]
|
||||
notify:
|
||||
- Reload systemd daemon
|
||||
|
@ -16,13 +16,11 @@
|
||||
- name: Place the init script
|
||||
template:
|
||||
src: "swift-upstart-init.j2"
|
||||
dest: "/etc/init/{{ program_name }}.conf"
|
||||
dest: "/etc/init/{{ item.value.program_name }}.conf"
|
||||
mode: "0644"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
register: init_script
|
||||
|
||||
- name: Reload init scripts
|
||||
shell: |
|
||||
initctl reload-configuration
|
||||
when: init_script|changed
|
||||
with_dict: "{{ swift_services }}"
|
||||
when: inventory_hostname in groups[item.value.group]
|
||||
notify:
|
||||
- Reload upstart init scripts
|
||||
|
@ -123,10 +123,7 @@
|
||||
- not swift_developer_mode | bool
|
||||
- swift_get_venv | changed or swift_venv_dir | changed
|
||||
notify:
|
||||
- Restart swift account services
|
||||
- Restart swift container services
|
||||
- Restart swift object services
|
||||
- Restart swift proxy services
|
||||
- Restart swift services
|
||||
|
||||
- name: Install pip packages
|
||||
pip:
|
||||
@ -143,10 +140,7 @@
|
||||
- not swift_pypy_enabled | bool
|
||||
- swift_get_venv | failed or swift_developer_mode | bool
|
||||
notify:
|
||||
- Restart swift account services
|
||||
- Restart swift container services
|
||||
- Restart swift object services
|
||||
- Restart swift proxy services
|
||||
- Restart swift services
|
||||
|
||||
- name: Update virtualenv path
|
||||
command: >
|
||||
|
@ -36,10 +36,7 @@
|
||||
config_overrides: "{{ swift_memcache_conf_overrides }}"
|
||||
config_type: "ini"
|
||||
notify:
|
||||
- Restart swift account services
|
||||
- Restart swift container services
|
||||
- Restart swift object services
|
||||
- Restart swift proxy services
|
||||
- Restart swift services
|
||||
|
||||
- name: Copy swift config
|
||||
template:
|
||||
@ -48,8 +45,5 @@
|
||||
owner: "{{ swift_system_user_name }}"
|
||||
group: "{{ swift_system_group_name }}"
|
||||
notify:
|
||||
- Restart swift account services
|
||||
- Restart swift container services
|
||||
- Restart swift object services
|
||||
- Restart swift proxy services
|
||||
- Restart swift services
|
||||
- Restart rsyslog
|
||||
|
@ -36,17 +36,6 @@
|
||||
- swift_gnocchi_enabled | bool
|
||||
- get_gnocchi_project | success
|
||||
|
||||
- include: swift_init_common.yml
|
||||
vars:
|
||||
program_name: "swift-proxy-server"
|
||||
program_config_options: "{{ swift_proxy_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 }}"
|
||||
tags:
|
||||
- swift-install
|
||||
|
||||
- name: swift proxy server configuration
|
||||
config_template:
|
||||
src: "proxy-server.conf.j2"
|
||||
@ -56,7 +45,7 @@
|
||||
mode: "0644"
|
||||
config_overrides: "{{ swift_proxy_server_conf_overrides }}"
|
||||
config_type: "ini"
|
||||
notify: Restart swift proxy services
|
||||
notify: Restart swift services
|
||||
tags:
|
||||
- swift-config
|
||||
|
||||
@ -72,6 +61,6 @@
|
||||
config_type: "ini"
|
||||
when: >
|
||||
swift_container_sync_realms is defined
|
||||
notify: Restart swift proxy services
|
||||
notify: Restart swift services
|
||||
tags:
|
||||
- swift-config
|
||||
|
@ -66,10 +66,7 @@
|
||||
retries: 5
|
||||
delay: 2
|
||||
notify:
|
||||
- Restart swift account services
|
||||
- Restart swift container services
|
||||
- Restart swift object services
|
||||
- Restart swift proxy services
|
||||
- Restart swift services
|
||||
|
||||
- name: Mark swift venv for use with pypy
|
||||
file:
|
||||
|
@ -13,63 +13,6 @@
|
||||
# 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_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 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
|
||||
# when the service attempts to start.
|
||||
- include: swift_init_common.yml
|
||||
vars:
|
||||
program_name: "swift-account-replicator-server"
|
||||
program_binary: "swift-account-server"
|
||||
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 }}"
|
||||
|
||||
- include: swift_init_common.yml
|
||||
vars:
|
||||
program_name: "swift-account-server"
|
||||
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 }}"
|
||||
|
||||
# The auditor needs to point at the replicator configuration.
|
||||
# When using a dedicated replication network that means the dedicated conf file.
|
||||
- include: swift_init_common.yml
|
||||
vars:
|
||||
program_name: "swift-account-auditor"
|
||||
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 }}"
|
||||
|
||||
- include: swift_init_common.yml
|
||||
vars:
|
||||
program_name: "swift-account-reaper"
|
||||
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 }}"
|
||||
|
||||
- name: "Swift account server configuration"
|
||||
config_template:
|
||||
src: "account-server.conf.j2"
|
||||
@ -79,7 +22,7 @@
|
||||
mode: "0644"
|
||||
config_overrides: "{{ swift_account_server_conf_overrides }}"
|
||||
config_type: "ini"
|
||||
notify: Restart swift account services
|
||||
notify: Restart swift services
|
||||
|
||||
# We only create the dedicated replicator configuration when using a dedicated replication_network
|
||||
- name: "Swift account server replicator configuration"
|
||||
@ -92,7 +35,7 @@
|
||||
config_overrides: "{{ swift_account_server_replicator_conf_overrides }}"
|
||||
config_type: "ini"
|
||||
when: swift_dedicated_replication
|
||||
notify: Restart swift account services
|
||||
notify: Restart swift services
|
||||
|
||||
# Remove the dedicated replicator configuration when no dedicated replication network in use
|
||||
- name: "Remove dedicated replicator configuration"
|
||||
|
@ -13,81 +13,6 @@
|
||||
# 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_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 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
|
||||
# when the service attempts to start.
|
||||
- include: swift_init_common.yml
|
||||
vars:
|
||||
program_name: "swift-container-replicator-server"
|
||||
program_binary: "swift-container-server"
|
||||
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 }}"
|
||||
|
||||
- include: swift_init_common.yml
|
||||
vars:
|
||||
program_name: "swift-container-server"
|
||||
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 }}"
|
||||
|
||||
# The auditor needs to point at the replicator configuration.
|
||||
# # When using a dedicated replication network that means the dedicated conf file.
|
||||
- include: swift_init_common.yml
|
||||
vars:
|
||||
program_name: "swift-container-auditor"
|
||||
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 }}"
|
||||
|
||||
- include: swift_init_common.yml
|
||||
vars:
|
||||
program_name: "swift-container-sync"
|
||||
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 }}"
|
||||
|
||||
- include: swift_init_common.yml
|
||||
vars:
|
||||
program_name: "swift-container-updater"
|
||||
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 }}"
|
||||
|
||||
- include: swift_init_common.yml
|
||||
vars:
|
||||
program_name: "swift-container-reconciler"
|
||||
program_config_options: "{{ swift_container_reconciler_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 }}"
|
||||
|
||||
- name: "Swift container server configuration"
|
||||
config_template:
|
||||
src: "{{ item.src }}"
|
||||
@ -106,7 +31,7 @@
|
||||
dest: "/etc/swift/container-server/container-reconciler.conf"
|
||||
config_overrides: "{{ swift_container_reconciler_conf_overrides }}"
|
||||
config_type: "ini"
|
||||
notify: Restart swift container services
|
||||
notify: Restart swift services
|
||||
|
||||
# If we've specified a container-sync realm use container-sync-realms.conf
|
||||
- name: "Swift container-sync configuration"
|
||||
@ -120,7 +45,7 @@
|
||||
config_type: "ini"
|
||||
when:
|
||||
- swift_container_sync_realms is defined
|
||||
notify: Restart swift container services
|
||||
notify: Restart swift services
|
||||
|
||||
# We only create the dedicated replicator configuration when using a dedicated replication_network
|
||||
- name: "Swift container server replicator configuration"
|
||||
@ -133,7 +58,7 @@
|
||||
config_overrides: "{{ swift_container_server_replicator_conf_overrides }}"
|
||||
config_type: "ini"
|
||||
when: swift_dedicated_replication
|
||||
notify: Restart swift container services
|
||||
notify: Restart swift services
|
||||
|
||||
# Remove the dedicated replicator configuration when no dedicated replication network in use
|
||||
- name: "Remove dedicated replicator configuration"
|
||||
|
@ -13,72 +13,6 @@
|
||||
# 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_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 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
|
||||
# when the service attempts to start.
|
||||
- include: swift_init_common.yml
|
||||
vars:
|
||||
program_name: "swift-object-replicator-server"
|
||||
program_binary: "swift-object-server"
|
||||
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 }}"
|
||||
|
||||
- include: swift_init_common.yml
|
||||
vars:
|
||||
program_name: "swift-object-server"
|
||||
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 }}"
|
||||
|
||||
# The auditor needs to point at the replicator configuration.
|
||||
# # When using a dedicated replication network that means the dedicated conf file.
|
||||
- include: swift_init_common.yml
|
||||
vars:
|
||||
program_name: "swift-object-auditor"
|
||||
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 }}"
|
||||
|
||||
- include: swift_init_common.yml
|
||||
vars:
|
||||
program_name: "swift-object-updater"
|
||||
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 }}"
|
||||
|
||||
- include: swift_init_common.yml
|
||||
vars:
|
||||
program_name: "swift-object-expirer"
|
||||
program_config_options: "{{ swift_object_expirer_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 }}"
|
||||
|
||||
- name: "Swift object server configuration"
|
||||
config_template:
|
||||
src: "{{ item.src }}"
|
||||
@ -97,7 +31,7 @@
|
||||
dest: "/etc/swift/object-server/object-expirer.conf"
|
||||
config_overrides: "{{ swift_object_expirer_conf_overrides }}"
|
||||
config_type: "ini"
|
||||
notify: Restart swift object services
|
||||
notify: Restart swift services
|
||||
|
||||
# We only create the dedicated replicator configuration when using a dedicated replication_network
|
||||
- name: "Swift object server replicator configuration"
|
||||
@ -110,7 +44,7 @@
|
||||
config_overrides: "{{ swift_object_server_replicator_conf_overrides }}"
|
||||
config_type: "ini"
|
||||
when: swift_dedicated_replication
|
||||
notify: Restart swift object services
|
||||
notify: Restart swift services
|
||||
|
||||
# Remove the dedicated replicator configuration when no dedicated replication network in use
|
||||
- name: "Remove dedicated replicator configuration"
|
||||
|
@ -15,19 +15,8 @@
|
||||
|
||||
- name: "Ensure services are started"
|
||||
service:
|
||||
name: "{{ item }}"
|
||||
name: "{{ item.value.program_name }}"
|
||||
state: "started"
|
||||
pattern: "{{ item }}"
|
||||
with_items:
|
||||
- "{{ swift_account_program_names }}"
|
||||
- "{{ swift_container_program_names }}"
|
||||
- "{{ swift_object_program_names }}"
|
||||
when: inventory_hostname in groups['swift_hosts']
|
||||
|
||||
- name: "Ensure services are started"
|
||||
service:
|
||||
name: "{{ item }}"
|
||||
state: "started"
|
||||
pattern: "{{ item }}"
|
||||
with_items: "{{ swift_proxy_program_names }}"
|
||||
when: inventory_hostname in groups['swift_proxy']
|
||||
pattern: "{{ item.value.program_name }}"
|
||||
with_dict: "{{ swift_services }}"
|
||||
when: inventory_hostname in groups[item.value.group]
|
||||
|
@ -1,5 +1,4 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
[Unit]
|
||||
Description=swift openstack service
|
||||
After=syslog.target
|
||||
@ -7,13 +6,13 @@ After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User={{ system_user }}
|
||||
Group={{ system_group }}
|
||||
User={{ swift_system_user_name }}
|
||||
Group={{ swift_system_group_name }}
|
||||
|
||||
{% if program_override is defined %}
|
||||
ExecStart={{ program_override }} {{ program_config_options|default('') }}
|
||||
{% if item.value.program_override is defined %}
|
||||
ExecStart={{ item.value.program_override }} {{ item.value.program_config_options|default('') }}
|
||||
{% else %}
|
||||
ExecStart={{ swift_bin }}/{{ program_name }} {{ program_config_options|default('') }}
|
||||
ExecStart={{ swift_bin }}/{{ item.value.program_name }} {{ item.value.program_config_options|default('') }}
|
||||
{% endif %}
|
||||
|
||||
# Give a reasonable amount of time for the server to start up/shut down
|
||||
|
@ -1,4 +1,4 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
D /var/lock/{{ program_name }} 2755 {{ system_user }} {{ system_group }}
|
||||
D /var/run/{{ program_name }} 2755 {{ system_user }} {{ system_group }}
|
||||
D /var/lock/{{ item.value.program_name }} 2755 {{ swift_system_user_name }} {{ swift_system_group_name }}
|
||||
D /var/run/{{ item.value.program_name }} 2755 {{ swift_system_user_name }} {{ swift_system_group_name }}
|
||||
|
@ -1,9 +1,9 @@
|
||||
# {{ ansible_managed }}
|
||||
{% if not swift_dedicated_replication and 'replicator-server' in program_name %}
|
||||
{% if not swift_dedicated_replication and 'replicator-server' in item.value.program_name %}
|
||||
# Blank script - dedicated replication network not in use
|
||||
{% else %}
|
||||
|
||||
description "{{ program_name }}"
|
||||
description "{{ item.value.program_name }}"
|
||||
author "Kevin Carter <kevin.carter@rackspace.com>"
|
||||
|
||||
start on runlevel [2345]
|
||||
@ -13,18 +13,18 @@ respawn
|
||||
respawn limit 10 5
|
||||
|
||||
# Set the RUNBIN environment variable
|
||||
env RUNBIN="{{ swift_bin }}/{{ program_binary | default(program_name) }}"
|
||||
env RUNBIN="{{ swift_bin }}/{{ item.value.program_binary | default(item.value.program_name) }}"
|
||||
|
||||
# Change directory to service users home
|
||||
chdir "{{ service_home }}"
|
||||
chdir "{{ swift_system_home_folder }}"
|
||||
|
||||
# Pre start actions
|
||||
pre-start script
|
||||
mkdir -p "/var/run/{{ program_binary | default(program_name) }}"
|
||||
chown {{ system_user }}:{{ system_group }} "/var/run/{{ program_binary | default(program_name) }}"
|
||||
mkdir -p "/var/run/{{ item.value.program_binary | default(item.value.program_name) }}"
|
||||
chown {{ swift_system_user_name }}:{{ swift_system_group_name }} "/var/run/{{ item.value.program_binary | default(item.value.program_name) }}"
|
||||
|
||||
mkdir -p "/var/lock/{{ program_binary | default(program_name) }}"
|
||||
chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_binary | default(program_name) }}"
|
||||
mkdir -p "/var/lock/{{ item.value.program_binary | default(item.value.program_name) }}"
|
||||
chown {{ swift_system_user_name }}:{{ swift_system_group_name }} "/var/lock/{{ item.value.program_binary | default(item.value.program_name) }}"
|
||||
|
||||
. {{ swift_bin }}/activate
|
||||
|
||||
@ -32,13 +32,13 @@ end script
|
||||
|
||||
# Post stop actions
|
||||
post-stop script
|
||||
rm "/var/run/{{ program_binary | default(program_name) }}/{{ program_name }}.pid"
|
||||
rm "/var/run/{{ item.value.program_binary | default(item.value.program_name) }}/{{ item.value.program_name }}.pid"
|
||||
end script
|
||||
|
||||
# Run the start up job
|
||||
exec start-stop-daemon --start \
|
||||
--chuid {{ system_user }} \
|
||||
--chuid {{ swift_system_user_name }} \
|
||||
--make-pidfile \
|
||||
--pidfile /var/run/{{ program_binary | default(program_name) }}/{{ program_name }}.pid \
|
||||
--exec "{{ program_override|default('$RUNBIN') }}" "{{ program_config_options|default('') }}"
|
||||
--pidfile /var/run/{{ item.value.program_binary | default(item.value.program_name) }}/{{ item.value.program_name }}.pid \
|
||||
--exec "{{ item.value.program_override|default('$RUNBIN') }}" "{{ item.value.program_config_options|default('') }}"
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user