Merge "Use dictionary for service mappings"

This commit is contained in:
Jenkins 2016-10-13 18:56:53 +00:00 committed by Gerrit Code Review
commit 3396082f35
17 changed files with 162 additions and 373 deletions

View File

@ -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 # 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_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 ## General Swift configuration
# If ``swift_account_server_replicator_workers`` is unset the system will use half the number # 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. # of available VCPUS to compute the number of api workers to use.
@ -299,32 +286,86 @@ swift_pip_packages:
- python-swiftclient - python-swiftclient
- swift - swift
swift_account_program_names: swift_services:
- swift-account-server swift-account-replicator:
- swift-account-auditor group: swift_acc
- swift-account-replicator program_name: "swift-account-replicator"
- swift-account-reaper 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 swift-account-replicator-server:
group: swift_acc
swift_container_program_names: program_name: "swift-account-replicator-server"
- swift-container-server program_binary: "swift-account-server"
- swift-container-auditor program_config_options: "/etc/swift/account-server/account-server-replicator.conf"
- swift-container-replicator swift-account-server:
- swift-container-sync group: swift_acc
- swift-container-updater program_name: "swift-account-server"
- swift-container-replicator-server program_config_options: "/etc/swift/account-server/account-server.conf"
- swift-container-reconciler swift-account-auditor:
group: swift_acc
swift_object_program_names: program_name: "swift-account-auditor"
- swift-object-server program_config_options: "{{ swift_dedicated_replication | ternary('/etc/swift/account-server/account-server-replicator.conf', '/etc/swift/account-server/account-server.conf') }}"
- swift-object-auditor swift-account-reaper:
- swift-object-replicator group: swift_acc
- swift-object-updater program_name: "swift-account-reaper"
- swift-object-replicator-server program_config_options: "/etc/swift/account-server/account-server.conf"
- swift-object-expirer swift-container-replicator:
group: swift_cont
swift_proxy_program_names: program_name: "swift-container-replicator"
- swift-proxy-server 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, # Set to True to reset the clock on the last time a rebalance happened,
# circumventing the min_part_hours check. # circumventing the min_part_hours check.

View File

@ -13,49 +13,24 @@
# 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.
- name: Restart swift account services - name: Reload systemd daemon
service: command: "systemctl daemon-reload"
name: "{{ item }}" notify:
state: "restarted" - Restart swift services
pattern: "{{ item }}"
register: service_restart
with_items: "{{ swift_account_program_names }}"
failed_when: false
- name: Restart swift container services - name: Reload upstart init scripts
service: shell: |
name: "{{ item }}" initctl reload-configuration
state: "restarted" notify:
pattern: "{{ item }}" - Restart swift services
register: service_restart
with_items: "{{ swift_container_program_names }}"
failed_when: false
- name: Restart swift object services - name: Restart swift services
service: service:
name: "{{ item }}" name: "{{ item.value.program_name }}"
state: "restarted" state: "restarted"
pattern: "{{ item }}" pattern: "{{ item.value.program_name }}"
register: service_restart with_dict: "{{ swift_services }}"
with_items: "{{ swift_object_program_names }}" when: inventory_hostname in groups[item.value.group]
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
- name: Restart rsyslog - name: Restart rsyslog
service: service:

View File

@ -95,6 +95,10 @@
- swift-config - swift-config
- swift-install - swift-install
- include: swift_init_common.yml
tags:
- swift-install
- include: swift_service_setup.yml - include: swift_service_setup.yml
when: when:
- inventory_hostname == groups['swift_all'][0] - inventory_hostname == groups['swift_all'][0]

View File

@ -23,7 +23,9 @@
- name: Load service - name: Load service
service: service:
name: "{{ program_name }}" name: "{{ item.value.program_name }}"
enabled: "yes" enabled: "yes"
state: restarted with_dict: "{{ swift_services }}"
when: init_script|changed when: inventory_hostname in groups[item.value.group]
notify:
- Restart swift services

View File

