trailofbits / algo

Set up a personal VPN in the cloud

Home Page:https://blog.trailofbits.com/2016/12/12/meet-algo-the-vpn-that-works/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fatal: [localhost]: FAILED! => The task includes an option with an undefined variable

alexisjamet opened this issue Β· comments

Hi there,

I'm trying to setup a VNP on Scaleway but I got the following fatal error (disclaimer: I'm a newbie πŸ˜…):

fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: list object has no element 0\n\nThe error appears to be in '/Users/xx/algo/roles/cloud-scaleway/tasks/main.yml': line 12, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Set cloud specific facts\n ^ here\n"}

Could you please help me set it up the right way? thanks

Cheers,
Alexis πŸ˜‰

`[WARNING]: Could not match supplied host pattern, ignoring: vpn-host

PLAY [localhost] *********************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************
ok: [localhost]

TASK [Playbook dir stat] *************************************************************************************************************************************************************************************************
ok: [localhost]

TASK [Ensure Ansible is not being run in a world writable directory] *****************************************************************************************************************************************************
ok: [localhost] => {
"changed": false,
"msg": "All assertions passed"
}

TASK [Ensure the requirements installed] *********************************************************************************************************************************************************************************
ok: [localhost]

TASK [Set required ansible version as a fact] ****************************************************************************************************************************************************************************
ok: [localhost] => (item=ansible==2.9.20)

TASK [Verify Python meets Algo VPN requirements] *************************************************************************************************************************************************************************
ok: [localhost] => {
"changed": false,
"msg": "All assertions passed"
}

TASK [Verify Ansible meets Algo VPN requirements] ************************************************************************************************************************************************************************
ok: [localhost] => {
"changed": false,
"msg": "All assertions passed"
}
[WARNING]: Found variable using reserved name: no_log

PLAY [Ask user for the input] ********************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************
ok: [localhost]
[Cloud prompt]
What provider would you like to use?
1. DigitalOcean
2. Amazon Lightsail
3. Amazon EC2
4. Microsoft Azure
5. Google Compute Engine
6. Hetzner Cloud
7. Vultr
8. Scaleway
9. OpenStack (DreamCompute optimised)
10. CloudStack (Exoscale optimised)
11. Linode
12. Install to existing Ubuntu 18.04 or 20.04 server (for more advanced users)

Enter the number of your desired provider
:

TASK [Cloud prompt] ******************************************************************************************************************************************************************************************************
ok: [localhost]

TASK [Set facts based on the input] **************************************************************************************************************************************************************************************
ok: [localhost]
[VPN server name prompt]
Name the vpn server
[algo]
:

TASK [VPN server name prompt] ********************************************************************************************************************************************************************************************
ok: [localhost]
[Cellular On Demand prompt]
Do you want macOS/iOS clients to enable "Connect On Demand" when connected to cellular networks?
[y/N]
:

TASK [Cellular On Demand prompt] *****************************************************************************************************************************************************************************************
ok: [localhost]
[Wi-Fi On Demand prompt]
Do you want macOS/iOS clients to enable "Connect On Demand" when connected to Wi-Fi?
[y/N]
:

TASK [Wi-Fi On Demand prompt] ********************************************************************************************************************************************************************************************
ok: [localhost]
[Trusted Wi-Fi networks prompt]
List the names of any trusted Wi-Fi networks where macOS/iOS clients should not use "Connect On Demand"
(e.g., your home network. Comma-separated value, e.g., HomeNet,OfficeWifi,AlgoWiFi)
:

TASK [Trusted Wi-Fi networks prompt] *************************************************************************************************************************************************************************************
ok: [localhost]
[Retain the PKI prompt]
Do you want to retain the keys (PKI)? (required to add users in the future, but less secure)
[y/N]
:

TASK [Retain the PKI prompt] *********************************************************************************************************************************************************************************************
ok: [localhost]
[DNS adblocking prompt]
Do you want to enable DNS ad blocking on this VPN server?
[y/N]
:

TASK [DNS adblocking prompt] *********************************************************************************************************************************************************************************************
ok: [localhost]
[SSH tunneling prompt]
Do you want each user to have their own account for SSH tunneling?
[y/N]
:

TASK [SSH tunneling prompt] **********************************************************************************************************************************************************************************************
ok: [localhost]

TASK [Set facts based on the input] **************************************************************************************************************************************************************************************
ok: [localhost]

PLAY [Provision the server] **********************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************
ok: [localhost]

--> Please include the following block of text when reporting issues:

Algo running on: macOS 11.4
Created from git clone. Last commit: e5235e1 Bump ansible from 2.9.7 to 2.9.20 (#14220)
Python 3.8.2
Runtime variables:
algo_provider "scaleway"
algo_ondemand_cellular "True"
algo_ondemand_wifi "True"
algo_ondemand_wifi_exclude "X251bGw="
algo_dns_adblocking "True"
algo_ssh_tunneling "True"
wireguard_enabled "True"
dns_encryption "True"

TASK [Display the invocation environment] ********************************************************************************************************************************************************************************
changed: [localhost]

TASK [Install the requirements] ******************************************************************************************************************************************************************************************
ok: [localhost]

TASK [Generate the SSH private key] **************************************************************************************************************************************************************************************
ok: [localhost]

TASK [Generate the SSH public key] ***************************************************************************************************************************************************************************************
ok: [localhost]

TASK [Copy the private SSH key to /tmp] **********************************************************************************************************************************************************************************
ok: [localhost]
[DEPRECATION WARNING]: scaleway_organization_facts is kept for backwards compatibility but usage is discouraged. The module documentation details page may explain more about this rationale.. This feature will be
removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: scaleway_image_facts is kept for backwards compatibility but usage is discouraged. The module documentation details page may explain more about this rationale.. This feature will be removed in a
future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[cloud-scaleway : pause]
Enter your auth token (https://trailofbits.github.io/algo/cloud-scaleway.html)
(output is hidden):

TASK [cloud-scaleway : pause] ********************************************************************************************************************************************************************************************
ok: [localhost]
[cloud-scaleway : pause]
What region should the server be located in?
1. par1
2. ams1

Enter the number of your desired region
[par1]
:

TASK [cloud-scaleway : pause] ********************************************************************************************************************************************************************************************
ok: [localhost]

TASK [cloud-scaleway : Set scaleway facts] *******************************************************************************************************************************************************************************
ok: [localhost]

TASK [cloud-scaleway : Gather Scaleway organizations facts] **************************************************************************************************************************************************************
[WARNING]: https://account.scaleway.com/organizations?
ok: [localhost]

TASK [cloud-scaleway : Get images] ***************************************************************************************************************************************************************************************
[WARNING]: https://cp-par1.scaleway.com/images?
ok: [localhost]

TASK [cloud-scaleway : Set cloud specific facts] *************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: list object has no element 0\n\nThe error appears to be in '/Users/xx/algo/roles/cloud-scaleway/tasks/main.yml': line 12, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Set cloud specific facts\n ^ here\n"}
included: /Users/xx/algo/playbooks/rescue.yml for localhost

TASK [debug] *************************************************************************************************************************************************************************************************************
ok: [localhost] => {
"fail_hint": [
"Sorry, but something went wrong!",
"Please check the troubleshooting guide.",
"https://trailofbits.github.io/algo/troubleshooting.html"
]
}

TASK [Fail the installation] *********************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed as requested from task"}

PLAY RECAP ***************************************************************************************************************************************************************************************************************
localhost : ok=31 changed=1 unreachable=0 failed=1 skipped=0 rescued=1 ignored=0`

