Compare commits
10 Commits
870e4e9476
...
initial-vm
Author | SHA1 | Date | |
---|---|---|---|
72a790c038
|
|||
dfcfe941cf
|
|||
ac3494efc5
|
|||
6b2a820282
|
|||
6dfab582c4
|
|||
41a0c9393e
|
|||
92fbca47db
|
|||
5b0bae4865
|
|||
bc59bd5fdb
|
|||
8b128060e3
|
@@ -45,7 +45,7 @@
|
||||
delay: 10
|
||||
until: vm.status is defined
|
||||
|
||||
# Networking
|
||||
# Networking and initial config
|
||||
- name: Add HOME NIC
|
||||
community.general.proxmox_nic:
|
||||
interface: net0
|
||||
@@ -56,6 +56,14 @@
|
||||
interface: net1
|
||||
firewall: false
|
||||
bridge: SRV
|
||||
- name: Configure cloud-init
|
||||
community.general.proxmox_kvm:
|
||||
update: true
|
||||
ciuser: debian
|
||||
sshkeys: "{{ ssh_public }}"
|
||||
ipconfig:
|
||||
ipconfig0: ip=dhcp,ip6=auto
|
||||
ipconfig1: ip=dhcp
|
||||
|
||||
# Initial boot
|
||||
# For some reason debian cloud images don't use
|
||||
@@ -69,12 +77,9 @@
|
||||
community.general.proxmox_kvm:
|
||||
state: started
|
||||
register: start
|
||||
- name: Wait # Initial apt update, apt upgrade, cloud-init
|
||||
- name: Wait 3 min # Initial apt update, apt upgrade, cloud-init
|
||||
ansible.builtin.wait_for:
|
||||
timeout: 180
|
||||
- name: Poweroff
|
||||
community.general.proxmox_kvm:
|
||||
state: stopped
|
||||
|
||||
# VM Configuration
|
||||
- name: Resize disk
|
||||
@@ -85,11 +90,6 @@
|
||||
- name: Update VM
|
||||
community.general.proxmox_kvm:
|
||||
update: true
|
||||
ciuser: debian
|
||||
sshkeys: "{{ ssh_public }}"
|
||||
ipconfig:
|
||||
ipconfig0: ip=dhcp,ip6=auto
|
||||
ipconfig1: ip=dhcp
|
||||
agent: enabled=1
|
||||
tags:
|
||||
- debian-12
|
||||
@@ -98,18 +98,7 @@
|
||||
cores: 2
|
||||
memory: 2048
|
||||
|
||||
# We have now enabled qemu guest agent, but have not installed it
|
||||
# Rebooting will timeout if started
|
||||
- name: Retart VM # doesn't start if stopped
|
||||
when:
|
||||
- vm.status is defined
|
||||
- vm.status == "running"
|
||||
- name: Retart VM
|
||||
community.general.proxmox_kvm:
|
||||
state: restarted
|
||||
timeout: 60
|
||||
- name: Start VM # start if stopped
|
||||
when:
|
||||
- vm.status is defined
|
||||
- vm.status != "running"
|
||||
community.general.proxmox_kvm:
|
||||
state: started
|
||||
|
@@ -3,16 +3,8 @@
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Wait for connection
|
||||
ansible.builtin.ping:
|
||||
register: wait_conn
|
||||
retries: 30
|
||||
delay: 10
|
||||
until: wait_conn.ping is defined
|
||||
# ansible.builtin.wait_for:
|
||||
# host: "{{ inventory_hostname }}"
|
||||
# port: 22
|
||||
# timeout: 300
|
||||
# delegate_to: localhost
|
||||
ansible.builtin.wait_for_connection:
|
||||
timeout: 300
|
||||
- name: Test some stuff
|
||||
ansible.builtin.shell: |
|
||||
touch ~/hmm
|
||||
@@ -24,8 +16,10 @@
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
name: qemu-guest-agent
|
||||
become: true
|
||||
- name: Enable some stuff
|
||||
ansible.builtin.systemd:
|
||||
name: qemu-guest-agent
|
||||
state: started
|
||||
enabled: true
|
||||
become: true
|
||||
|
Reference in New Issue
Block a user