diff --git a/infra/image/build.sh b/infra/image/build.sh index 4f77b8482a06d90b4e103d30f3c2119b8d04abc5..b16021740b3443fcd91c548da0a2259df2f25827 100755 --- a/infra/image/build.sh +++ b/infra/image/build.sh @@ -56,6 +56,8 @@ distro=${1:-} [ -f "${BASEDIR}/dockerfile/${distro}" ] \ || die "${distro} is not a valid distro target.\nUse one of: $(valid_distro)" +[ -n "$(command -v "podman")" ] || die "podman is required." + if [ "${deploy_server}" == "Y" ] then [ -n "$(command -v "ansible-playbook")" ] || die "ansible-playbook is required to install FreeIPA." @@ -109,23 +111,32 @@ echo if [ "${deploy_server}" == "Y" ] then + deployed=false + log info "= Starting ${name} =" [ "${container_state}" == "running" ] || podman start "${name}" echo log info "= Deploying IPA =" - ansible-playbook -i "${inventory_file}" "${deploy_playbook}" + if ansible-playbook -i "${inventory_file}" "${deploy_playbook}" + then + deployed=true + fi echo - log info "= Enabling additional services =" - podman exec "${name}" systemctl enable fixnet - podman exec "${name}" systemctl enable fixipaip - echo + if $deployed; then + log info "= Enabling additional services =" + podman exec "${name}" systemctl enable fixnet + podman exec "${name}" systemctl enable fixipaip + echo + fi log info "= Stopping container ${name} =" podman stop "${name}" echo + $deployed || die "Deployment failed" + log info "= Committing \"${quayname}:${server_tag}\" =" podman commit "${name}" "${quayname}:${server_tag}" echo