use ca_password from variable(--extra-vars) - non-interactive installation using ansible playbook (#1774)

* use ca_password from variable

* add tests to cover the changes

* update tests - PR #1774
This commit is contained in:
Saravanan Palanisamy 2020-04-25 20:32:16 +04:00 committed by GitHub
parent 27de76048c
commit 02fe2f7dd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 1 deletions

View File

@ -6,7 +6,7 @@
- name: Set facts
set_fact:
CA_password: "{{ lookup('password', '/dev/null length=16 chars=ascii_letters,digits,_,@') }}"
CA_password: "{{ ca_password|default(lookup('password', '/dev/null length=16 chars=ascii_letters,digits,_,@')) }}"
IP_subject_alt_name: "{{ IP_subject_alt_name }}"
- name: Set IPv6 support as a fact

25
tests/ca-password-fix.sh Normal file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Refer PR #1774 for more details.
set -ex
DEPLOY_ARGS="provider=local server=10.0.8.100 ssh_user=ubuntu endpoint=10.0.8.100 ondemand_cellular=true ondemand_wifi=true ondemand_wifi_exclude=test dns_adblocking=true ssh_tunneling=true store_pki=true install_headers=false tests=true local_service_ip=172.16.0.1"
CA_PASSWORD="test123"
if [ "${DEPLOY}" == "docker" ]
then
docker run -i -v $(pwd)/config.cfg:/algo/config.cfg -v ~/.ssh:/root/.ssh -v $(pwd)/configs:/algo/configs -e "DEPLOY_ARGS=${DEPLOY_ARGS}" local/algo /bin/sh -c "chown -R root: /root/.ssh && chmod -R 600 /root/.ssh && source .env/bin/activate && ansible-playbook main.yml -e \"${DEPLOY_ARGS}\" --skip-tags debug"
else
ansible-playbook main.yml -e "${DEPLOY_ARGS} ca_password=${CA_PASSWORD}"
fi
CA_PASSWORD_OUT=$(grep ca_password: configs/localhost/.config.yml | awk '{print $2}' | xargs)
if [ "$CA_PASSWORD" = "$CA_PASSWORD_OUT" ]; then
echo "ca_password tests(PR #1774) passed"
else
echo "ca_password tests(PR #1774) failed"
exit 1
fi