From e0712965dc8f5acd367d8906dc64a88ce655c267 Mon Sep 17 00:00:00 2001 From: kennwhite Date: Wed, 21 Dec 2016 21:45:07 -0500 Subject: [PATCH] Fix undefined variable crash for local installs Corrects this crash that occurs at the end of a local (e.g., a new DigitalOcean Ubuntu 16.04.1 x64 droplet) at the "congrats" parsing stage: TASK [debug] ******************************************************************* fatal: [localhost]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: \"#----------------------------------------------------------------------#\"\n\"# Congratulations! #\"\n\"# Your Algo server is running. #\"\n\"# Config files and certificates are in the ./configs/ directory. #\"\n\"# Go to https://whoer.net/ after connecting #\"\n\"# and ensure that all your traffic passes through the VPN. #\"\n\"# Local DNS resolver and Proxy IP address: {{ local_service_ip }} #\"\n\"# The p12 password is {{ easyrsa_p12_export_password }} #\"\n\"# The CA key password is {{ easyrsa_CA_password }} #\"\n\"# Shell access: ssh -i {{ ansible_ssh_private_key_file }} {{ ansible_ssh_user }}@{{ ansible_ssh_host }} #\"\n\"#----------------------------------------------------------------------#\"\n: 'ansible_ssh_private_key_file' is undefined\n\nThe error appears to have been in '/root/algo/deploy.yml': line 61, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n post_tasks:\n - debug: msg=\"{{ congrats.split('\\n') }}\"\n ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes. Always quote template expression brackets when they\nstart a value. For instance:\n\n with_items:\n - {{ foo }}\n\nShould be written as:\n\n with_items:\n - \"{{ foo }}\"\n"} --- roles/local/tasks/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/local/tasks/main.yml b/roles/local/tasks/main.yml index d2deff6f..428d824e 100644 --- a/roles/local/tasks/main.yml +++ b/roles/local/tasks/main.yml @@ -4,6 +4,7 @@ groups: vpn-host ansible_ssh_user: "{{ server_user }}" ansible_python_interpreter: "/usr/bin/python2.7" + ansible_ssh_private_key_file: "{{ SSH_keys.private }}" cloud_provider: local when: server_ip != "localhost" @@ -13,6 +14,7 @@ groups: vpn-host ansible_ssh_user: "{{ server_user }}" ansible_python_interpreter: "/usr/bin/python2.7" + ansible_ssh_private_key_file: "{{ SSH_keys.private }}" ansible_connection: local cloud_provider: local when: server_ip == "localhost"