Skip to content

community.general.incus connection not working as inventory_hostname treated as litteral #7874

Closed
@x85446

Description

@x85446

Summary

In my environment I am connecting to an incus server via a remote client on OSX. Ansible, running on the OSX machine is utilizing roles, and gets the inventory_hostname from the filename under the host_vars directory. I suspect this environment is causing inventory_hostname to be treated as a litteral. A very similar bug was fixed community.general.lxd and be found here: #4912

I have already implemented the solution and will submit a pull request.

Issue Type

Bug Report

Component Name

incus.py connection plugin

Ansible Version

ansible [core 2.16.2]
  config file = /Users/travis/workspace/IZUMANETWORKS/siteinfra/Ansible/work/ansible.cfg
  configured module search path = ['/Users/travis/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/travis/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.11.7 (main, Dec  4 2023, 18:10:11) [Clang 15.0.0 (clang-1500.1.0.2.5)] (/opt/homebrew/opt/python@3.11/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
# /Users/travis/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 8.2.0

Configuration

$  ansible-config dump --only-changed
CONFIG_FILE() = /Users/travis/workspace/IZUMANETWORKS/siteinfra/Ansible/work/ansible.cfg
DEFAULT_HASH_BEHAVIOUR(/Users/travis/workspace/IZUMANETWORKS/siteinfra/Ansible/work/ansible.cfg) = merge
DEFAULT_HOST_LIST(/Users/travis/workspace//IZUMANETWORKS/siteinfra/Ansible/work/ansible.cfg) = ['/Users/travis/workspace/IZUMANETWORKS/siteinfra/Ansible/work/ansible.cfg) = ['/Users/travis/workspace/IZUMANETWORKS/siteinfra/Ansible/work/inventory.ini']
EDITOR(env: EDITOR) = emacs
HOST_KEY_CHECKING(/Users/travis/workspace/IZUMANETWORKS/siteinfra/Ansible/work/ansible.cfg) = False

OS / Environment

client: OSX
server: Ubuntu 22.04

Steps to Reproduce

# host_var file named IzumaMercury.yaml
ansible_connection: community.general.incus
ansible_user: root
ansible_become: no
ansible_incus_remote: IzumaExplorer

Expected Results

ansible-playbook -i inventories/tests/moffett.yaml setup_izuma_networks_vm_controllers_workers.yml

PLAY [vm_controllers] ****************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************
ok: [IzumaMercury]

Actual Results

ansible-playbook -i inventories/tests/moffett.yaml setup_izuma_networks_vm_controllers_workers.yml

PLAY [vm_controllers] ****************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************
[WARNING]: The "community.general.incus" connection plugin has an improperly configured remote target value, forcing
"inventory_hostname" templated value instead of the string
fatal: [IzumaMercury]: UNREACHABLE! => {"changed": false, "msg": "instance not found: inventory_hostname", "unreachable": true}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue/PR relates to a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions