community.docker.docker_machine – Docker Machine inventory source¶
Note
This plugin is part of the community.docker collection (version 1.2.2).
To install it use: ansible-galaxy collection install community.docker
.
To use it in a playbook, specify: community.docker.docker_machine
.
Synopsis¶
Get inventory hosts from Docker Machine.
Uses a YAML configuration file that ends with docker_machine.(yml|yaml).
The plugin sets standard host variables
ansible_host
,ansible_port
,ansible_user
andansible_ssh_private_key
.The plugin stores the Docker Machine ‘env’ output variables in dm_ prefixed host variables.
Requirements¶
The below requirements are needed on the local controller node that executes this inventory.
Parameters¶
Examples¶
# Minimal example
plugin: community.docker.docker_machine
# Example using constructed features to create a group per Docker Machine driver
# (https://docs.docker.com/machine/drivers/), e.g.:
# $ docker-machine create --driver digitalocean ... mymachine
# $ ansible-inventory -i ./path/to/docker-machine.yml --host=mymachine
# {
# ...
# "digitalocean": {
# "hosts": [
# "mymachine"
# ]
# ...
# }
strict: no
keyed_groups:
- separator: ''
key: docker_machine_node_attributes.DriverName
# Example grouping hosts by Digital Machine tag
strict: no
keyed_groups:
- prefix: tag
key: 'dm_tags'
# Example using compose to override the default SSH behaviour of asking the user to accept the remote host key
compose:
ansible_ssh_common_args: '"-o StrictHostKeyChecking=accept-new"'
Authors¶
Ximon Eighteen (@ximon18)