File tree 3 files changed +20
-1
lines changed
3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,10 @@ main() {
130
130
source " $SPIN_HOME /lib/actions/update.sh"
131
131
action_update
132
132
;;
133
+ vault)
134
+ source " $SPIN_HOME /lib/actions/vault.sh"
135
+ action_vault " $@ "
136
+ ;;
133
137
version)
134
138
source " $SPIN_HOME /lib/actions/version.sh"
135
139
action_version
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ action_init() {
116
116
echo " ${BOLD}${BLUE} ⚡️ Running Ansible Vault to encrypt \" $project_directory /.spin.yml\" ...${RESET} "
117
117
echo " ${BOLD}${YELLOW} ⚠️ NOTE: This password will be required anytime someone needs to change the \" .spin.yml\" file.${RESET} "
118
118
echo " ${BOLD}${YELLOW} We recommend using a RANDOM PASSWORD.${RESET} "
119
- docker run --name spin-ansible --rm --pull always - it -v " $( pwd) /$project_directory " :/project -w /project $DEFAULT_ANSIBLE_IMAGE ansible-vault encrypt .spin.yml
119
+ docker run --name spin-ansible --rm -it -v " $( pwd) /$project_directory " :/ansible $DEFAULT_ANSIBLE_IMAGE ansible-vault encrypt .spin.yml
120
120
echo " ${BOLD}${GREEN} ✅ \" $project_directory /.spin.yml\" has been encrypted.${RESET} "
121
121
echo " ${BOLD}${YELLOW} 👉 NOTE: You can save this password in \" .vault_password\" in the root of your project if you want your secret to be remembered.${RESET} "
122
122
elif [[ $encrypt_response =~ ^[Nn]$ ]]; then
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ action_vault (){
3
+ if [[ $1 == " edit" ]]; then
4
+
5
+ if [[ -z $2 ]]; then
6
+ echo " ${BOLD}${RED} ❌ Please specify a file to edit.${RESET} "
7
+ return 1
8
+ fi
9
+
10
+ echo " ${BOLD}${YELLOW} ℹ️ We're using ansible-vault within the container to edit your file, which uses \" vi\" .${RESET} "
11
+ echo " ${BOLD}${YELLOW} 👉 To edit the file, press i.${RESET} "
12
+ echo " ${BOLD}${YELLOW} 💾 To save your changes and exit, press ESC, then type \" :wq\" and press ENTER.${RESET} "
13
+ fi
14
+ docker run --name spin-ansible --rm -it -v " $( pwd) " :/ansible $DEFAULT_ANSIBLE_IMAGE ansible-vault " $@ "
15
+ }
You can’t perform that action at this time.
0 commit comments