我想使用 Ansible 删除 AWS ECS 存储库。我的 Ansible 版本是 2.4.1.0,它“应该”支持这个,您可以在这里查找:http ://docs.ansible.com/ansible/latest/ecs_ecr_module
但是它无法按预期工作,因为我的存储库仍然包含 docker 映像。
这是代码片段:
- name: destroy-ecr-repos
ecs_ecr: name=jenkins-app state=absent
Run Code Online (Sandbox Code Playgroud)
产生的错误消息是:
...
The error was: RepositoryNotEmptyException: An error occurred (RepositoryNotEmptyException) when calling the DeleteRepository operation: The repository with name 'jenkins-app' in registry with id 'xyz' cannot be deleted because it still contains images
...
Run Code Online (Sandbox Code Playgroud)
在AWS控制台中它运行得很好。只有一条警告文本提醒您存储库中仍有图像。但您仍然可以强制删除。
现在我的问题是:
是否可以以某种方式强制删除存储库(包括其图像)?
...或者...
我可以在删除存储库之前使用其他工具单独删除它们吗?
也许 ansible 方面根本没有实现,我必须使用“shell”模块来代替(并且可能为此打开一个功能请求)。
我非常感谢任何建议。