Allow installing specific Docker-CE version
This commit is contained in:
parent
f2ef1ef0d6
commit
a7f4c8d773
4 changed files with 18 additions and 2 deletions
|
@ -20,6 +20,9 @@ OPTIONAL PARAMETERS
|
|||
-------------------
|
||||
state
|
||||
'present' or 'absent', defaults to 'present'
|
||||
version
|
||||
The specific version to install. Defaults to the special value 'latest',
|
||||
meaning the version the package manager will install by default.
|
||||
|
||||
|
||||
BOOLEAN PARAMETERS
|
||||
|
@ -38,6 +41,8 @@ EXAMPLES
|
|||
# Remove docker
|
||||
__docker --state absent
|
||||
|
||||
# Install specific version
|
||||
__docker --state present --version 18.03.0.ce
|
||||
|
||||
AUTHORS
|
||||
-------
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
os=$(cat "$__global/explorer/os")
|
||||
state=$(cat "$__object/parameter/state")
|
||||
version=$(cat "$__object/parameter/version")
|
||||
|
||||
case "$os" in
|
||||
centos)
|
||||
|
@ -33,7 +34,11 @@ case "$os" in
|
|||
--gpgcheck 1 \
|
||||
--gpgkey 'https://download.docker.com/linux/centos/gpg' \
|
||||
--state "${state}"
|
||||
require="__yum_repo/docker-ce-stable" __package docker-ce --state "${state}"
|
||||
if [ "$version" != "latest" ]; then
|
||||
require="__yum_repo/docker-ce-stable" __package docker-ce --version "${version}" --state "${state}"
|
||||
else
|
||||
require="__yum_repo/docker-ce-stable" __package docker-ce --state "${state}"
|
||||
fi
|
||||
else
|
||||
echo "CentOS version 7 is required!" >&2
|
||||
exit 1
|
||||
|
@ -53,7 +58,11 @@ case "$os" in
|
|||
--distribution "$(cat "$__global/explorer/lsb_codename")" \
|
||||
--state "${state}" \
|
||||
--component "stable"
|
||||
__package docker-ce --state "${state}"
|
||||
if [ "$version" != "latest" ]; then
|
||||
__package docker-ce --version "${version}" --state "${state}"
|
||||
else
|
||||
__package docker-ce --state "${state}"
|
||||
fi
|
||||
unset CDIST_ORDER_DEPENDENCY
|
||||
;;
|
||||
*)
|
||||
|
|
1
cdist/conf/type/__docker/parameter/default/version
Normal file
1
cdist/conf/type/__docker/parameter/default/version
Normal file
|
@ -0,0 +1 @@
|
|||
latest
|
|
@ -1 +1,2 @@
|
|||
state
|
||||
version
|
||||
|
|
Loading…
Reference in a new issue