-
Notifications
You must be signed in to change notification settings - Fork 6
F add test machine env password option #638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
f39c967
0b9ee61
13e93c8
4e1793d
68e1bfc
76e7f05
d3231c6
f3c7d0d
92ae971
9c08c0e
cef377f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,7 @@ aurora_home=/tmp/aurora | |
|
|
||
| playbook=$1 | ||
| aurora_limit=all | ||
| test_machine=false | ||
| shift | ||
|
|
||
| while [[ $# -gt 1 ]] | ||
|
|
@@ -67,14 +68,18 @@ case ${key} in | |
| read_secure="$2" | ||
| shift 2 | ||
| ;; | ||
| --test-machine) | ||
| test_machine="$2" | ||
| shift 2 | ||
| ;; | ||
| *) | ||
| break | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
|
|
||
| if [[ "${playbook}" = "server_and_nuc_deploy" || "${playbook}" = "teleop_deploy" ]]; then | ||
| if [[ "${playbook}" = "server_and_nuc_deploy" || "${playbook}" = "teleop_deploy" ]] && [[ "${test_machine}" = "false" ]]; then | ||
| if [[ -z ${read_secure} ]]; then | ||
| read_secure="sudo_password" | ||
| else | ||
|
|
@@ -116,6 +121,7 @@ echo "playbook = ${playbook}" | |
| echo "branch = ${aurora_tools_branch}" | ||
| echo "inventory = ${aurora_inventory}" | ||
| echo "limit = ${aurora_limit}" | ||
| echo "Testing setup= ${test_machine}" | ||
|
|
||
| export ANSIBLE_ROLES_PATH="${aurora_home}/ansible/roles" | ||
| export ANSIBLE_CALLBACK_PLUGINS="${HOME}/.ansible/plugins/callback:/usr/share/ansible/plugins/callback:${aurora_home}/ansible/playbooks/callback_plugins" | ||
|
|
@@ -328,6 +334,11 @@ echo " | Installing needed packages |" | |
| echo " ---------------------------------" | ||
| echo "" | ||
|
|
||
| if [[ "${test_machine}" = "true" ]]; then | ||
| echo $test_password | sudo -S echo "Running on testing machine. Retrieving passwords from ENV..." | ||
| formatted_extra_vars="$formatted_extra_vars sudo_password=$test_password docker_username=$docker_username docker_password=$docker_password ansible_sudo_pass=$test_password" | ||
| fi | ||
|
|
||
| # Wait for apt-get update lock file to be released | ||
| while (sudo fuser /var/lib/apt/lists/lock >/dev/null 2>&1) || (sudo fuser /var/lib/dpkg/lock >/dev/null 2>&1) do | ||
| echo "Waiting for apt-get update file lock..." | ||
|
|
@@ -395,15 +406,23 @@ if [[ "${playbook}" = "server_and_nuc_deploy" ]]; then | |
| else | ||
| aurora_inventory="ansible/inventory/server_and_nuc/${aurora_inventory}" | ||
| fi | ||
| ansible_flags="${ansible_flags} --ask-vault-pass" | ||
| if [[ "${test_machine}" = "true" ]]; then | ||
| ansible_flags="${ansible_flags} --vault-password-file /home/$USER/vault.sh" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does the vault.sh file look like? Should we add an exmple file? or a comment describing the contents of such file? |
||
| else | ||
| ansible_flags="${ansible_flags} --ask-vault-pass" | ||
| fi | ||
| echo "" | ||
| echo " ---------------------------------------------------" | ||
| echo " | VAULT password: |" | ||
| echo " | Enter the VAULT password provided by Shadow |" | ||
| echo " ---------------------------------------------------" | ||
| echo "" | ||
| elif [[ "${playbook}" = "teleop_deploy" ]]; then | ||
| ansible_flags="${ansible_flags} --ask-vault-pass" | ||
| if [[ "${test_machine}" = "true" ]]; then | ||
| ansible_flags="${ansible_flags} --vault-password-file /home/$USER/vault.sh" | ||
| else | ||
| ansible_flags="${ansible_flags} --ask-vault-pass" | ||
| fi | ||
| if [[ "${aurora_inventory}" = "" ]]; then | ||
| aurora_inventory="ansible/inventory/teleop/production" | ||
| else | ||
|
|
@@ -418,7 +437,9 @@ elif [[ "${playbook}" = "teleop_deploy" ]]; then | |
| echo "" | ||
| else | ||
| aurora_inventory="ansible/inventory/${aurora_inventory}" | ||
| ansible_flags="${ansible_flags} --ask-become-pass" | ||
| if [[ "${test_machine}" != "true" ]]; then | ||
| ansible_flags="${ansible_flags} --ask-become-pass" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why don't we need the become password in the test_machine case? |
||
| fi | ||
| echo "" | ||
| echo " --------------------------------------------" | ||
| echo " | BECOME password: |" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does the variable
test_passwordget set? Should we add an example or instructions or a script that calls run-ansible.sh after setting this variable?