FEATURE: Setting Proxmox VM up from cloud-init template added
This commit is contained in:
@@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
- name: Deploy a virtual machine from a cloud init image
|
||||||
|
hosts: localhost
|
||||||
|
gather_facts: false
|
||||||
|
roles:
|
||||||
|
- ../roles/basic_proxmox_vm
|
||||||
|
|
||||||
|
- name: Basic Proxmox guest deployment
|
||||||
|
hosts: all
|
||||||
|
remote_user: ansible
|
||||||
|
roles:
|
||||||
|
- ../roles/basic_postinstall
|
||||||
|
vars_files:
|
||||||
|
../inventory/group_vars/all/secrets.yaml
|
||||||
|
vars:
|
||||||
|
ansible_user_passwd_hash: "{{ ansible_password | password_hash('sha512', 's3edscrj45e6r') }}"
|
||||||
|
user_passwd_hash: "{{ user_password | password_hash('sha512', 's3ed6123jhgcr') }}"
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
- name: restart ssh-server
|
||||||
|
service:
|
||||||
|
name: ssh
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
- name: restart sshd-server
|
||||||
|
service:
|
||||||
|
name: sshd
|
||||||
|
state: restarted
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
---
|
||||||
|
- name: Create a new VM with minimal options
|
||||||
|
become: false
|
||||||
|
community.proxmox.proxmox_kvm:
|
||||||
|
validate_certs: false
|
||||||
|
node: proxmox-server
|
||||||
|
api_user: root@pam
|
||||||
|
api_host: 192.168.0.2
|
||||||
|
api_token_id: ansible
|
||||||
|
api_token_secret: "{{ proxmox_token_secret }}"
|
||||||
|
|
||||||
|
clone: debian-13-cloud-init-template
|
||||||
|
newid: 1041
|
||||||
|
name: ansible-ci-test
|
||||||
|
storage: main
|
||||||
|
format: qcow2
|
||||||
|
full: true
|
||||||
|
timeout: 500
|
||||||
|
|
||||||
|
- name: Tweak the hardware settings
|
||||||
|
become: false
|
||||||
|
community.proxmox.proxmox_kvm:
|
||||||
|
validate_certs: false
|
||||||
|
node: proxmox-server
|
||||||
|
api_user: root@pam
|
||||||
|
api_host: 192.168.0.2
|
||||||
|
api_token_id: ansible
|
||||||
|
api_token_secret: "{{ proxmox_token_secret }}"
|
||||||
|
|
||||||
|
vmid: 1041
|
||||||
|
cores: 4
|
||||||
|
memory: 4096 # Minimal value for debian based OS for smooth workflow
|
||||||
|
update: true
|
||||||
|
|
||||||
|
- name: Make sure the VM has started
|
||||||
|
become: false
|
||||||
|
community.proxmox.proxmox_kvm:
|
||||||
|
validate_certs: false
|
||||||
|
node: proxmox-server
|
||||||
|
api_user: root@pam
|
||||||
|
api_host: 192.168.0.2
|
||||||
|
api_token_id: ansible
|
||||||
|
api_token_secret: "{{ proxmox_token_secret }}"
|
||||||
|
|
||||||
|
vmid: 1041
|
||||||
|
state: started
|
||||||
|
|
||||||
|
- name: Sleep for 3 minutes to ensure that cloud-init's done its thing
|
||||||
|
become: false
|
||||||
|
ansible.builtin.wait_for:
|
||||||
|
timeout: 180
|
||||||
|
delegate_to: localhost
|
||||||
|
changed_when: false
|
||||||
Reference in New Issue
Block a user