diff --git a/.bin/skansible.sh b/.bin/skansible.sh index 92f1f4d..946910e 100755 --- a/.bin/skansible.sh +++ b/.bin/skansible.sh @@ -64,7 +64,9 @@ import-gpg () { for id in "$@"; do gpg --export-secret-keys "$id" > "${SKATO_BOOTSTRAP_ROLE}/files/${SKANSIBLE_GPG}/${id}.key" + printf "Please manually add GPG key with 'id' of '%s' in 'users.\$username.gpg_keys' list of inventory file." "$id" done + printf "Please manually change ID attribute of GPG keys in 'users.\$username.gpg_keys' list of inventory file." } import-ssl () { @@ -73,6 +75,7 @@ import-ssl () { cp "/usr/local/share/ca-certificates/${domain}.key" "${SKATO_BOOTSTRAP_ROLE}/files/${SKANSIBLE_SSL}/${domain}.key" cp "/usr/local/share/ca-certificates/${domain}.pem" "${SKATO_BOOTSTRAP_ROLE}/files/${SKANSIBLE_SSL}/${domain}.pem" cp "/usr/local/share/ca-certificates/${domain}.crt" "${SKATO_BOOTSTRAP_ROLE}/files/${SKANSIBLE_SSL}/${domain}.crt" + printf "Please manually change 'fqdn' attribute in inventory file to '%s'." "$domain" done } @@ -84,10 +87,6 @@ import () { esac } -mksecret () { - true -} - decrypt () { while getopts "mv:i:d:" flag; do case "$flag" in @@ -159,12 +158,19 @@ encrypt () { fi fi - printf "Make sure to copy following output to appropriate YAML location.\n" + printf "Make sure to copy following to appropriate location in appropriate YAML file under %s: \n" "$SKATO_ANSIBLE_ROOT" if [[ -z "$VAR_NAME" ]]; then ansible-vault encrypt_string --name "$VAR_NAME" --stdin-name "$VAR_NAME" --vault-id "$VAULT_ID" --output - "$PASSWORD" else ansible-vault encrypt_string --stdin-name "$ID_TAG" --vault-id "$VAULT_ID" --output - "$PASSWORD" fi + YAMLS_WITH_PASSWORDS=("${SKATO_BOOTSTRAP_ROLE}/vars/main/software.yml" "${SKATO_BOOTSTRAP_ROLE}/defaults/main/software.yml") + printf "Examples of common YAML files passwords may be in: \n" + printf " 1. any YAML file in %s \n" "${SKATO_ANSIBLE_ROOT}/hostvars" + printf " 2. any YAML file in %s \n" "${SKATO_ANSIBLE_ROOT}/groupvars" + for i in "${!YAMLS_WITH_PASSWORDS[@]}"; do + printf " %u. %s \n" "$(( i + 3 ))" "${YAMLS_WITH_PASSWORDS[$i]}" + done } # source ./extensions.d/edit.sh