@ -15,19 +15,23 @@
- name: Create TEMP run dir - name: Create TEMP run dir
file: file:
path: "/var/run/{{ program_name }}" path: "/var/run/{{ item.value.program_name }}"
state: directory state: directory
owner: "{{ system_user }}" owner: "{{ swift_system_user_name }}"
group: "{{ system_group }}" group: "{{ swift_system_group_name }}"
mode: "02755" mode: "02755"
with_dict: "{{ swift_services }}"
when: inventory_hostname in groups[item.value.group]
- name: Create TEMP lock dir - name: Create TEMP lock dir
file: file:
path: "/var/lock/{{ program_name }}" path: "/var/lock/{{ item.value.program_name }}"
state: directory state: directory
owner: "{{ system_user }}" owner: "{{ swift_system_user_name }}"
group: "{{ system_group }}" group: "{{ swift_system_group_name }}"
mode: "02755" mode: "02755"
with_dict: "{{ swift_services }}"
when: inventory_hostname in groups[item.value.group]
- name: Create tempfile.d entry - name: Create tempfile.d entry
template: template:
@ -36,16 +40,17 @@
mode: "0644" mode: "0644"
owner: "root" owner: "root"
group: "root" group: "root"
with_dict: "{{ swift_services }}"
when: inventory_hostname in groups[item.value.group]
- name: Place the systemd init script - name: Place the systemd init script
template: template:
src: "swift-systemd-init.j2" src: "swift-systemd-init.j2"
dest: "/etc/systemd/system/{{ program_name }}.service" dest: "/etc/systemd/system/{{ item.value.program_name }}.service"
mode: "0644" mode: "0644"
owner: "root" owner: "root"
group: "root" group: "root"
register: init_script with_dict: "{{ swift_services }}"
when: inventory_hostname in groups[item.value.group]
- name: Reload the systemd daemon notify:
command: "systemctl daemon-reload" - Reload systemd daemon
when: init_script | changed

View File

@ -16,13 +16,11 @@
- name: Place the init script - name: Place the init script
template: template:
src: "swift-upstart-init.j2" src: "swift-upstart-init.j2"
dest: "/etc/init/{{ program_name }}.conf" dest: "/etc/init/{{ item.value.program_name }}.conf"
mode: "0644" mode: "0644"
owner: "root" owner: "root"
group: "root" group: "root"
register: init_script with_dict: "{{ swift_services }}"
when: inventory_hostname in groups[item.value.group]
- name: Reload init scripts notify:
shell: | - Reload upstart init scripts
initctl reload-configuration
when: init_script|changed

View File

@ -123,10 +123,7 @@
- not swift_developer_mode | bool - not swift_developer_mode | bool
- swift_get_venv | changed or swift_venv_dir | changed - swift_get_venv | changed or swift_venv_dir | changed
notify: notify:
- Restart swift account services - Restart swift services
- Restart swift container services
- Restart swift object services
- Restart swift proxy services
- name: Install pip packages - name: Install pip packages
pip: pip:
@ -143,10 +140,7 @@
- not swift_pypy_enabled | bool - not swift_pypy_enabled | bool
- swift_get_venv | failed or swift_developer_mode | bool - swift_get_venv | failed or swift_developer_mode | bool
notify: notify:
- Restart swift account services - Restart swift services
- Restart swift container services
- Restart swift object services
- Restart swift proxy services
- name: Update virtualenv path - name: Update virtualenv path
command: > command: >

View File

@ -36,10 +36,7 @@
config_overrides: "{{ swift_memcache_conf_overrides }}" config_overrides: "{{ swift_memcache_conf_overrides }}"
config_type: "ini" config_type: "ini"
notify: notify:
- Restart swift account services - Restart swift services
- Restart swift container services
- Restart swift object services
- Restart swift proxy services
- name: Copy swift config - name: Copy swift config
template: template:
@ -48,8 +45,5 @@
owner: "{{ swift_system_user_name }}" owner: "{{ swift_system_user_name }}"
group: "{{ swift_system_group_name }}" group: "{{ swift_system_group_name }}"
notify: notify:
- Restart swift account services - Restart swift services
- Restart swift container services
- Restart swift object services
- Restart swift proxy services
- Restart rsyslog - Restart rsyslog

View File

