Pass cloud-init without access to proxmox machine

MaciejGravestone

New Member
Sep 24, 2020
2
0
1
28
Hi, I encounter some issue when I tried to find a way, to pass cloud-init to machine with ansible and connect to API.

Actually I using this ansible module:
https://docs.ansible.com/ansible/2.3/proxmox_kvm_module.html


There are my tasks:
Code:
---
  - name: "Clone CentOS"
    proxmox_kvm:
      api_user    : "{{ api_user }}"
      api_password: "{{ api_password }}"
      api_host    : "{{ api_host }}"
      node        : "{{ proxmox_node }}"
      storage     : "{{ proxmox_storage }}"
      clone       : "{{ VM_source_name }}" # Have to be shutted down
      name        : "{{ VM_output_name }}" # Have to be unique, different then others
      format      : "{{ VM_data_format }}"
      timeout     : "{{ timeout_for_clonning_after }}"
      vcpus       : "{{ VM_Vcpu }}"
      cores       : "{{ VM_cores }}"
      memory      : "{{ VM_RAM_memory }}"
    register: Clone_output
    failed_when: >
      (Clone_output.msg == "VM with name <{{ VM_output_name }}> already exists")
    
  - name: "Start Clone"
    proxmox_kvm:
      api_user    : "{{ api_user }}"
      api_password: "{{ api_password }}"
      api_host    : "{{ api_host }}"
      name        : "{{ VM_output_name }}"
      node        : "{{ proxmox_node }}"
      state       : started
    register: Start_output
    until: "not Start_output.failed"
    retries: 3
    delay: 5

I looking how I can execute it from localhost and add cloud-init related stuff, like cloud-init file etc.
My main goal due to automatical dhcp and dns settings are to change template 'hostname' and 'ssh key' as desired by ansible variable before this machine starts.
Any tips how to obtain it guys?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!