Skip to content

docker_plugin fails if plugin exists and plugin_options are set #211

Open
@lmergner

Description

@lmergner
SUMMARY

docker plugin throws an error when it tries to set an activated plugin. If a plugin already exists, but you have plugin_options: {<options>} in the task, it will fail instead of modifying the plugin.

It's also unclear from the docs whether I need to install (state: present) before I enable (state: enabled) a plugin using ansible. If I enable it, does the module also install it?

This might be a reason to have a docker_plugin_info since, using ansible, I cannot read docker plugin ls — and docker_host_info does not include a section for plugins. If I know which plugins are installed and enabled, we can conditionally install, disable, reconfigure, etc. Using command: docker plugin ls is a bit of an anti-pattern isn't it?

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.docker.docker_plugin

ANSIBLE VERSION
ansible [core 2.11.5]
  config file = /Users/lmerg/code/cluster/ansible.cfg
  configured module search path = ['/Users/lmerg/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/lmerg/.pyenv/versions/3.9.5/envs/cluster/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/lmerg/code
  executable location = /Users/lmerg/.pyenv/versions/cluster/bin/ansible
  python version = 3.9.5 (default, May 25 2021, 17:35:37) [Clang 11.0.0 (clang-1100.0.33.16)]
  jinja version = 3.0.1
  libyaml = True
COLLECTION VERSION
 /Users/lmerg/code/ansible_collections
Collection           Version
-------------------- -------
community.docker     1.9.1
CONFIGURATION
ANSIBLE_NOCOWS(/Users/lmerg/code/cluster/ansible.cfg) = True
CACHE_PLUGIN(/Users/lmerg/code/cluster/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/Users/lmerg/code/cluster/ansible.cfg) = /tmp/ansible_facts_cache
COLLECTIONS_PATHS(/Users/lmerg/code/cluster/ansible.cfg) = ['/Users/lmerg/code']
DEFAULT_GATHERING(/Users/lmerg/code/cluster/ansible.cfg) = smart
DEFAULT_HOST_LIST(/Users/lmerg/code/cluster/ansible.cfg) = ['/Users/lmerg/code/cluster/hosts.ini']
DEFAULT_VAULT_PASSWORD_FILE(env: ANSIBLE_VAULT_PASSWORD_FILE) = /Users/lmerg/code/cluster/.vault_pass
HOST_KEY_CHECKING(/Users/lmerg/code/cluster/ansible.cfg) = False
OS / ENVIRONMENT

Darwin mergner-air 19.6.0 Darwin Kernel Version 19.6.0: Mon Apr 12 20:57:45 PDT 2021; root:xnu-6153.141.28.1~1/RELEASE_X86_64 x86_64

STEPS TO REPRODUCE

Here is an example which requires plugin_options, but even the docker docs use sshfs which could take DEBUG=1 option

- name: Docker (install glusterfs plugin)
  community.docker.docker_plugin:
    plugin_name: marcelo-ochoa/glusterfs-volume-plugin:latest
    state: present
    alias: glusterfs
    plugin_options:
      SERVERS: "{{ groups['cluster'] | map('extract', hostvars, 'ansible_hostname') | map('join', '.lan') }}"
EXPECTED RESULTS
  1. Expected to skip configuring a plugin if installed.
  2. or, Expected that I'd be able to get information about plugins before trying to install with configuration options.
ACTUAL RESULTS
TASK [lmergner.mergnet.docker : Docker (install glusterfs plugin)] *********************
fatal: [mergnas]: FAILED! => {"changed": false, "msg": "500 Server Error for http+docker://localhost/v1.41/plugins/glusterfs:latest/set: Internal Server Error (\"cannot set on an active plugin, disable plugin before setting\")"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocker-plainplain Docker (no swarm, no compose, no stack)enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions