Browse Source

Support stop specific containers

With this change, an operator may be able to stop a
service container without stopping all services in a host.
This change is the starting point to start
fast-forward upgrades support.
In next changes new flags will be introducced to disable
stop dataplane services during upgrades.

Change-Id: Ifde7a39d7d8596ef0d7405ecf1ac1d49a459d9ef
Implements: blueprint support-stop-containers
Eduardo Gonzalez 5 months ago
parent
commit
1a682fab28
77 changed files with 641 additions and 48 deletions
  1. 9
    0
      ansible/group_vars/all.yml
  2. 6
    0
      ansible/roles/barbican/tasks/stop.yml
  3. 9
    0
      ansible/roles/bifrost/tasks/stop.yml
  4. 6
    0
      ansible/roles/blazar/tasks/stop.yml
  5. 6
    0
      ansible/roles/ceilometer/tasks/stop.yml
  6. 63
    0
      ansible/roles/ceph/tasks/stop.yml
  7. 6
    0
      ansible/roles/chrony/tasks/stop.yml
  8. 6
    0
      ansible/roles/cinder/tasks/stop.yml
  9. 6
    0
      ansible/roles/cloudkitty/tasks/stop.yml
  10. 6
    0
      ansible/roles/collectd/tasks/stop.yml
  11. 6
    0
      ansible/roles/common/tasks/stop.yml
  12. 6
    0
      ansible/roles/congress/tasks/stop.yml
  13. 6
    0
      ansible/roles/designate/tasks/stop.yml
  14. 6
    0
      ansible/roles/elasticsearch/tasks/stop.yml
  15. 6
    0
      ansible/roles/etcd/tasks/stop.yml
  16. 6
    0
      ansible/roles/freezer/tasks/stop.yml
  17. 6
    0
      ansible/roles/glance/tasks/stop.yml
  18. 6
    0
      ansible/roles/gnocchi/tasks/stop.yml
  19. 6
    0
      ansible/roles/grafana/tasks/stop.yml
  20. 6
    0
      ansible/roles/haproxy/tasks/stop.yml
  21. 6
    0
      ansible/roles/heat/tasks/stop.yml
  22. 6
    0
      ansible/roles/horizon/tasks/stop.yml
  23. 6
    0
      ansible/roles/influxdb/tasks/stop.yml
  24. 6
    0
      ansible/roles/ironic/tasks/stop.yml
  25. 19
    0
      ansible/roles/iscsi/tasks/stop.yml
  26. 6
    0
      ansible/roles/kafka/tasks/stop.yml
  27. 6
    0
      ansible/roles/karbor/tasks/stop.yml
  28. 6
    0
      ansible/roles/keystone/tasks/stop.yml
  29. 6
    0
      ansible/roles/kibana/tasks/stop.yml
  30. 6
    0
      ansible/roles/kuryr/tasks/stop.yml
  31. 6
    0
      ansible/roles/magnum/tasks/stop.yml
  32. 6
    0
      ansible/roles/manila/tasks/stop.yml
  33. 6
    0
      ansible/roles/mariadb/tasks/stop.yml
  34. 6
    0
      ansible/roles/memcached/tasks/stop.yml
  35. 6
    0
      ansible/roles/mistral/tasks/stop.yml
  36. 6
    0
      ansible/roles/monasca/tasks/stop.yml
  37. 6
    0
      ansible/roles/mongodb/tasks/stop.yml
  38. 6
    0
      ansible/roles/multipathd/tasks/stop.yml
  39. 6
    0
      ansible/roles/murano/tasks/stop.yml
  40. 6
    0
      ansible/roles/neutron/tasks/stop.yml
  41. 0
    0
      ansible/roles/nova-hyperv/tasks/stop.yml
  42. 6
    0
      ansible/roles/nova/tasks/stop.yml
  43. 6
    0
      ansible/roles/octavia/tasks/stop.yml
  44. 6
    0
      ansible/roles/opendaylight/tasks/stop.yml
  45. 6
    0
      ansible/roles/openvswitch/tasks/stop.yml
  46. 6
    0
      ansible/roles/ovs-dpdk/tasks/stop.yml
  47. 6
    0
      ansible/roles/panko/tasks/stop.yml
  48. 6
    0
      ansible/roles/prometheus/tasks/stop.yml
  49. 6
    0
      ansible/roles/qdrouterd/tasks/stop.yml
  50. 6
    0
      ansible/roles/rabbitmq/tasks/stop.yml
  51. 6
    0
      ansible/roles/rally/tasks/stop.yml
  52. 6
    0
      ansible/roles/redis/tasks/stop.yml
  53. 6
    0
      ansible/roles/sahara/tasks/stop.yml
  54. 6
    0
      ansible/roles/searchlight/tasks/stop.yml
  55. 6
    0
      ansible/roles/senlin/tasks/stop.yml
  56. 12
    0
      ansible/roles/service-stop/tasks/main.yml
  57. 6
    0
      ansible/roles/skydive/tasks/stop.yml
  58. 6
    0
      ansible/roles/solum/tasks/stop.yml
  59. 0
    17
      ansible/roles/stop/tasks/copy_tools.yml
  60. 0
    4
      ansible/roles/stop/tasks/main.yml
  61. 0
    3
      ansible/roles/stop/tasks/stop_containers.yml
  62. 6
    0
      ansible/roles/storm/tasks/stop.yml
  63. 136
    0
      ansible/roles/swift/tasks/stop.yml
  64. 6
    0
      ansible/roles/tacker/tasks/stop.yml
  65. 6
    0
      ansible/roles/telegraf/tasks/stop.yml
  66. 6
    0
      ansible/roles/tempest/tasks/stop.yml
  67. 6
    0
      ansible/roles/trove/tasks/stop.yml
  68. 6
    0
      ansible/roles/vitrage/tasks/stop.yml
  69. 6
    0
      ansible/roles/vmtp/tasks/stop.yml
  70. 6
    0
      ansible/roles/watcher/tasks/stop.yml
  71. 6
    0
      ansible/roles/zookeeper/tasks/stop.yml
  72. 6
    0
      ansible/roles/zun/tasks/stop.yml
  73. 0
    4
      ansible/stop.yml
  74. 11
    0
      releasenotes/notes/stop-per-service-85a996bb2751ed52.yaml
  75. 0
    1
      setup.cfg
  76. 10
    1
      tools/kolla-ansible
  77. 0
    18
      tools/stop-containers

