ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
818 stars 1.5k forks source link

Can't set cloud-init options when making a clone with proxmox_kvm module #5879

Closed sebdanielsson closed 1 week ago

sebdanielsson commented 1 year ago

Summary

I tried to create a full clone of a template and set ci_user, ci_password and ci_sshkey but none of the values was set.

Issue Type

Bug Report

Component Name

proxmox_kvm

Ansible Version

$ ansible --version
ansible [core 2.14.1]
  config file = None
  configured module search path = ['/Users/sebastian/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/7.1.0/libexec/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/sebastian/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.11.1 (main, Dec 23 2022, 09:28:24) [Clang 14.0.0 (clang-1400.0.29.202)] (/opt/homebrew/Cellar/ansible/7.1.0/libexec/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
Collection        Version
----------------- -------
community.general 6.1.0

Configuration

$ ansible-config dump --only-changed
CONFIG_FILE() = None

OS / Environment

Target OS: Proxmox 7.3-3

Steps to Reproduce

- name: Clone fedora_template to mediaserver-101
      community.general.proxmox_kvm:
        api_user: "{{ lookup('community.general.onepassword', 'ansible_test', field='username', vault='Private') }}@pam"
        api_password: "{{ lookup('community.general.onepassword', 'ansible_test', field='password', vault='Private') }}"
        api_host: ansible_test
        node: hogsmeade
        clone: fedora_template
        full: true
        vmid: 1000
        newid: 101
        name: ansible-test
        ciuser: "{{ lookup('community.general.onepassword', 'mediaserver', field='username', vault='Private') }}"
        cipassword: "{{ lookup('community.general.onepassword', 'mediaserver', field='password', vault='Private') }}"
        sshkeys: "{{ lookup('community.general.onepassword', 'Sebastian SSH Key', field='public key', vault='Private') }}"
        timeout: 300
        state: present

Expected Results

The clone should be configured with the three cloud-init options.

Actual Results

The VM is created but without the cloud-init options.

Code of Conduct

ansibullbot commented 1 year ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 1 year ago

cc @Ajpantuso @Thulium-Drake @helldorado @joshainglis @karmab @tleguern click here for bot help

sebdanielsson commented 1 year ago

My current workaround is to separate the tasks like this:

- name: Clone fedora_template to mediaserver-101
      community.general.proxmox_kvm:
        api_user: "{{ lookup('community.general.onepassword', 'ansible_test', field='username', vault='Private') }}@pam"
        api_password: "{{ lookup('community.general.onepassword', 'ansible_test', field='password', vault='Private') }}"
        api_host: ansible_test
        node: hogsmeade
        clone: fedora_template
        full: true
        vmid: 1000
        newid: 101
        name: ansible-test
        timeout: 300
        state: present
- name: Update mediaserver-101 with ci-info
      community.general.proxmox_kvm:
        api_user: "{{ lookup('community.general.onepassword', 'ansible_test', field='username', vault='Private') }}@pam"
        api_password: "{{ lookup('community.general.onepassword', 'ansible_test', field='password', vault='Private') }}"
        api_host: ansible_test
        node: hogsmeade
        vmid: 101
        ciuser: "{{ lookup('community.general.onepassword', 'mediaserver', field='username', vault='Private') }}"
        cipassword: "{{ lookup('community.general.onepassword', 'mediaserver', field='password', vault='Private') }}"
        sshkeys: "{{ lookup('community.general.onepassword', 'Sebastian SSH Key', field='public key', vault='Private') }}"
        protection: true
        update: true
        state: present
ansibullbot commented 1 year ago

cc @UnderGreen click here for bot help

UnderGreen commented 1 year ago

@sebdanielsson proxmox_kvm module uses API call from screenshot to clone VM and ci* params are not valid for it.

Screenshot 2023-07-07 at 8 33 13 PM
sebdanielsson commented 1 year ago

That’s unfortunate. Thanks for the answer!☺️

ansibullbot commented 7 months ago

cc @krauthosting click here for bot help