linode / linode/ansible_linode

[Bug]:

Open
#843 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
63
Forks
38
Avg merge
5d 20h
Merged PRs (30d)
7

Description

### Ansible Version

ansible [core 2.19.10] config file = /opt/ansible/ansible.cfg configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /tmp/venv/lib/python3.11/site-packages/ansible ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections executable location = /tmp/venv/bin/ansible python version = 3.11.12 (main, May 22 2025, 01:26:49) [GCC 10.2.1 20210110] (/tmp/venv/bin/python) jinja version = 3.1.6 pyyaml version = 6.0.3 (with libyaml v0.2.5)

### Ansible Configuration

CALLBACKS_ENABLED(/opt/ansible/ansible.cfg) = ['ansible.posix.profile_tasks']
CONFIG_FILE() = /opt/ansible/ansible.cfg
DEFAULT_VAULT_PASSWORD_FILE(/opt/ansible/ansible.cfg) = /opt/ansible/secrets/.vault-pass
HOST_KEY_CHECKING(/opt/ansible/ansible.cfg) = False

### Effected Components

instance

### Expected Behavior

I am testing my ansible playbook, so while testing I delete / create my linode many times

When I delete instance, and then create instance like this:

```
- name: Create empty Linode instance for {{ label }}
# https://github.com/linode/ansible_linode/blob/main/docs/modules/instance.md
linode.cloud.instance:
api_token: "{{ linode_api_token }}"
label: "{{ label }}"
type: "{{ instance_type }}"
region: "{{ region }}"
booted: false
disk_encryption: disabled
boot_config_label: config
tags:
- "{{ instance_tag }}"
disks:
- label: boot
size: "{{ boot_partition_size }}"
filesystem: raw
- label: swap
size: "{{ swap_partition_size }}"
filesystem: raw
- label: root
size: "{{ root_partition_size }}"
filesystem: raw
configs:
- label: boot-config
# https://api.linode.com/v4/linode/kernels?page=4
kernel: linode/direct-disk
root_device: /dev/sda
devices:
sda:
disk_label: boot
sdb:
disk_label: swap
sdc:
disk_label: root
helpers:
devtmpfs_automount: false
distro: false
modules_dep: false
network: false
updatedb_disabled: false
interfaces:
- purpose: public
- purpose: vlan
label: "{{ vlan }}"
state: present
```

and then I boot my instance in rescue mode like below:

```
- name: Boot Linode instance into rescue mode
# https://github.com/linode/ansible_linode/blob/dev/docs/modules/api_request.md
linode.cloud.api_request:
# https://www.linode.com/docs/api/linode-instances/#linode-boot-into-rescue-mode
api_token: "{{ linode_api_token }}"
path: "/linode/instances/{{ linode_instance_info.instance.id }}/rescue"
method: POST
body:
devices:
sda:
disk_id: "{{ linode_instance_info.configs[0].devices.sda.disk_id | int }}"
sdb:
disk_id: "{{ linode_instance_info.configs[0].devices.sdb.disk_id | int }}"
sdc:
disk_id: "{{ linode_instance_info.configs[0].devices.sdc.disk_id | int }}"
```

I expect `/dev/{sda,sdb,sdc}` to be what is requested by the API request

### Actual Behavior

The block device mapping inside the Finnix rescue environment does not match the expected /dev device assignments, inside Finnix, additional unexpected SCSI block devices are present:

sda 512M writable
sdb 4G writable
sdc 0B read-only
sdd 20.5G writable
sde 0B read-only
sdf 0B read-only
sdg 0B read-only

what I expected to be available as `/dev/sdc`, is not consistently exposed as /dev/sdc. Depending on the boot, it appears as a different /dev/sdX device (for example /dev/sdd or /dev/sdf).

The additional zero-capacity devices report SCSI errors during boot:

Read Capacity(16) failed
Sense Key : Not Ready
Add. Sense: Logical unit not ready, manual intervention required
0 512-byte logical blocks: (0 B/0 B)
Write Protect is on

The issue is reproducible when deleting and recreating Linode instances rapidly during testing. If the instance recreation is delayed for a longer period (for example overnight), the issue does not reproduce.