@ -36,17 +36,6 @@
- swift_gnocchi_enabled | bool - swift_gnocchi_enabled | bool
- get_gnocchi_project | success - 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 - name: swift proxy server configuration
config_template: config_template:
src: "proxy-server.conf.j2" src: "proxy-server.conf.j2"
@ -56,7 +45,7 @@
mode: "0644" mode: "0644"
config_overrides: "{{ swift_proxy_server_conf_overrides }}" config_overrides: "{{ swift_proxy_server_conf_overrides }}"
config_type: "ini" config_type: "ini"
notify: Restart swift proxy services notify: Restart swift services
tags: tags:
- swift-config - swift-config
@ -72,6 +61,6 @@
config_type: "ini" config_type: "ini"
when: > when: >
swift_container_sync_realms is defined swift_container_sync_realms is defined
notify: Restart swift proxy services notify: Restart swift services
tags: tags:
- swift-config - swift-config

View File

@ -66,10 +66,7 @@
retries: 5 retries: 5
delay: 2 delay: 2
notify: notify:
- Restart swift account services - Restart swift services
- Restart swift container services
- Restart swift object services
- Restart swift proxy services
- name: Mark swift venv for use with pypy - name: Mark swift venv for use with pypy
file: file:

View File

@ -13,63 +13,6 @@
# 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
- 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" - name: "Swift account server configuration"
config_template: config_template:
src: "account-server.conf.j2" src: "account-server.conf.j2"
@ -79,7 +22,7 @@
mode: "0644" mode: "0644"
config_overrides: "{{ swift_account_server_conf_overrides }}" config_overrides: "{{ swift_account_server_conf_overrides }}"
config_type: "ini" 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 # We only create the dedicated replicator configuration when using a dedicated replication_network
- name: "Swift account server replicator configuration" - name: "Swift account server replicator configuration"
@ -92,7 +35,7 @@
config_overrides: "{{ swift_account_server_replicator_conf_overrides }}" config_overrides: "{{ swift_account_server_replicator_conf_overrides }}"
config_type: "ini" config_type: "ini"
when: swift_dedicated_replication 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 # Remove the dedicated replicator configuration when no dedicated replication network in use
- name: "Remove dedicated replicator configuration" - name: "Remove dedicated replicator configuration"

View File

@ -13,81 +13,6 @@
# 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
- 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" - name: "Swift container server configuration"
config_template: config_template:
src: "{{ item.src }}" src: "{{ item.src }}"
@ -106,7 +31,7 @@
dest: "/etc/swift/container-server/container-reconciler.conf" dest: "/etc/swift/container-server/container-reconciler.conf"
config_overrides: "{{ swift_container_reconciler_conf_overrides }}" config_overrides: "{{ swift_container_reconciler_conf_overrides }}"
config_type: "ini" 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 # If we've specified a container-sync realm use container-sync-realms.conf
- name: "Swift container-sync configuration" - name: "Swift container-sync configuration"
@ -120,7 +45,7 @@
config_type: "ini" config_type: "ini"
when: when:
- swift_container_sync_realms is defined - 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 # We only create the dedicated replicator configuration when using a dedicated replication_network
- name: "Swift container server replicator configuration" - name: "Swift container server replicator configuration"
@ -133,7 +58,7 @@
config_overrides: "{{ swift_container_server_replicator_conf_overrides }}" config_overrides: "{{ swift_container_server_replicator_conf_overrides }}"
config_type: "ini" config_type: "ini"
when: swift_dedicated_replication 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 # Remove the dedicated replicator configuration when no dedicated replication network in use
- name: "Remove dedicated replicator configuration" - name: "Remove dedicated replicator configuration"

View File

@ -13,72 +13,6 @@
# 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
- 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" - name: "Swift object server configuration"
config_template: config_template:
src: "{{ item.src }}" src: "{{ item.src }}"
@ -97,7 +31,7 @@
dest: "/etc/swift/object-server/object-expirer.conf" dest: "/etc/swift/object-server/object-expirer.conf"
config_overrides: "{{ swift_object_expirer_conf_overrides }}" config_overrides: "{{ swift_object_expirer_conf_overrides }}"
config_type: "ini" 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 # We only create the dedicated replicator configuration when using a dedicated replication_network
- name: "Swift object server replicator configuration" - name: "Swift object server replicator configuration"
@ -110,7 +44,7 @@
config_overrides: "{{ swift_object_server_replicator_conf_overrides }}" config_overrides: "{{ swift_object_server_replicator_conf_overrides }}"
config_type: "ini" config_type: "ini"
when: swift_dedicated_replication 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 # Remove the dedicated replicator configuration when no dedicated replication network in use
- name: "Remove dedicated replicator configuration" - name: "Remove dedicated replicator configuration"