+ 9
- 0
ansible/group_vars/all.yml View File

@@ -581,6 +581,15 @@ monasca_agent_user: "monasca-agent"
581 581
 # can access these from the Monasca APIs.
582 582
 monasca_control_plane_project: "monasca_control_plane"
583 583
 
584
+####################
585
+# Global Options
586
+####################
587
+# List of containers to skip during stop command in YAML list format
588
+# skip_stop_containers:
589
+#   - container1
590
+#   - container2
591
+skip_stop_containers: []
592
+
584 593
 ####################
585 594
 # Logging options
586 595
 ####################

+ 6
- 0
ansible/roles/barbican/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ barbican_services }}"
6
+    service_name: "{{ project_name }}"

+ 9
- 0
ansible/roles/bifrost/tasks/stop.yml View File

@@ -0,0 +1,9 @@
1
+---
2
+- name: Stopping bifrost_deploy container
3
+  kolla_docker:
4
+    action: "stop_container"
5
+    common_options: "{{ docker_common_options }}"
6
+    name: "bifrost_deploy"
7
+  when:
8
+    - inventory_hostname in groups['bifrost']
9
+    - "'bifrost_deploy' not in skip_stop_containers"

+ 6
- 0
ansible/roles/blazar/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ blazar_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/ceilometer/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ ceilometer_services }}"
6
+    service_name: "{{ project_name }}"

+ 63
- 0
ansible/roles/ceph/tasks/stop.yml View File

