Defined Type: docker::network
- Defined in:
- modules/docker/manifests/network.pp
Summary
Manage a Docker networkOverview
SPDX-License-Identifier: Apache-2.0
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'modules/docker/manifests/network.pp', line 8
define docker::network(
Wmflib::Ensure $ensure,
Stdlib::IP::Address $subnet,
Enum['bridge', 'overlay'] $driver = 'bridge',
) {
if $ensure == 'present' {
exec { "create-docker-network-${title}":
command => @("CMD"/L$)
/usr/bin/docker network create \
--driver='${driver}' \
--subnet='${subnet}' \
'${title}'
|- CMD
,
unless => "/usr/bin/docker network ls --format '{{.Name}}' | grep -q '^${title}$'",
}
} else {
exec { "remove-docker-network-${title}":
command => "/usr/bin/docker network rm '${title}'",
onlyif => "/usr/bin/docker network ls --format '{{.Name}}' | grep -q '^${title}$'",
}
}
}
|