Wanting to automate my docker volume rclone plugin (see: https://rclone.org/docker) install and volume creation with ansible. Typically with cli you would install the plugin with:
docker plugin install rclone/docker-volume-rclone:amd64 args="-v" --alias rclone --grant-all-permissions
I saw there is a docker_plugin module for ansible community.docker, and have made the following task:
- name: install docker volume rclone plugin
community.docker.docker_plugin:
plugin_name: rclone
state: present
But if I run that task and the plugin is already installed it will fail the play.
Question: What would be a way for me to provide the relevant information to the task so that I can provide a conditional that would skip this task if the plugin already exists on the system?
I see other docker modules that get a range of info for volumes/images/networks, but can’t see one for plugins.
Additional question (about same task): When providing arguments via cli, you would set it in the following format:
args="--rc --rc-web-gui --rc-web-gui-update --rc-web-gui-no-open-browser --rc-addr=:5572 --rc-user=username --rc-user-pass=pass --rc-enable-metrics"
But looking at the ansible docker_plugin page, the example with options looks like this:
- name: Install a plugin with options
community.docker.docker_plugin:
plugin_name: weaveworks/net-plugin:latest_release
plugin_options:
IPALLOC_RANGE: "10.32.0.0/12"
WEAVE_PASSWORD: "PASSWORD"
Would that mean I would have to provide the options like this?
plugin_options:
rc: 'true'
rc_web_gui: 'true'
rc_web_gui_update: 'true'
rc_web_gui_no_open_browser: 'true'
rc_addr: '{{ docker_rclone_webui_addr }}'
rc_user: '{{ docker_rclone_webui_user }}'
rc_user_pass: '{{ docker_rclone_webui_pass }}'
rc_enable_metrics: 'true'
alias: 'rclone'
Appreciate any help here. Thank you.
Tried running the above with the rclone docker volume plugin already installed. This resulted in a playbook error, unlike what would happen if say an ansible.builtin.apt package was already installed.
lebowski89 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.