@@ -0,0 +1,63 @@
1
+---
2
+- name: Stopping ceph-mon container
3
+  kolla_docker:
4
+    action: "stop_container"
5
+    common_options: "{{ docker_common_options }}"
6
+    name: "ceph_mon"
7
+  when:
8
+    - inventory_hostname in groups['ceph-mon']
9
+    - "'ceph_mon' not in skip_stop_containers"
10
+
11
+- name: Find running ceph-osds containers
12
+  command: "docker ps --filter name=ceph_osd_ --format {% raw %}{{.Names}}{% endraw %}"
13
+  register: ceph_osd_containers
14
+
15
+- name: Stopping ceph-osd container
16
+  kolla_docker:
17
+    action: "stop_container"
18
+    common_options: "{{ docker_common_options }}"
19
+    name: "{{ item }}"
20
+  with_items: "{{ ceph_osd_containers.stdout_lines }}"
21
+  when:
22
+    - inventory_hostname in groups['ceph-osd']
23
+    - ceph_osd_containers.stdout_lines | length >= 1
24
+    - item not in skip_stop_containers
25
+
26
+- name: Stopping ceph-rgw container
27
+  kolla_docker:
28
+    action: "stop_container"
29
+    common_options: "{{ docker_common_options }}"
30
+    name: "ceph_rgw"
31
+  when:
32
+    - inventory_hostname in groups['ceph-rgw']
33
+    - enable_ceph_rgw | bool
34
+    - "'ceph_rgw' not in skip_stop_containers"
35
+
36
+- name: Stopping ceph-mgr container
37
+  kolla_docker:
38
+    action: "stop_container"
39
+    common_options: "{{ docker_common_options }}"
40
+    name: "ceph_mgr"
41
+  when:
42
+    - inventory_hostname in groups['ceph-mgr']
43
+    - "'ceph_mgr' not in skip_stop_containers"
44
+
45
+- name: Stopping ceph-mds container
46
+  kolla_docker:
47
+    action: "stop_container"
48
+    common_options: "{{ docker_common_options }}"
49
+    name: "ceph_mds"
50
+  when:
51
+    - enable_ceph_mds | bool
52
+    - inventory_hostname in groups['ceph-mds']
53
+    - "'ceph_mds' not in skip_stop_containers"
54
+
55
+- name: Stopping ceph-nfs container
56
+  kolla_docker:
57
+    action: "stop_container"
58
+    common_options: "{{ docker_common_options }}"
59
+    name: "ceph_nfs"
60
+  when:
61
+    - enable_ceph_nfs | bool
62
+    - inventory_hostname in groups['ceph-nfs']
63
+    - "'ceph_nfs' not in skip_stop_containers"

+ 6
- 0
ansible/roles/chrony/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ chrony_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/cinder/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ cinder_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/cloudkitty/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ cloudkitty_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/collectd/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ collectd_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/common/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ common_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/congress/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ congress_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/designate/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ designate_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/elasticsearch/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ elasticsearch_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/etcd/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ etcd_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/freezer/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ freezer_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/glance/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ glance_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/gnocchi/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ gnocchi_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/grafana/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ grafana_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/haproxy/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ haproxy_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/heat/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ heat_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/horizon/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ horizon_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/influxdb/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ influxdb_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/ironic/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ ironic_services }}"
6
+    service_name: "{{ project_name }}"

+ 19
- 0
ansible/roles/iscsi/tasks/stop.yml View File

@@ -0,0 +1,19 @@
1
+---
2
+- name: Stopping iscsid container
3
+  kolla_docker:
4
+    action: "stop_container"
5
+    common_options: "{{ docker_common_options }}"
6
+    name: "iscsid"
7
+  when: ( ( inventory_hostname in groups['compute'] or inventory_hostname in groups['cinder-volume'] ) and enable_cinder | bool and enable_cinder_backend_iscsi | bool  )
8
+         or ( inventory_hostname in groups['ironic-conductor'] and enable_ironic | bool and 'iscsid' not in skip_stop_containers)
9
+
10
+- name: Stopping tgtd container
11
+  kolla_docker:
12
+    action: "stop_container"
13
+    common_options: "{{ docker_common_options }}"
14
+    name: "tgtd"
15
+  when:
16
+    - inventory_hostname in groups['tgtd']
17
+    - enable_cinder | bool
18
+    - enable_cinder_backend_lvm | bool
19
+    - "'tgtd' not in skip_stop_containers"

+ 6
- 0
ansible/roles/kafka/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ kafka_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/karbor/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ karbor_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/keystone/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ keystone_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/kibana/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ kibana_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/kuryr/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ kuryr_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/magnum/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ magnum_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/manila/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ manila_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/mariadb/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ mariadb_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/memcached/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ memcached_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/mistral/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ mistral_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/monasca/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ monasca_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/mongodb/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ mongodb_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/multipathd/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ multipathd_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/murano/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ murano_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/neutron/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ neutron_services }}"
6
+    service_name: "{{ project_name }}"

ansible/roles/stop/tasks/check.yml → ansible/roles/nova-hyperv/tasks/stop.yml View File


+ 6
- 0
ansible/roles/nova/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ nova_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/octavia/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ octavia_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/opendaylight/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ opendaylight_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/openvswitch/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ openvswitch_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/ovs-dpdk/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ ovsdpdk_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/panko/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ panko_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/prometheus/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ prometheus_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/qdrouterd/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ qdrouterd_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/rabbitmq/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ rabbitmq_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/rally/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ rally_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/redis/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ redis_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/sahara/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ sahara_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/searchlight/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ searchlight_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/senlin/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ senlin_services }}"
6
+    service_name: "{{ project_name }}"

+ 12
- 0
ansible/roles/service-stop/tasks/main.yml View File

@@ -0,0 +1,12 @@
1
+---
2
+- name: "Stopping {{ service_name }} containers"
3
+  vars:
4
+    service: "{{ item.value }}"
5
+  kolla_docker:
6
+    action: "stop_container"
7
+    common_options: "{{ docker_common_options }}"
8
+    name: "{{ service.container_name }}"
9
+  when:
10
+    - service.enabled | bool
11
+    - service.container_name not in skip_stop_containers
12
+  with_dict: "{{ project_services }}"

+ 6
- 0
ansible/roles/skydive/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ skydive_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/solum/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ solum_services }}"
6
+    service_name: "{{ project_name }}"

+ 0
- 17
ansible/roles/stop/tasks/copy_tools.yml View File

@@ -1,17 +0,0 @@
1
----
2
-- name: Creating /kolla-stop/tools directory on node
3
-  file:
4
-    state: directory
5
-    path: /tmp/kolla-stop/tools
6
-
7
-- name: Copying validate-docker-execute.sh file
8
-  copy:
9
-    src: ../tools/validate-docker-execute.sh
10
-    dest: /tmp/kolla-stop/tools
11
-    mode: 0755
12
-
13
-- name: Copying stop-containers file
14
-  copy:
15
-    src: ../tools/stop-containers
16
-    dest: /tmp/kolla-stop/tools
17
-    mode: 0755

+ 0
- 4
ansible/roles/stop/tasks/main.yml View File

@@ -1,4 +0,0 @@
1
----
2
-- include_tasks: copy_tools.yml
3
-
4
-- include_tasks: stop_containers.yml

+ 0
- 3
ansible/roles/stop/tasks/stop_containers.yml View File

@@ -1,3 +0,0 @@
1
----
2
-- name: Stopping Kolla containers
3
-  command: /tmp/kolla-stop/tools/stop-containers

+ 6
- 0
ansible/roles/storm/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ storm_services }}"
6
+    service_name: "{{ project_name }}"

+ 136
- 0
ansible/roles/swift/tasks/stop.yml View File

