Files
algo/roles/cloud-linode/tasks/main.yml
T
42aa65da00 Migrate Linode and DigitalOcean modules to Ansible collections (#14908)
Replace custom modules with official Ansible collection equivalents:
- linode_v4 → linode.cloud.instance
- linode_stackscript_v4 → linode.cloud.stackscript
- digital_ocean_floating_ip → community.digitalocean.digital_ocean_floating_ip

Changes:
- Add linode.cloud and community.digitalocean to requirements.yml
- Update roles/cloud-linode/tasks/main.yml (FQCN + api_token param)
- Update roles/cloud-digitalocean/tasks/main.yml (FQCN)
- Remove 3 entries from .ansible-lint mock_modules
- Delete 3 custom modules (519 lines removed)

Modules kept (no collection equivalent or deferred):
- x25519_pubkey.py - crypto-specific, no equivalent
- scaleway_compute.py - complex state machine, deferred
- lightsail_region_facts.py - no collection equivalent
- gcp_compute_location_info.py - no equivalent, google.cloud deprecated

Closes #14902

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-28 17:39:11 -05:00

57 lines
1.6 KiB
YAML

---
- name: Include prompts
import_tasks: prompts.yml
- name: Set facts
set_fact:
stackscript: |
{{ lookup('template', 'files/cloud-init/base.sh') }}
mkdir -p /var/lib/cloud/data/ || true
touch /var/lib/cloud/data/result.json
- name: Create a stackscript
linode.cloud.stackscript:
api_token: "{{ algo_linode_token }}"
label: "{{ algo_server_name }}"
state: present
description: Environment:Algo
images:
- "{{ cloud_providers.linode.image }}"
script: |
{{ stackscript }}
register: _linode_stackscript
no_log: true
- name: Update the stackscript
uri:
url: https://api.linode.com/v4/linode/stackscripts/{{ _linode_stackscript.stackscript.id }}
method: PUT
body_format: json
body:
script: |
{{ stackscript }}
headers:
Content-Type: application/json
Authorization: Bearer {{ algo_linode_token }}
when: (_linode_stackscript.stackscript.script | hash('md5')) != (stackscript | hash('md5'))
no_log: true
- name: Creating an instance...
linode.cloud.instance:
api_token: "{{ algo_linode_token }}"
label: "{{ algo_server_name }}"
state: present
region: "{{ algo_linode_region }}"
image: "{{ cloud_providers.linode.image }}"
type: "{{ cloud_providers.linode.type }}"
authorized_keys: "{{ public_key }}"
stackscript_id: "{{ _linode_stackscript.stackscript.id }}"
register: _linode
no_log: true
- set_fact:
cloud_instance_ip: "{{ _linode.instance.ipv4[0] }}"
ansible_ssh_user: algo
ansible_ssh_port: "{{ ssh_port }}"
cloudinit: true