View File

@ -15,19 +15,8 @@
- name: "Ensure services are started" - name: "Ensure services are started"
service: service:
name: "{{ item }}" name: "{{ item.value.program_name }}"
state: "started" state: "started"
pattern: "{{ item }}" pattern: "{{ item.value.program_name }}"
with_items: with_dict: "{{ swift_services }}"
- "{{ swift_account_program_names }}" when: inventory_hostname in groups[item.value.group]
- "{{ 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']

View File

@ -1,5 +1,4 @@
# {{ ansible_managed }} # {{ ansible_managed }}
[Unit] [Unit]
Description=swift openstack service Description=swift openstack service
After=syslog.target After=syslog.target
@ -7,13 +6,13 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
User={{ system_user }} User={{ swift_system_user_name }}
Group={{ system_group }} Group={{ swift_system_group_name }}
{% if program_override is defined %} {% if item.value.program_override is defined %}
ExecStart={{ program_override }} {{ program_config_options|default('') }} ExecStart={{ item.value.program_override }} {{ item.value.program_config_options|default('') }}
{% else %} {% else %}
ExecStart={{ swift_bin }}/{{ program_name }} {{ program_config_options|default('') }} ExecStart={{ swift_bin }}/{{ item.value.program_name }} {{ item.value.program_config_options|default('') }}
{% endif %} {% endif %}
# Give a reasonable amount of time for the server to start up/shut down # Give a reasonable amount of time for the server to start up/shut down

View File

@ -1,4 +1,4 @@
# {{ ansible_managed }} # {{ ansible_managed }}
D /var/lock/{{ 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/{{ program_name }} 2755 {{ system_user }} {{ system_group }} D /var/run/{{ item.value.program_name }} 2755 {{ swift_system_user_name }} {{ swift_system_group_name }}

View File

@ -1,9 +1,9 @@
# {{ ansible_managed }} # {{ 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 # Blank script - dedicated replication network not in use
{% else %} {% else %}
description "{{ program_name }}" description "{{ item.value.program_name }}"
author "Kevin Carter <kevin.carter@rackspace.com>" author "Kevin Carter <kevin.carter@rackspace.com>"
start on runlevel [2345] start on runlevel [2345]
@ -13,18 +13,18 @@ respawn
respawn limit 10 5 respawn limit 10 5
# Set the RUNBIN environment variable # 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 # Change directory to service users home
chdir "{{ service_home }}" chdir "{{ swift_system_home_folder }}"
# Pre start actions # Pre start actions
pre-start script pre-start script
mkdir -p "/var/run/{{ program_binary | default(program_name) }}" mkdir -p "/var/run/{{ item.value.program_binary | default(item.value.program_name) }}"
chown {{ system_user }}:{{ system_group }} "/var/run/{{ program_binary | default(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) }}" mkdir -p "/var/lock/{{ item.value.program_binary | default(item.value.program_name) }}"
chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_binary | default(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 . {{ swift_bin }}/activate
@ -32,13 +32,13 @@ end script
# Post stop actions # Post stop actions
post-stop script 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 end script
# Run the start up job # Run the start up job
exec start-stop-daemon --start \ exec start-stop-daemon --start \
--chuid {{ system_user }} \ --chuid {{ swift_system_user_name }} \
--make-pidfile \ --make-pidfile \
--pidfile /var/run/{{ program_binary | default(program_name) }}/{{ program_name }}.pid \ --pidfile /var/run/{{ item.value.program_binary | default(item.value.program_name) }}/{{ item.value.program_name }}.pid \
--exec "{{ program_override|default('$RUNBIN') }}" "{{ program_config_options|default('') }}" --exec "{{ item.value.program_override|default('$RUNBIN') }}" "{{ item.value.program_config_options|default('') }}"
{% endif %} {% endif %}