Just to confirm, I have the exact same issue with Scaleway. Running algo from Linux.
Running the tip of master with a clean config.

Offending file appears to be algo/roles/cloud-scaleway/tasks/main.yml': line 14, column 5.

rbazile on rbazile-xps ~/Documents/admin/VPN/algo on ξ‚  master [$!] 
β””βžœ ./algo 

PLAY [localhost] ******************************************************************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************************************************************
ok: [localhost]

TASK [Playbook dir stat] **********************************************************************************************************************************************************
ok: [localhost]

TASK [Ensure Ansible is not being run in a world writable directory] **************************************************************************************************************
ok: [localhost] => {
    "changed": false,
    "msg": "All assertions passed"
}
[WARNING]: The value '' is not a valid IP address or network, passing this value to ipaddr filter might result in breaking change in future.

TASK [Ensure the requirements installed] ******************************************************************************************************************************************
ok: [localhost]

TASK [Set required ansible version as a fact] *************************************************************************************************************************************
ok: [localhost] => (item=ansible-core==2.11.3)

TASK [Verify Python meets Algo VPN requirements] **********************************************************************************************************************************
ok: [localhost] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [Verify Ansible meets Algo VPN requirements] *********************************************************************************************************************************
ok: [localhost] => {
    "changed": false,
    "msg": "All assertions passed"
}
[WARNING]: Found variable using reserved name: no_log

PLAY [Ask user for the input] *****************************************************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************************************************************
ok: [localhost]
[Cloud prompt]
What provider would you like to use?
    1. DigitalOcean
    2. Amazon Lightsail
    3. Amazon EC2
    4. Microsoft Azure
    5. Google Compute Engine
    6. Hetzner Cloud
    7. Vultr
    8. Scaleway
    9. OpenStack (DreamCompute optimised)
    10. CloudStack (Exoscale optimised)
    11. Linode
    12. Install to existing Ubuntu 18.04 or 20.04 server (for more advanced users)
  
Enter the number of your desired provider
:
8^M
TASK [Cloud prompt] ***************************************************************************************************************************************************************
ok: [localhost]