@@ -0,0 +1,136 @@
1
+---
2
+- name: Stopping swift-rsyncd container
3
+  kolla_docker:
4
+    action: "stop_container"
5
+    common_options: "{{ docker_common_options }}"
6
+    name: "swift_rsyncd"
7
+  when: ( inventory_hostname in groups['swift-account-server'] or
8
+          inventory_hostname in groups['swift-container-server'] or
9
+          inventory_hostname in groups['swift-object-server'] ) and
10
+          'swift_rsyncd' not in skip_stop_containers
11
+
12
+- name: Stopping swift-account-server container
13
+  kolla_docker:
14
+    action: "stop_container"
15
+    common_options: "{{ docker_common_options }}"
16
+    name: "swift_account_server"
17
+  when:
18
+    - inventory_hostname in groups['swift-account-server']
19
+    - "'swift_account_server' not in skip_stop_containers"
20
+
21
+- name: Stopping swift-account-auditor container
22
+  kolla_docker:
23
+    action: "stop_container"
24
+    common_options: "{{ docker_common_options }}"
25
+    name: "swift_account_auditor"
26
+  when:
27
+    - inventory_hostname in groups['swift-account-server']
28
+    - "'swift_object_auditor' not in skip_stop_containers"
29
+
30
+- name: Stopping swift-account-replicator container
31
+  kolla_docker:
32
+    action: "stop_container"
33
+    common_options: "{{ docker_common_options }}"
34
+    name: "swift_account_replicator"
35
+  when:
36
+    - inventory_hostname in groups['swift-account-server']
37
+    - "'swift_account_replicator' not in skip_stop_containers"
38
+
39
+- name: Stopping swift-account-reaper container
40
+  kolla_docker:
41
+    action: "stop_container"
42
+    common_options: "{{ docker_common_options }}"
43
+    name: "swift_account_reaper"
44
+  when:
45
+    - inventory_hostname in groups['swift-account-server']
46
+    - "'swift_account_reaper' not in skip_stop_containers"
47
+
48
+- name: Stopping swift-container-server container
49
+  kolla_docker:
50
+    action: "stop_container"
51
+    common_options: "{{ docker_common_options }}"
52
+    name: "swift_container_server"
53
+  when:
54
+    - inventory_hostname in groups['swift-container-server']
55
+    - "'swift_container_server' not in skip_stop_containers"
56
+
57
+- name: Stopping swift-container-auditor container
58
+  kolla_docker:
59
+    action: "stop_container"
60
+    common_options: "{{ docker_common_options }}"
61
+    name: "swift_container_auditor"
62
+  when:
63
+    - inventory_hostname in groups['swift-container-server']
64
+    - "'swift_container_auditor' not in skip_stop_containers"
65
+
66
+- name: Stopping swift-container-replicator container
67
+  kolla_docker:
68
+    action: "stop_container"
69
+    common_options: "{{ docker_common_options }}"
70
+    name: "swift_container_replicator"
71
+  when:
72
+    - inventory_hostname in groups['swift-container-server']
73
+    - "'swift_container_replicator' not in skip_stop_containers"
74
+
75
+- name: Stopping swift-container-updater container
76
+  kolla_docker:
77
+    action: "stop_container"
78
+    common_options: "{{ docker_common_options }}"
79
+    name: "swift_container_updater"
80
+  when:
81
+    - inventory_hostname in groups['swift-container-server']
82
+    - "'swift_container_updater' not in skip_stop_containers"
83
+
84
+- name: Stopping swift-object-server container
85
+  kolla_docker:
86
+    action: "stop_container"
87
+    common_options: "{{ docker_common_options }}"
88
+    name: "swift_object_server"
89
+  when:
90
+    - inventory_hostname in groups['swift-object-server']
91
+    - "'swift_object_server' not in skip_stop_containers"
92
+
93
+- name: Stopping swift-object-auditor container
94
+  kolla_docker:
95
+    action: "stop_container"
96
+    common_options: "{{ docker_common_options }}"
97
+    name: "swift_object_auditor"
98
+  when:
99
+    - inventory_hostname in groups['swift-object-server']
100
+    - "'swift_object_auditor' not in skip_stop_containers"
101
+
102
+- name: Stopping swift-object-replicator container
103
+  kolla_docker:
104
+    action: "stop_container"
105
+    common_options: "{{ docker_common_options }}"
106
+    name: "swift_object_replicator"
107
+  when:
108
+    - inventory_hostname in groups['swift-object-server']
109
+    - "'swift_object_replicator' not in skip_stop_containers"
110
+
111
+- name: Stopping swift-object-updater container
112
+  kolla_docker:
113
+    action: "start_container"
114
+    common_options: "{{ docker_common_options }}"
115
+    name: "swift_object_updater"
116
+  when:
117
+    - inventory_hostname in groups['swift-object-server']
118
+    - "'swift_object_updater' not in skip_stop_containers"
119
+
120
+- name: Stopping swift-object-expirer container
121
+  kolla_docker:
122
+    action: "stop_container"
123
+    common_options: "{{ docker_common_options }}"
124
+    name: "swift_object_expirer"
125
+  when:
126
+    - inventory_hostname in groups['swift-object-server']
127
+    - "'swift_object_expirer' not in skip_stop_containers"
128
+
129
+- name: Stopping swift-proxy-server container
130
+  kolla_docker:
131
+    action: "stop_container"
132
+    common_options: "{{ docker_common_options }}"
133
+    name: "swift_proxy_server"
134
+  when:
135
+    - inventory_hostname in groups['swift-proxy-server']
136
+    - "'swift_proxy_server' not in skip_stop_containers"

