mirror of
https://github.com/ansible-collections/community.docker.git
synced 2025-12-16 11:58:43 +00:00
docker_containers inventory: fix wrong default mentioned in docs, add fallback example (#194)
* Fix wrong default mentioned in docs. * Add fallback example.
This commit is contained in:
parent
4dfc3ae5d7
commit
8e1c9f890a
@ -38,11 +38,11 @@ options:
|
||||
connection_type:
|
||||
description:
|
||||
- Which connection type to use the containers.
|
||||
- Default is to use SSH (C(ssh)). For this, the options I(default_ip) and
|
||||
I(private_ssh_port) are used.
|
||||
- One way to connect to containers is to use SSH (C(ssh)). For this, the options I(default_ip) and
|
||||
I(private_ssh_port) are used. This requires that a SSH daemon is running inside the containers.
|
||||
- Alternatively, C(docker-cli) selects the
|
||||
R(docker connection plugin,ansible_collections.community.docker.docker_connection),
|
||||
and C(docker-api) selects the
|
||||
and C(docker-api) (default) selects the
|
||||
R(docker_api connection plugin,ansible_collections.community.docker.docker_api_connection).
|
||||
- When C(docker-api) is used, all Docker daemon configuration values are passed from the inventory plugin
|
||||
to the connection plugin. This can be controlled with I(configure_docker_daemon).
|
||||
@ -138,6 +138,14 @@ keyed_groups:
|
||||
# Add Linux hosts to an os_linux group
|
||||
- prefix: os
|
||||
key: docker_platform
|
||||
|
||||
# Example using SSH connection with an explicit fallback for when port 22 hasn't been
|
||||
# exported: use container name as ansible_ssh_host and 22 as ansible_ssh_port
|
||||
plugin: community.docker.docker_containers
|
||||
connection_type: ssh
|
||||
compose:
|
||||
ansible_ssh_host: ansible_ssh_host | default(docker_name[1:], true)
|
||||
ansible_ssh_port: ansible_ssh_port | default(22, true)
|
||||
'''
|
||||
|
||||
import re
|
||||
|
||||
Loading…
Reference in New Issue
Block a user