|
23 | 23 | #====================================================================================================================== |
24 | 24 | set -o nounset # Treat unset variables as an error |
25 | 25 |
|
26 | | -__ScriptVersion="2023.06.28" |
| 26 | +__ScriptVersion="2023.07.25" |
27 | 27 | __ScriptName="bootstrap-salt.sh" |
28 | 28 |
|
29 | 29 | __ScriptFullName="$0" |
@@ -277,6 +277,8 @@ _MINIMUM_PIP_VERSION="9.0.1" |
277 | 277 | _MINIMUM_SETUPTOOLS_VERSION="9.1" |
278 | 278 | _POST_NEON_PIP_INSTALL_ARGS="--prefix=/usr" |
279 | 279 | _PIP_DOWNLOAD_ARGS="" |
| 280 | +_QUICK_START="$BS_FALSE" |
| 281 | +_AUTO_ACCEPT_MINION_KEYS="$BS_FALSE" |
280 | 282 |
|
281 | 283 | # Defaults for install arguments |
282 | 284 | ITYPE="stable" |
@@ -395,6 +397,8 @@ __usage() { |
395 | 397 | resort method. NOTE: This only works for functions which actually |
396 | 398 | implement pip based installations. |
397 | 399 | -q Quiet salt installation from git (setup.py install -q) |
| 400 | + -Q Quickstart, install the Salt master and the Salt minion. |
| 401 | + And automatically accept the minion key. |
398 | 402 | -R Specify a custom repository URL. Assumes the custom repository URL |
399 | 403 | points to a repository that mirrors Salt packages located at |
400 | 404 | repo.saltproject.io. The option passed with -R replaces the |
|
426 | 430 | } # ---------- end of function __usage ---------- |
427 | 431 |
|
428 | 432 |
|
429 | | -while getopts ':hvnDc:g:Gyx:k:s:MSNXCPFUKIA:i:Lp:dH:bflV:J:j:rR:aq' opt |
| 433 | +while getopts ':hvnDc:g:Gyx:k:s:MSNXCPFUKIA:i:Lp:dH:bflV:J:j:rR:aqQ' opt |
430 | 434 | do |
431 | 435 | case "${opt}" in |
432 | 436 |
|
|
470 | 474 | J ) _CUSTOM_MASTER_CONFIG=$OPTARG ;; |
471 | 475 | j ) _CUSTOM_MINION_CONFIG=$OPTARG ;; |
472 | 476 | q ) _QUIET_GIT_INSTALLATION=$BS_TRUE ;; |
| 477 | + Q ) _QUICK_START=$BS_TRUE ;; |
473 | 478 | x ) _PY_EXE="$OPTARG" ;; |
474 | 479 | y ) _INSTALL_PY="$BS_TRUE" ;; |
475 | 480 |
|
@@ -714,6 +719,31 @@ elif [ "$ITYPE" = "onedir_rc" ]; then |
714 | 719 | fi |
715 | 720 | fi |
716 | 721 |
|
| 722 | +# Doing a quick start, so install master |
| 723 | +# set master address to 127.0.0.1 |
| 724 | +if [ "$_QUICK_START" -eq "$BS_TRUE" ]; then |
| 725 | + # make install type is stable |
| 726 | + ITYPE="stable" |
| 727 | + |
| 728 | + # make sure the revision is latest |
| 729 | + STABLE_REV="latest" |
| 730 | + ONEDIR_REV="latest" |
| 731 | + |
| 732 | + # make sure we're installing the master |
| 733 | + _INSTALL_MASTER=$BS_TRUE |
| 734 | + |
| 735 | + # override incase install minion |
| 736 | + # is set to false |
| 737 | + _INSTALL_MINION=$BS_TRUE |
| 738 | + |
| 739 | + # Set master address to loopback IP |
| 740 | + _SALT_MASTER_ADDRESS="127.0.0.1" |
| 741 | + |
| 742 | + # Auto accept the minion key |
| 743 | + # when the install is done. |
| 744 | + _AUTO_ACCEPT_MINION_KEYS=$BS_TRUE |
| 745 | +fi |
| 746 | + |
717 | 747 | # Check for any unparsed arguments. Should be an error. |
718 | 748 | if [ "$#" -gt 0 ]; then |
719 | 749 | __usage |
@@ -4670,7 +4700,7 @@ __install_saltstack_rhel_onedir_repository() { |
4670 | 4700 | if [ "${ONEDIR_REV}" = "nightly" ] ; then |
4671 | 4701 | base_url="${HTTP_VAL}://${_REPO_URL}/${_ONEDIR_NIGHTLY_DIR}/${__PY_VERSION_REPO}/redhat/${DISTRO_MAJOR_VERSION}/\$basearch/" |
4672 | 4702 | fi |
4673 | | - if [ "$(echo "${ONEDIR_REV}" | grep -E '(3004|3005)')" != "" ]; then |
| 4703 | + if [ "$(echo "${ONEDIR_REV}" | grep -E '(3004|3005)')" != "" ] || [ "${ONEDIR_REV}" = "nightly" ]; then |
4674 | 4704 | if [ "${DISTRO_MAJOR_VERSION}" -eq 9 ]; then |
4675 | 4705 | gpg_key="SALTSTACK-GPG-KEY2.pub" |
4676 | 4706 | else |
@@ -6464,7 +6494,7 @@ install_amazon_linux_ami_2_onedir_deps() { |
6464 | 6494 | base_url="$HTTP_VAL://${_REPO_URL}/${_ONEDIR_NIGHTLY_DIR}/${__PY_VERSION_REPO}/amazon/2/\$basearch/" |
6465 | 6495 | fi |
6466 | 6496 |
|
6467 | | - if [ "$(echo "${ONEDIR_REV}" | grep -E '(3004|3005)')" != "" ]; then |
| 6497 | + if [ "$(echo "${ONEDIR_REV}" | grep -E '(3004|3005)')" != "" ] || [ "${ONEDIR_REV}" = "nightly" ]; then |
6468 | 6498 | gpg_key="${base_url}SALTSTACK-GPG-KEY.pub,${base_url}base/RPM-GPG-KEY-CentOS-7" |
6469 | 6499 | if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then |
6470 | 6500 | gpg_key="${base_url}SALTSTACK-GPG-KEY.pub" |
@@ -9698,13 +9728,25 @@ if [ "$DAEMONS_RUNNING_FUNC" != "null" ] && [ ${_START_DAEMONS} -eq $BS_TRUE ]; |
9698 | 9728 | fi |
9699 | 9729 | fi |
9700 | 9730 |
|
| 9731 | +if [ "$_AUTO_ACCEPT_MINION_KEYS" -eq "$BS_TRUE" ]; then |
| 9732 | + echoinfo "Accepting the Salt Minion Keys" |
| 9733 | + salt-key -yA |
| 9734 | +fi |
| 9735 | + |
9701 | 9736 | # Done! |
9702 | 9737 | if [ "$_CONFIG_ONLY" -eq $BS_FALSE ]; then |
9703 | 9738 | echoinfo "Salt installed!" |
9704 | 9739 | else |
9705 | 9740 | echoinfo "Salt configured!" |
9706 | 9741 | fi |
9707 | 9742 |
|
| 9743 | +if [ "$_QUICK_START" -eq "$BS_TRUE" ]; then |
| 9744 | + echoinfo "Congratulations!" |
| 9745 | + echoinfo "A couple of commands to try:" |
| 9746 | + echoinfo " salt \* test.ping" |
| 9747 | + echoinfo " salt \* test.version" |
| 9748 | +fi |
| 9749 | + |
9708 | 9750 | exit 0 |
9709 | 9751 |
|
9710 | 9752 | # vim: set sts=4 ts=4 et |
0 commit comments