algo
algo copied to clipboard
[Vultr] Error when creating server during Algo deployment
Describe the bug
Error during deploying Algo using Vultr cloud provider. The server is created in Vultr and it is running, the Algo script fails with an unexpected error:
File "/tmp/ansible_vultr_server_payload_b5dd82ti/ansible_vultr_server_payload.zip/ansible_collections/ngine_io/vultr/plugins/module_ut
ils/vultr.py", line 271, in normalize_result
ValueError: invalid literal for int() with base 10: '1.524'
To Reproduce
Steps to reproduce the behavior:
- Deploy Algo using Vultr.
- Region: New Jeresy, System: Ubuntu 22.04 LTS,
Expected behavior
Algo is deployed.
Additional context
Not sure if this may be related, but stumbled upon this, which looks like it may be related somehow.
Full log
$ ./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"
}
[DEPRECATION WARNING]: Use 'ansible.utils.ipaddr' module instead. This feature will be removed from ansible.netcommon in a release
after 2024-01-01. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[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==6.1.0)
TASK [Just get the list from default pip] **********************************************************************************************
ok: [localhost]
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
:
7^M
TASK [Cloud prompt] ********************************************************************************************************************
ok: [localhost]
TASK [Set facts based on the input] ****************************************************************************************************
ok: [localhost]
[VPN server name prompt]
Name the vpn server
[algo]
:
empire^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]
:
^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]
:
^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: Arch Linux
Created from git clone. Last commit: 651f949 Update cloud-hetzner.md (#14450)
Python 3.10.8
Runtime variables:
algo_provider "vultr"
algo_dns_adblocking "False"
algo_ssh_tunneling "False"
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]
TASK [Include a provisioning role] *****************************************************************************************************
[cloud-vultr : pause]
Enter the local path to your configuration INI file
(https://trailofbits.github.io/algo/cloud-vultr.html):
:
^M
TASK [cloud-vultr : pause] *************************************************************************************************************
ok: [localhost]
TASK [cloud-vultr : Set the token as a fact] *******************************************************************************************
ok: [localhost]
TASK [cloud-vultr : Get regions] *******************************************************************************************************
ok: [localhost]
TASK [cloud-vultr : Format regions] ****************************************************************************************************
ok: [localhost]
TASK [cloud-vultr : Set regions as a fact] *********************************************************************************************
ok: [localhost]
TASK [cloud-vultr : Set default region] ************************************************************************************************
ok: [localhost]
[cloud-vultr : pause]
What region should the server be located in?
(https://www.vultr.com/locations/):
1. Melbourne
2. Sydney
3. São Paulo
4. Toronto
5. Frankfurt
6. Madrid
7. Paris
8. London
9. Bangalore
10. Delhi NCR
11. Mumbai
12. Tokyo
13. Seoul
14. Mexico City
15. Amsterdam
16. Warsaw
17. Stockholm
18. Singapore
19. Atlanta
20. Chicago
21. Dallas
22. Honolulu
23. Los Angeles
24. Miami
25. New Jersey
26. Seattle
27. Silicon Valley
28. Johannesburg
Enter the number of your desired region
[25]
:
^M
TASK [cloud-vultr : pause] *************************************************************************************************************
ok: [localhost]
TASK [cloud-vultr : Set the desired region as a fact] **********************************************************************************
ok: [localhost]
TASK [cloud-vultr : Creating a firewall group] *****************************************************************************************
ok: [localhost]
TASK [cloud-vultr : Creating firewall rules] *******************************************************************************************
ok: [localhost] => (item={'protocol': 'tcp', 'port': 4160, 'ip': 'v4', 'cidr': '0.0.0.0/0'})
ok: [localhost] => (item={'protocol': 'tcp', 'port': 4160, 'ip': 'v6', 'cidr': '::/0'})
ok: [localhost] => (item={'protocol': 'udp', 'port': 500, 'ip': 'v4', 'cidr': '0.0.0.0/0'})
ok: [localhost] => (item={'protocol': 'udp', 'port': 500, 'ip': 'v6', 'cidr': '::/0'})
ok: [localhost] => (item={'protocol': 'udp', 'port': 4500, 'ip': 'v4', 'cidr': '0.0.0.0/0'})
ok: [localhost] => (item={'protocol': 'udp', 'port': 4500, 'ip': 'v6', 'cidr': '::/0'})
ok: [localhost] => (item={'protocol': 'udp', 'port': 51820, 'ip': 'v4', 'cidr': '0.0.0.0/0'})
ok: [localhost] => (item={'protocol': 'udp', 'port': 51820, 'ip': 'v6', 'cidr': '::/0'})
TASK [cloud-vultr : Upload the startup script] *****************************************************************************************
ok: [localhost]
TASK [cloud-vultr : Creating a server] *************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: invalid literal for int() with base 10: '1.524'
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 107, in <module>\n File \"<stdin>\", line 99, in _ansiballz_main\n File \"<stdin>\", line 47, in invoke_module\n File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_vultr_server_payload_m1893zre/ansible_vultr_server_payload.zip/ansible_collections/ngine_io/vultr/plugins/modules/vultr_server.py\", line 933, in <module>\n File \"/tmp/ansible_vultr_server_payload_m1893zre/ansible_vultr_server_payload.zip/ansible_collections/ngine_io/vultr/plugins/modules/vultr_server.py\", line 928, in main\n File \"/tmp/ansible_vultr_server_payload_m1893zre/ansible_vultr_server_payload.zip/ansible_collections/ngine_io/vultr/plugins/module_utils/vultr.py\", line 291, in get_result\n File \"/tmp/ansible_vultr_server_payload_m1893zre/ansible_vultr_server_payload.zip/ansible_collections/ngine_io/vultr/plugins/module_utils/vultr.py\", line 271, in normalize_result\nValueError: invalid literal for int() with base 10: '1.524'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
TASK [include_tasks] *******************************************************************************************************************
included: /home/jakub/dev/prv/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=36 changed=1 unreachable=0 failed=1 skipped=2 rescued=1 ignored=0
Truncated log from ./algo -vvv
invocation (better formating of the error):
TASK [cloud-vultr : Creating a server] *************************************************************************************************
task path: /home/jakub/dev/prv/algo/roles/cloud-vultr/tasks/main.yml:33
The full traceback is:
Traceback (most recent call last):
File "<stdin>", line 107, in <module>
File "<stdin>", line 99, in _ansiballz_main
File "<stdin>", line 47, in invoke_module
File "/usr/lib/python3.10/runpy.py", line 224, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib/python3.10/runpy.py", line 96, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/tmp/ansible_vultr_server_payload_b5dd82ti/ansible_vultr_server_payload.zip/ansible_collections/ngine_io/vultr/plugins/modules/vultr_server.py", line 933, in <module>
File "/tmp/ansible_vultr_server_payload_b5dd82ti/ansible_vultr_server_payload.zip/ansible_collections/ngine_io/vultr/plugins/modules/vultr_server.py", line 928, in main
File "/tmp/ansible_vultr_server_payload_b5dd82ti/ansible_vultr_server_payload.zip/ansible_collections/ngine_io/vultr/plugins/module_utils/vultr.py", line 291, in get_result
File "/tmp/ansible_vultr_server_payload_b5dd82ti/ansible_vultr_server_payload.zip/ansible_collections/ngine_io/vultr/plugins/module_utils/vultr.py", line 271, in normalize_result
ValueError: invalid literal for int() with base 10: '1.524'
fatal: [localhost]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 107, in <module>\n File \"<stdin>\", line 99, in _ansiballz_main\n File \"<stdin>\", line 47, in invoke_module\n File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_vultr_server_payload_b5dd82ti/ansible_vultr_server_payload.zip/ansible_collections/ngine_io/vultr/plugins/modules/vultr_server.py\", line 933, in <module>\n File \"/tmp/ansible_vultr_server_payload_b5dd82ti/ansible_vultr_server_payload.zip/ansible_collections/ngine_io/vultr/plugins/modules/vultr_server.py\", line 928, in main\n File \"/tmp/ansible_vultr_server_payload_b5dd82ti/ansible_vultr_server_payload.zip/ansible_collections/ngine_io/vultr/plugins/module_utils/vultr.py\", line 291, in get_result\n File \"/tmp/ansible_vultr_server_payload_b5dd82ti/ansible_vultr_server_payload.zip/ansible_collections/ngine_io/vultr/plugins/module_utils/vultr.py\", line 271, in normalize_result\nValueError: invalid literal for int() with base 10: '1.524'\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
Read vars_file 'config.cfg'
TASK [include_tasks] *******************************************************************************************************************
task path: /home/jakub/dev/prv/algo/cloud.yml:21
Read vars_file 'config.cfg'
included: /home/jakub/dev/prv/algo/playbooks/rescue.yml for localhost
Read vars_file 'config.cfg'
Read vars_file 'config.cfg'
TASK [debug] ***************************************************************************************************************************
task path: /home/jakub/dev/prv/algo/playbooks/rescue.yml:2
ok: [localhost] => {
"fail_hint": [
"Sorry, but something went wrong!",
"Please check the troubleshooting guide.",
"https://trailofbits.github.io/algo/troubleshooting.html"
]
}
Read vars_file 'config.cfg'
TASK [Fail the installation] ***********************************************************************************************************
task path: /home/jakub/dev/prv/algo/playbooks/rescue.yml:5
fatal: [localhost]: FAILED! => {
"changed": false,
"msg": "Failed as requested from task"
}
PLAY RECAP *****************************************************************************************************************************
localhost : ok=36 changed=1 unreachable=0 failed=1 skipped=2 rescued=1 ignored=0
same issue for me:
TASK [cloud-vultr : Creating a server] ************************************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: invalid literal for int() with base 10: '1.524'
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 107, in <module>\n File \"<stdin>\", line 99, in _ansiballz_main\n File \"<stdin>\", line 47, in invoke_module\n File \"<frozen runpy>\", line 226, in run_module\n File \"<frozen runpy>\", line 98, in _run_module_code\n File \"<frozen runpy>\", line 88, in _run_code\n File \"/tmp/ansible_vultr_server_payload_3sw6n4wn/ansible_vultr_server_payload.zip/ansible_collections/ngine_io/vultr/plugins/modules/vultr_server.py\", line 933, in <module>\n File \"/tmp/ansible_vultr_server_payload_3sw6n4wn/ansible_vultr_server_payload.zip/ansible_collections/ngine_io/vultr/plugins/modules/vultr_server.py\", line 928, in main\n File \"/tmp/ansible_vultr_server_payload_3sw6n4wn/ansible_vultr_server_payload.zip/ansible_collections/ngine_io/vultr/plugins/module_utils/vultr.py\", line 291, in get_result\n File \"/tmp/ansible_vultr_server_payload_3sw6n4wn/ansible_vultr_server_payload.zip/ansible_collections/ngine_io/vultr/plugins/module_utils/vultr.py\", line 271, in normalize_result\nValueError: invalid literal for int() with base 10: '1.524'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
fails on this line: https://github.com/ngine-io/ansible-collection-vultr/blob/master/plugins/module_utils/vultr.py#L271
did a bit of debugging, the problem is in "allowed_bandwidth_gb" parameter:
'allowed_bandwidth_gb': '1.524'
it's trying to convert it to int and fails.
as a workaround i patched vultr module and was able to depoy:
https://github.com/ngine-io/ansible-collection-vultr/blob/master/plugins/module_utils/vultr.py#L271
if config['convert_to'] == 'int':
try:
resource[search_key] = int(resource[search_key])
except:
resource[search_key] = int(float(resource[search_key]))
Workaround worked for me also, I was able to deploy the server
once you have activated virtualenv, using ansible-galaxy i installed ngine_io _vultr to version 1.1.3 (seems the problem is with version 1.1.2), and it worked successfully.
As ngine_io.vultr
uses the deprecated API v1, which is going to be disabled on Jun 30, this workaround will stop working too tomorrow. algo needs to change to use vultr.cloud
.
So know that we're after June 30, 2023... @louy2 What are the steps to workaround that issue?
I am using the fix by #14587 I also met the problem fixed by #14622 and using that too