I have managed to connect with API-user and clone virtual machine. With:
tasks:
- name: Clone VM from template
community.general.proxmox_kvm:
api_user: "{{ api_user }}"
api_password: "{{ proxmox_password }}"
api_host: "{{ api_host }}"
clone: AlmaT01 # Source VM name (template)
name: "{{ vm_name }}" # New target VM name
node: "{{ node }}" # Proxmox node
storage: dpve_LDisk01 # Storage backend
format: qcow2 # Disk format
timeout: 500 # Timeout for the operation
register: clone_result
But when it comes to configuring network parameters I can't seem to change them with this approach:
- name: Configure network settings
community.general.proxmox_kvm:
api_user: "{{ api_user }}"
api_password: "{{ proxmox_password }}"
api_host: "{{ api_host }}"
vmid: "{{ new_vmid }}"
node: "{{ node }}"
net:
model: virtio
bridge: vmbr10
ip: "{{ ip_address }}/24"
gw: "{{ gateway }}"
nameservers: "{{ dns_servers }}"
searchdomains: "{{ search_domain }}"
update: yes
https://docs.ansible.com/ansible/latest/collections/community/general/proxmox_kvm_module.html
Am I doing it correctly (syntax-wise), or is there any other approach available for doing it.
The result I get from Ansible is:
TASK [Configure network settings] *****************************************************************************************************************************************************************************
changed: [localhost]
TASK [Verify network configuration via SSH (optional)] ********************************************************************************************************************************************************
fatal: [localhost -> 10.1.12.195]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: connect to host 10.1.12.195 port 22: No route to host", "unreachable": true}
PLAY RECAP ****************************************************************************************************************************************************************************************************
localhost : ok=5 changed=3 unreachable=1 failed=0 skipped=1 rescued=0 ignored=0
So it seems it executes the task, but it does not assign properly IP address. (It uses DHCP).
I have also no clue, how to create so called Cloud-init image nor is in the options to use containers.
tasks:
- name: Clone VM from template
community.general.proxmox_kvm:
api_user: "{{ api_user }}"
api_password: "{{ proxmox_password }}"
api_host: "{{ api_host }}"
clone: AlmaT01 # Source VM name (template)
name: "{{ vm_name }}" # New target VM name
node: "{{ node }}" # Proxmox node
storage: dpve_LDisk01 # Storage backend
format: qcow2 # Disk format
timeout: 500 # Timeout for the operation
register: clone_result
But when it comes to configuring network parameters I can't seem to change them with this approach:
- name: Configure network settings
community.general.proxmox_kvm:
api_user: "{{ api_user }}"
api_password: "{{ proxmox_password }}"
api_host: "{{ api_host }}"
vmid: "{{ new_vmid }}"
node: "{{ node }}"
net:
model: virtio
bridge: vmbr10
ip: "{{ ip_address }}/24"
gw: "{{ gateway }}"
nameservers: "{{ dns_servers }}"
searchdomains: "{{ search_domain }}"
update: yes
https://docs.ansible.com/ansible/latest/collections/community/general/proxmox_kvm_module.html
Am I doing it correctly (syntax-wise), or is there any other approach available for doing it.
The result I get from Ansible is:
TASK [Configure network settings] *****************************************************************************************************************************************************************************
changed: [localhost]
TASK [Verify network configuration via SSH (optional)] ********************************************************************************************************************************************************
fatal: [localhost -> 10.1.12.195]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: connect to host 10.1.12.195 port 22: No route to host", "unreachable": true}
PLAY RECAP ****************************************************************************************************************************************************************************************************
localhost : ok=5 changed=3 unreachable=1 failed=0 skipped=1 rescued=0 ignored=0
So it seems it executes the task, but it does not assign properly IP address. (It uses DHCP).
I have also no clue, how to create so called Cloud-init image nor is in the options to use containers.