+ 6
- 0
ansible/roles/tacker/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ tacker_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/telegraf/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ telegraf_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/tempest/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ tempest_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/trove/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ trove_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/vitrage/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ vitrage_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/vmtp/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ vmtp_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/watcher/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ watcher_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/zookeeper/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ zookeeper_services }}"
6
+    service_name: "{{ project_name }}"

+ 6
- 0
ansible/roles/zun/tasks/stop.yml View File

@@ -0,0 +1,6 @@
1
+---
2
+- import_role:
3
+    role: service-stop
4
+  vars:
5
+    project_services: "{{ zun_services }}"
6
+    service_name: "{{ project_name }}"

+ 0
- 4
ansible/stop.yml View File

@@ -1,4 +0,0 @@
1
----
2
-- hosts: all
3
-  roles:
4
-    - stop

+ 11
- 0
releasenotes/notes/stop-per-service-85a996bb2751ed52.yaml View File

@@ -0,0 +1,11 @@
1
+---
2
+features:
3
+  - |
4
+    Add support to stop a service with ``kolla-ansible stop`` command.
5
+    This feature will allow to stop specific services with ``--tags`` and
6
+    ``--limit`` to a host.
7
+upgrade:
8
+  - |
9
+    New ``kolla-ansible stop`` command requires the usage of
10
+    ``--yes-i-really-really-mean-it`` to avoid accidentally
11
+    stopping services.

+ 0
- 1
setup.cfg View File

@@ -28,7 +28,6 @@ data_files =
28 28
     share/kolla-ansible/tools = tools/cleanup-containers
29 29
     share/kolla-ansible/tools = tools/cleanup-host
30 30
     share/kolla-ansible/tools = tools/cleanup-images
31
-    share/kolla-ansible/tools = tools/stop-containers
32 31
     share/kolla-ansible/tools = tools/ovs-dpdkctl.sh
33 32
     share/kolla-ansible/doc = doc/*
34 33
     share/kolla-ansible/etc_examples = etc/*

+ 10
- 1
tools/kolla-ansible View File

@@ -330,7 +330,16 @@ EOF
330 330
         ;;
331 331
 (stop)
332 332
         ACTION="Stop Kolla containers"
333
-        PLAYBOOK="${BASEDIR}/ansible/stop.yml"
333
+        EXTRA_OPTS="$EXTRA_OPTS -e kolla_action=stop"
334
+        if [[ "${DANGER_CONFIRM}" != "--yes-i-really-really-mean-it" ]]; then
335
+            cat << EOF
336
+WARNING:
337
+    This will stop all deployed kolla containers, limit with tags is possible and also with
338
+    skip_stop_containers variable. To confirm, please add the following option:
339
+    --yes-i-really-really-mean-it
340
+EOF
341
+            exit 1
342
+        fi
334 343
         ;;
335 344
 (certificates)
336 345
         ACTION="Generate TLS Certificates"

+ 0
- 18
tools/stop-containers View File

@@ -1,18 +0,0 @@
1
-#!/bin/bash
2
-if [[ $(pgrep qemu) ]]; then
3
-    echo "Some qemu processes were detected."
4
-    echo "Docker will not be able to stop the nova_libvirt container with those running."
5
-    echo "Please clean them up before rerunning this script."
6
-    exit 1
7
-fi
8
-
9
-if [ -n "$1" ]; then
10
-    containers_to_stop=($(docker ps | grep -E "$1" | awk '{print $1}'))
11
-else
12
-    containers_to_stop=$(docker ps --filter "label=kolla_version" --format "{{.Names}}" -a)
13
-fi
14
-
15
-echo "Stopping containers..."
16
-(docker stop -t 30 ${containers_to_stop} 2>&1) > /dev/null
17
-
18
-echo "All containers stopped!"

Loading…
Cancel
Save