kolla-ansible/tools/validate-docker-execute.sh
Mark Goddard a11d376389 Use become for all docker tasks
Many tasks that use Docker have become specified already, but
not all. This change ensures all tasks that use the following
modules have become:

* kolla_docker
* kolla_ceph_keyring
* kolla_toolbox
* kolla_container_facts

It also adds become for 'command' tasks that use docker CLI.

Change-Id: I4a5ebcedaccb9261dbc958ec67e8077d7980e496
(cherry picked from commit b123bf6621)
2019-06-28 11:26:57 +01:00

15 lines
389 B
Bash
Executable File

#!/bin/bash
#
# This script can be used to check user privilege to execute
# docker commands
function check_dockerexecute {
sudo docker ps &>/dev/null
return_val=$?
if [ $return_val -ne 0 ]; then
echo "User $USER can't seem to run Docker commands. Verify product documentation to allow user to execute docker commands" 1>&2
exit 1
fi
}
check_dockerexecute