diff --git a/ansible/roles/service-stop/tasks/main.yml b/ansible/roles/service-stop/tasks/main.yml index 54265ed411..ea502f7144 100644 --- a/ansible/roles/service-stop/tasks/main.yml +++ b/ansible/roles/service-stop/tasks/main.yml @@ -7,6 +7,7 @@ action: "stop_container" common_options: "{{ docker_common_options }}" name: "{{ service.container_name }}" + ignore_missing: "{{ kolla_action_stop_ignore_missing | bool }}" when: - service.container_name not in skip_stop_containers with_dict: "{{ project_services | select_services_enabled_and_mapped_to_host }}" diff --git a/kolla_ansible/cli/commands.py b/kolla_ansible/cli/commands.py index bbeeece893..29c59eb097 100644 --- a/kolla_ansible/cli/commands.py +++ b/kolla_ansible/cli/commands.py @@ -281,6 +281,11 @@ class Stop(KollaAnsibleMixin, Command): required=True, help="WARNING! This action will remove the Openstack deployment!", ) + group.add_argument( + "--ignore-missing", + action="store_true", + help="Don't fail if there are missing containers" + ) return parser def take_action(self, parsed_args): @@ -288,6 +293,9 @@ class Stop(KollaAnsibleMixin, Command): extra_vars = {} extra_vars["kolla_action"] = "stop" + extra_vars["kolla_action_stop_ignore_missing"] = ( + "yes" if parsed_args.ignore_missing else "no" + ) playbooks = _choose_playbooks(parsed_args) diff --git a/releasenotes/notes/kolla-ansible-stop-ignore-missing-be57276213f0a7cd.yaml b/releasenotes/notes/kolla-ansible-stop-ignore-missing-be57276213f0a7cd.yaml new file mode 100644 index 0000000000..247af74f30 --- /dev/null +++ b/releasenotes/notes/kolla-ansible-stop-ignore-missing-be57276213f0a7cd.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Adds the flag ``--ignore-missing`` to ``kolla-ansible stop`` to avoid + failing when containers are absent.