Skip to content

Commit a4a9d6d

Browse files
authored
Fix Vultr collection (#14707)
1 parent 0d1be72 commit a4a9d6d

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

config.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ cloud_providers:
217217
disk: 10
218218
vultr:
219219
os: Ubuntu 22.04 LTS x64
220-
size: 1024 MB RAM,25 GB SSD,1.00 TB BW
220+
size: vc2-1c-1gb
221221
linode:
222222
type: g6-nanode-1
223223
image: linode/ubuntu22.04

roles/cloud-vultr/tasks/main.yml

+14-12
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44

55
- block:
66
- name: Creating a firewall group
7-
vultr_firewall_group:
7+
vultr.cloud.firewall_group:
88
name: "{{ algo_server_name }}"
99

1010
- name: Creating firewall rules
11-
vultr_firewall_rule:
11+
vultr.cloud.firewall_rule:
1212
group: "{{ algo_server_name }}"
1313
protocol: "{{ item.protocol }}"
1414
port: "{{ item.port }}"
15-
ip_version: "{{ item.ip }}"
16-
cidr: "{{ item.cidr }}"
15+
ip_type: "{{ item.ip }}"
16+
subnet: "{{ item.cidr.split('/')[0] }}"
17+
subnet_size: "{{ item.cidr.split('/')[1] }}"
1718
with_items:
1819
- { protocol: tcp, port: "{{ ssh_port }}", ip: v4, cidr: 0.0.0.0/0 }
1920
- { protocol: tcp, port: "{{ ssh_port }}", ip: v6, cidr: "::/0" }
@@ -25,13 +26,13 @@
2526
- { protocol: udp, port: "{{ wireguard_port }}", ip: v6, cidr: "::/0" }
2627

2728
- name: Upload the startup script
28-
vultr_startup_script:
29+
vultr.cloud.startup_script:
2930
name: algo-startup
3031
script: |
3132
{{ lookup('template', 'files/cloud-init/base.yml') }}
3233
3334
- name: Creating a server
34-
vultr_server:
35+
vultr.cloud.instance:
3536
name: "{{ algo_server_name }}"
3637
startup_script: algo-startup
3738
hostname: "{{ algo_server_name }}"
@@ -40,17 +41,18 @@
4041
region: "{{ algo_vultr_region }}"
4142
firewall_group: "{{ algo_server_name }}"
4243
state: started
43-
tag: Environment:Algo
44-
ipv6_enabled: true
45-
auto_backup_enabled: false
46-
notify_activate: false
44+
tags:
45+
- Environment:Algo
46+
enable_ipv6: true
47+
backups: false
48+
activation_email: false
4749
register: vultr_server
4850

4951
- set_fact:
50-
cloud_instance_ip: "{{ vultr_server.vultr_server.v4_main_ip }}"
52+
cloud_instance_ip: "{{ vultr_server.vultr_instance.main_ip }}"
5153
ansible_ssh_user: algo
5254
ansible_ssh_port: "{{ ssh_port }}"
5355
cloudinit: true
5456

5557
environment:
56-
VULTR_API_CONFIG: "{{ algo_vultr_config }}"
58+
VULTR_API_KEY: "{{ lookup('ini', 'key', section='default', file=algo_vultr_config) }}"

roles/cloud-vultr/tasks/prompts.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
What region should the server be located in?
4343
(https://www.vultr.com/locations/):
4444
{% for r in vultr_regions %}
45-
{{ loop.index }}. {{ r['name'] }}
45+
{{ loop.index }}. {{ r['name'] }} ({{ r['regioncode'] | lower }})
4646
{% endfor %}
4747
4848
Enter the number of your desired region
@@ -54,5 +54,5 @@
5454
set_fact:
5555
algo_vultr_region: >-
5656
{% if region is defined %}{{ region }}
57-
{%- elif _algo_region.user_input %}{{ vultr_regions[_algo_region.user_input | int -1 ]['name'] }}
58-
{%- else %}{{ vultr_regions[default_region | int - 1]['name'] }}{% endif %}
57+
{%- elif _algo_region.user_input %}{{ vultr_regions[_algo_region.user_input | int -1 ]['name'] | lower }}
58+
{%- else %}{{ vultr_regions[default_region | int - 1]['regioncode'] | lower }}{% endif %}

0 commit comments

Comments
 (0)