The problem prevents automation that relies on the documented rescue device mapping (/dev/sdc for the third attached disk), because the actual Linux device names are nondeterministic.

### Steps to Reproduce

create instance:

```
- name: Create empty Linode instance for {{ label }}
# https://github.com/linode/ansible_linode/blob/main/docs/modules/instance.md
linode.cloud.instance:
api_token: "{{ linode_api_token }}"
label: "{{ label }}"
type: "{{ instance_type }}"
region: "{{ region }}"
booted: false
disk_encryption: disabled
boot_config_label: config
tags:
- "{{ instance_tag }}"
disks:
- label: boot
size: "{{ boot_partition_size }}"
filesystem: raw
- label: swap
size: "{{ swap_partition_size }}"
filesystem: raw
- label: root
size: "{{ root_partition_size }}"
filesystem: raw
configs:
- label: boot-config
# https://api.linode.com/v4/linode/kernels?page=4
kernel: linode/direct-disk
root_device: /dev/sda
devices:
sda:
disk_label: boot
sdb:
disk_label: swap
sdc:
disk_label: root
helpers:
devtmpfs_automount: false
distro: false
modules_dep: false
network: false
updatedb_disabled: false
interfaces:
- purpose: public
- purpose: vlan
label: "{{ vlan }}"
state: present
```

once created, delete instance:

```
- name: Delete Linode instance for {{ label }}
# https://github.com/linode/ansible_linode/blob/main/docs/modules/instance.md
linode.cloud.instance:
api_token: "{{ linode_api_token }}"
label: "{{ label }}"
state: absent
when:
- linode_instances_list.instances | length == 1 and linode_instance_info.instance.label == label
delegate_to: localhost
tags:
- "{{ task_tag_delete_instance }}"
```

then immediately create again:
```
- name: Create empty Linode instance for {{ label }}
# https://github.com/linode/ansible_linode/blob/main/docs/modules/instance.md
linode.cloud.instance:
api_token: "{{ linode_api_token }}"
label: "{{ label }}"
type: "{{ instance_type }}"
region: "{{ region }}"
booted: false
disk_encryption: disabled
boot_config_label: config
tags:
- "{{ instance_tag }}"
disks:
- label: boot
size: "{{ boot_partition_size }}"
filesystem: raw
- label: swap
size: "{{ swap_partition_size }}"
filesystem: raw
- label: root
size: "{{ root_partition_size }}"
filesystem: raw
configs:
- label: boot-config
# https://api.linode.com/v4/linode/kernels?page=4
kernel: linode/direct-disk
root_device: /dev/sda
devices:
sda:
disk_label: boot
sdb:
disk_label: swap
sdc:
disk_label: root
helpers:
devtmpfs_automount: false
distro: false
modules_dep: false
network: false
updatedb_disabled: false
interfaces:
- purpose: public
- purpose: vlan
label: "{{ vlan }}"
state: present
```

and boot to rescue mode:

```
- name: Boot Linode instance into rescue mode
# https://github.com/linode/ansible_linode/blob/dev/docs/modules/api_request.md
linode.cloud.api_request:
# https://www.linode.com/docs/api/linode-instances/#linode-boot-into-rescue-mode
api_token: "{{ linode_api_token }}"
path: "/linode/instances/{{ linode_instance_info.instance.id }}/rescue"
method: POST
body:
devices:
sda:
disk_id: "{{ linode_instance_info.configs[0].devices.sda.disk_id | int }}"
sdb:
disk_id: "{{ linode_instance_info.configs[0].devices.sdb.disk_id | int }}"
sdc:
disk_id: "{{ linode_instance_info.configs[0].devices.sdc.disk_id | int }}"
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the rapid delete/create cycle with the linode.cloud.instance and linode.cloud.api_request tasks shown in the report, then compare the requested rescue disk IDs with the devices exposed in Finnix. Check whether the nondeterministic /dev/sdX assignments originate in the collection request or the rescue environment. Done means the documented device mapping is reliable or the issue is clearly scoped with evidence identifying the responsible component.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux
Domain
cloud, devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.