ansible-hashistack/roles/docker/tasks/docker_plugin.yml

24 lines
625 B
YAML
Raw Normal View History

2023-09-20 09:49:32 +02:00
---
- name: check if plugin already installed
ansible.builtin.command:
cmd: docker plugin list
register: list_plugins
become: true
- name: debug registered plugins
ansible.builtin.debug:
msg: "{{ list_plugins }}"
- name: enable docker plugin
ansible.builtin.command:
cmd: "docker plugin install {{ item.identifier }}:{{ item.version }} --alias {{ item.alias }} --grant-all-permissions"
register: plugin_install
become: true
when: "item.alias + ':' + item.version not in list_plugins.stdout"
- name: restart docker
ansible.builtin.service:
name: docker
state: restarted
become: true