TASK [Set facts based on the input] ***********************************************************************************************************************************************
ok: [localhost]
[VPN server name prompt]
Name the vpn server
[algo]
:
^M
TASK [VPN server name prompt] *****************************************************************************************************************************************************
ok: [localhost]
[Cellular On Demand prompt]
Do you want macOS/iOS clients to enable "Connect On Demand" when connected to cellular networks?
[y/N]
:
^M
TASK [Cellular On Demand prompt] **************************************************************************************************************************************************
ok: [localhost]
[Wi-Fi On Demand prompt]
Do you want macOS/iOS clients to enable "Connect On Demand" when connected to Wi-Fi?
[y/N]
:
^M
TASK [Wi-Fi On Demand prompt] *****************************************************************************************************************************************************
ok: [localhost]
[DNS adblocking prompt]
Do you want to enable DNS ad blocking on this VPN server?
[y/N]
:
y^M
TASK [DNS adblocking prompt] ******************************************************************************************************************************************************
ok: [localhost]
[SSH tunneling prompt]
Do you want each user to have their own account for SSH tunneling?
[y/N]
:
y^M
TASK [SSH tunneling prompt] *******************************************************************************************************************************************************
ok: [localhost]

TASK [Set facts based on the input] ***********************************************************************************************************************************************
ok: [localhost]

PLAY [Provision the server] *******************************************************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************************************************************
ok: [localhost]

--> Please include the following block of text when reporting issues:

Algo running on: Manjaro Linux
Created from git clone. Last commit: de1e909 Update cloud-linode.md (#14348)
Python 3.9.7
Runtime variables:
    algo_provider "scaleway"
    algo_dns_adblocking "True"
    algo_ssh_tunneling "True"
    wireguard_enabled "True"
    dns_encryption "True"

TASK [Display the invocation environment] *****************************************************************************************************************************************
changed: [localhost -> localhost]

TASK [Install the requirements] ***************************************************************************************************************************************************
ok: [localhost -> localhost]

TASK [Generate the SSH private key] ***********************************************************************************************************************************************
ok: [localhost]

TASK [Generate the SSH public key] ************************************************************************************************************************************************
ok: [localhost]

TASK [Copy the private SSH key to /tmp] *******************************************************************************************************************************************
ok: [localhost -> localhost]

TASK [Include a provisioning role] ************************************************************************************************************************************************
[cloud-scaleway : pause]
Enter your auth token (https://trailofbits.github.io/algo/cloud-scaleway.html)
 (output is hidden):

TASK [cloud-scaleway : pause] *****************************************************************************************************************************************************
ok: [localhost]
[cloud-scaleway : pause]
What region should the server be located in?
    1. par1
    2. ams1
  
Enter the number of your desired region
[par1]
:
2^M
TASK [cloud-scaleway : pause] *****************************************************************************************************************************************************
ok: [localhost]

TASK [cloud-scaleway : Set scaleway facts] ****************************************************************************************************************************************
ok: [localhost]

TASK [cloud-scaleway : Gather Scaleway organizations facts] ***********************************************************************************************************************
[WARNING]: https://account.scaleway.com/organizations?
ok: [localhost]

TASK [cloud-scaleway : Get images] ************************************************************************************************************************************************
[WARNING]: https://api.scaleway.com/instance/v1/zones/nl-ams-1/images?
ok: [localhost]

TASK [cloud-scaleway : Set cloud specific facts] **********************************************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: list object has no element 0\n\nThe error appears to be in '/home/rbazile/Documents/admin/VPN/algo/roles/cloud-scaleway/tasks/main.yml': line 14, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n  - name: Set cloud specific facts\n    ^ here\n"}

TASK [include_tasks] **************************************************************************************************************************************************************
included: /home/rbazile/Documents/admin/VPN/algo/playbooks/rescue.yml for localhost

TASK [debug] **********************************************************************************************************************************************************************
ok: [localhost] => {
    "fail_hint": [
        "Sorry, but something went wrong!",
        "Please check the troubleshooting guide.",
        "https://trailofbits.github.io/algo/troubleshooting.html"
    ]
}

TASK [Fail the installation] ******************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed as requested from task"}

PLAY RECAP ************************************************************************************************************************************************************************
localhost                  : ok=29   changed=1    unreachable=0    failed=1    skipped=2    rescued=1    ignored=0   

I did some debugging, and I realized that no organisation data is fetched:

TASK [cloud-scaleway : organization] **********************************************************************************************************************************************
ok: [localhost] => {
    "msg": {
        "changed": false,
        "failed": false,
        "scaleway_organization_info": [],
        "warnings": [
            "https://account.scaleway.com/organizations?"
        ]
    }
}

I found so by inserting the following here:

  - name: organization
    debug:
      msg: "{{ scaleway_org }}"

This points to an issue with this Ansible module.

Looks like the Project ID is needed, not the Organization ID, see #14182 (comment)

I had similar problem with Scaleway.
I replaced in /algo/roles/cloud-scaleway/tasks/main.yml
line 16 to:

   - name: Set cloud specific facts
     set_fact:
       organization_id: "<my organization id>"

organization I obtained from curl https://account.scaleway.com/tokens/$SCW_ACCESS_KEY -H "X-Auth-Token: $SCW_SECRET_KEY"
access and secret key I created in my scaleway account at credentials page. And it works