Lxd profile management by ansible

Hi @all,

i try to manage my lxd-profile by ansible using:
https://docs.ansible.com/ansible/latest/collections/community/general/lxd_profile_module.html
on Ubuntu 20.10.

Every time i get errors so i decided to use the plain example from the module:

# An example for creating a profile via http connection
- hosts: localhost
  connection: local
  tasks:
    - name: Create macvlan profile
      community.general.lxd_profile:
      url: https://127.0.0.1:8443
      # These client_cert and client_key values are equal to the default values.
      #client_cert: "{{ lookup('env', 'HOME') }}/.config/lxc/client.crt"
      #client_key: "{{ lookup('env', 'HOME') }}/.config/lxc/client.key"
      trust_password: mypassword
      name: macvlan
      state: present
      config: {}
      description: my macvlan profile
      devices:
        eth0:
          nictype: macvlan
          parent: br0
          type: nic

Error

An exception occurred during task execution. To see the full traceback, use -vvv.
The error was: FileNotFoundError: [Errno 2] No such file or director fatal: [localhost]: FAILED! => {“changed”: false, “module_stderr”: “Traceback (most recent call last):\n File “/root/.ansible/tmp/ansible-tmp-1610919054.424919-2063-124513393060897/Ansi
ballZ_lxd_profile.py”, line 102, in \n _ansiballz_main()\n File “/root/.ansible/tmp/ansible-tmp-1610919054.424919-2063-124513393060897/AnsiballZ_lxd_profile.py”, line 94, i
n _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File “/root/.ansible/tmp/ansible-tmp-1610919054.424919-2063-124513393060897/AnsiballZ_lxd_profile.py”, l
ine 40, in invoke_module\n runpy.run_module(mod_name=‘ansible_collections.community.general.plugins.modules.lxd_profile’, init_globals=None, run_name=‘main’, alter_sys=True)\n Fil
e “/usr/lib/python3.8/runpy.py”, line 207, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File “/usr/lib/python3.8/runpy.py”, line 97, in _run_m
odule_code\n _run_code(code, mod_globals, init_globals,\n File “/usr/lib/python3.8/runpy.py”, line 87, in _run_code\n exec(code, run_globals)\n File “/tmp/ansible_community.gen
eral.lxd_profile_payload_ptc8q89h/ansible_community.general.lxd_profile_payload.zip/ansible_collections/community/general/plugins/modules/lxd_profile.py”, line 404, in \n File
“/tmp/ansible_community.general.lxd_profile_payload_ptc8q89h/ansible_community.general.lxd_profile_payload.zip/ansible_collections/community/general/plugins/modules/lxd_profile.py”, line
399, in main\n File “/tmp/ansible_community.general.lxd_profile_payload_ptc8q89h/ansible_community.general.lxd_profile_payload.zip/ansible_collections/community/general/plugins/modules
/lxd_profile.py”, line 234, in init\n File “/tmp/ansible_community.general.lxd_profile_payload_ptc8q89h/ansible_community.general.lxd_profile_payload.zip/ansible_collections/commun
ity/general/plugins/module_utils/lxd.py”, line 70, in init\nFileNotFoundError: [Errno 2] No such file or directory\n”, “module_stdout”: “”, “msg”: “MODULE FAILURE\nSee stdout/stderr
for the exact error”, “rc”: 1}

Is the Module broken?
Have anyone a working example?

It’s failing to find a file, possibly the lxc command line tool itself?