diff --git a/README.md b/README.md index 87cd332..8f5a9c3 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,6 @@ See Docker guides for [images](https://docs.docker.com/engine/reference/commandl ## Requirements ## - ansible >= 2.4 - - python >= 2.6 - docker-py >= 1.7.0 - Docker API >= 1.20 @@ -51,7 +50,8 @@ See Docker guides for [images](https://docs.docker.com/engine/reference/commandl | Name | Default Value | Description | |-------------------|---------------------|----------------------| -| `operations_service_names` | `[]` | List of services to restart on target systems. | +| `operations_services_to_restart` | `[]` | List of services to restart on target systems. | +| `operations_custom_service_map` | `{}` | Dictionary of services and their systemd unit files, container names, and vhosts. This will be combined with the builtin list of services in `vars/main.yml`. | ## Dependencies ## @@ -70,7 +70,7 @@ None name: openstack-operations tasks_from: restart_service.yml vars: - operations_service_names: + operations_services_to_restart: - docker - keystone - mariadb diff --git a/defaults/main.yml b/defaults/main.yml index 24a94fc..814c5e0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -23,4 +23,5 @@ operations_logs: # Restart Service -operations_service_names: [] +operations_services_to_restart: [] +operations_custom_service_map: {} diff --git a/tasks/restart_service.yml b/tasks/restart_service.yml index 1f88540..1b1eb5f 100644 --- a/tasks/restart_service.yml +++ b/tasks/restart_service.yml @@ -1,18 +1,18 @@ - name: Gather container list - service_mgmt_facts: - operations_service_names: "{{ operations_service_names }}" - operations_service_map: "{{ operations_default_service_map|combine(operations_custom_service_map) }}" + service_map_facts: + services: "{{ operations_services_to_restart }}" + service_map: "{{ operations_service_map | combine(operations_custom_service_map) }}" - name: Restart containerized OpenStack services docker_container: name: "{{ item['container_name'] }}" state: started restart: yes - loop: "{{ docker_containers }}" + loop: "{{ docker_containers_to_restart }}" - name: Restart OpenStack services service: name: "{{ item['name'] }}" state: restarted - loop: "{{ systemd_services }}" + loop: "{{ systemd_services_to_restart }}" when: item['state'] == "enabled"