diff --git a/config.cfg b/config.cfg index e8b6559bc..27cb29d6a 100644 --- a/config.cfg +++ b/config.cfg @@ -217,7 +217,7 @@ cloud_providers: disk: 10 vultr: os: Ubuntu 22.04 LTS x64 - size: 1024 MB RAM,25 GB SSD,1.00 TB BW + size: vc2-1c-1gb linode: type: g6-nanode-1 image: linode/ubuntu22.04 diff --git a/roles/cloud-vultr/tasks/main.yml b/roles/cloud-vultr/tasks/main.yml index 2aa1b8daf..ccbcd13b6 100644 --- a/roles/cloud-vultr/tasks/main.yml +++ b/roles/cloud-vultr/tasks/main.yml @@ -4,16 +4,17 @@ - block: - name: Creating a firewall group - vultr_firewall_group: + vultr.cloud.firewall_group: name: "{{ algo_server_name }}" - name: Creating firewall rules - vultr_firewall_rule: + vultr.cloud.firewall_rule: group: "{{ algo_server_name }}" protocol: "{{ item.protocol }}" port: "{{ item.port }}" - ip_version: "{{ item.ip }}" - cidr: "{{ item.cidr }}" + ip_type: "{{ item.ip }}" + subnet: "{{ item.cidr.split('/')[0] }}" + subnet_size: "{{ item.cidr.split('/')[1] }}" with_items: - { protocol: tcp, port: "{{ ssh_port }}", ip: v4, cidr: 0.0.0.0/0 } - { protocol: tcp, port: "{{ ssh_port }}", ip: v6, cidr: "::/0" } @@ -25,13 +26,13 @@ - { protocol: udp, port: "{{ wireguard_port }}", ip: v6, cidr: "::/0" } - name: Upload the startup script - vultr_startup_script: + vultr.cloud.startup_script: name: algo-startup script: | {{ lookup('template', 'files/cloud-init/base.yml') }} - name: Creating a server - vultr_server: + vultr.cloud.instance: name: "{{ algo_server_name }}" startup_script: algo-startup hostname: "{{ algo_server_name }}" @@ -40,17 +41,18 @@ region: "{{ algo_vultr_region }}" firewall_group: "{{ algo_server_name }}" state: started - tag: Environment:Algo - ipv6_enabled: true - auto_backup_enabled: false - notify_activate: false + tags: + - Environment:Algo + enable_ipv6: true + backups: false + activation_email: false register: vultr_server - set_fact: - cloud_instance_ip: "{{ vultr_server.vultr_server.v4_main_ip }}" + cloud_instance_ip: "{{ vultr_server.vultr_instance.main_ip }}" ansible_ssh_user: algo ansible_ssh_port: "{{ ssh_port }}" cloudinit: true environment: - VULTR_API_CONFIG: "{{ algo_vultr_config }}" + VULTR_API_KEY: "{{ lookup('ini', 'key', section='default', file=algo_vultr_config) }}" diff --git a/roles/cloud-vultr/tasks/prompts.yml b/roles/cloud-vultr/tasks/prompts.yml index 1245b719f..7813b0f5b 100644 --- a/roles/cloud-vultr/tasks/prompts.yml +++ b/roles/cloud-vultr/tasks/prompts.yml @@ -42,7 +42,7 @@ What region should the server be located in? (https://www.vultr.com/locations/): {% for r in vultr_regions %} - {{ loop.index }}. {{ r['name'] }} + {{ loop.index }}. {{ r['name'] }} ({{ r['regioncode'] | lower }}) {% endfor %} Enter the number of your desired region @@ -54,5 +54,5 @@ set_fact: algo_vultr_region: >- {% if region is defined %}{{ region }} - {%- elif _algo_region.user_input %}{{ vultr_regions[_algo_region.user_input | int -1 ]['name'] }} - {%- else %}{{ vultr_regions[default_region | int - 1]['name'] }}{% endif %} + {%- elif _algo_region.user_input %}{{ vultr_regions[_algo_region.user_input | int -1 ]['name'] | lower }} + {%- else %}{{ vultr_regions[default_region | int - 1]['regioncode'] | lower }}{% endif %}