Compare commits

12 Commits

Author SHA1 Message Date
72a790c038 don't suffocate the vm
All checks were successful
Infrastructure / Check and run Ansbile playbooks (pull_request) Successful in 6m34s
2023-09-11 01:40:29 +01:00
dfcfe941cf actually fix order of things
Some checks failed
Infrastructure / Check and run Ansbile playbooks (pull_request) Failing after 11m8s
2023-09-11 01:27:02 +01:00
ac3494efc5 fix order of tasks
Some checks failed
Infrastructure / Check and run Ansbile playbooks (pull_request) Failing after 5m55s
2023-09-11 01:19:31 +01:00
6b2a820282 increase apt timeout
Some checks failed
Infrastructure / Check and run Ansbile playbooks (pull_request) Failing after 7m58s
2023-09-11 01:05:55 +01:00
6dfab582c4 wait for 3 min afterall
Some checks failed
Infrastructure / Check and run Ansbile playbooks (pull_request) Failing after 7m28s
2023-09-11 00:49:27 +01:00
41a0c9393e escalate to root for 0001
Some checks failed
Infrastructure / Check and run Ansbile playbooks (pull_request) Failing after 4m38s
2023-09-11 00:43:36 +01:00
92fbca47db fix wait for conn
Some checks failed
Infrastructure / Check and run Ansbile playbooks (pull_request) Failing after 7m22s
2023-09-11 00:34:59 +01:00
5b0bae4865 maybe fix wait for conn
Some checks failed
Infrastructure / Check and run Ansbile playbooks (pull_request) Failing after 6m10s
2023-09-11 00:23:37 +01:00
bc59bd5fdb wut
Some checks failed
Infrastructure / Check and run Ansbile playbooks (pull_request) Failing after 6m23s
2023-09-11 00:16:16 +01:00
8b128060e3 improve playbooks
Some checks failed
Infrastructure / Check and run Ansbile playbooks (pull_request) Failing after 5m32s
2023-09-11 00:07:56 +01:00
870e4e9476 improve 0001
Some checks failed
Infrastructure / Check and run Ansbile playbooks (pull_request) Failing after 6m15s
2023-09-10 23:57:43 +01:00
763958634e fix proxmox playbook 2023-09-10 23:54:34 +01:00
2 changed files with 41 additions and 42 deletions

View File

@@ -31,30 +31,21 @@
api_token_secret: "{{ api_token_secret }}" api_token_secret: "{{ api_token_secret }}"
name: "{{ vmname }}" name: "{{ vmname }}"
tasks: tasks:
# Initial setup
- name: Create VM - name: Create VM
community.general.proxmox_kvm: community.general.proxmox_kvm:
clone: "{{ node }}-debian-12" clone: "{{ node }}-debian-12"
storage: nvme storage: nvme
register: create register: create
- name: Initial boot - name: Wait for status
when: create.changed is true community.general.proxmox_kvm:
block: state: current
- name: Start register: vm
community.general.proxmox_kvm: retries: 30
state: started delay: 10
register: start until: vm.status is defined
retries: 30
delay: 10 # Networking and initial config
until: start.status is defined
- name: Wait
ansible.builtin.wait_for:
timeout: 180
- name: Poweroff
community.general.proxmox_kvm:
state: stopped
- name: Debug
ansible.builtin.debug:
var: create
- name: Add HOME NIC - name: Add HOME NIC
community.general.proxmox_nic: community.general.proxmox_nic:
interface: net0 interface: net0
@@ -65,6 +56,32 @@
interface: net1 interface: net1
firewall: false firewall: false
bridge: SRV 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
# cloud-init for networking on first boot (cloud-init files
# are regenerated AFTER networking starts). But we need the
# hostname to be registered with DHCP later on so ¯\_(ツ)_/¯
- name: Initial boot
when: create.changed is true
block:
- name: Start
community.general.proxmox_kvm:
state: started
register: start
- name: Wait 3 min # Initial apt update, apt upgrade, cloud-init
ansible.builtin.wait_for:
timeout: 180
# VM Configuration
- name: Resize disk - name: Resize disk
community.general.proxmox_disk: community.general.proxmox_disk:
disk: scsi0 disk: scsi0
@@ -73,11 +90,6 @@
- name: Update VM - name: Update VM
community.general.proxmox_kvm: community.general.proxmox_kvm:
update: true update: true
ciuser: debian
sshkeys: "{{ ssh_public }}"
ipconfig:
ipconfig0: ip=dhcp,ip6=auto
ipconfig1: ip=dhcp
agent: enabled=1 agent: enabled=1
tags: tags:
- debian-12 - debian-12
@@ -85,16 +97,8 @@
onboot: true onboot: true
cores: 2 cores: 2
memory: 2048 memory: 2048
- name: Retart VM # doesn't start if stopped
when: - name: Retart VM
- create.status is defined
- create.status == "running"
community.general.proxmox_kvm: community.general.proxmox_kvm:
state: restarted state: restarted
timeout: 60 timeout: 60
- name: Start VM # start if stopped
when:
- create.status is defined
- create.status != "running"
community.general.proxmox_kvm:
state: started

View File

@@ -3,11 +3,8 @@
gather_facts: false gather_facts: false
tasks: tasks:
- name: Wait for connection - name: Wait for connection
ansible.builtin.wait_for: ansible.builtin.wait_for_connection:
host: "{{ inventory_hostname }}"
port: 22
timeout: 300 timeout: 300
delegate_to: localhost
- name: Test some stuff - name: Test some stuff
ansible.builtin.shell: | ansible.builtin.shell: |
touch ~/hmm touch ~/hmm
@@ -15,16 +12,14 @@
echo test2 >> ~/test echo test2 >> ~/test
mkdir ~/dir mkdir ~/dir
touch ~/dir/testing touch ~/dir/testing
register: stuff
retries: 10
delay: 6
until: stuff.rc == 0
- name: Install some stuff - name: Install some stuff
ansible.builtin.apt: ansible.builtin.apt:
update_cache: true update_cache: true
name: qemu-guest-agent name: qemu-guest-agent
become: true
- name: Enable some stuff - name: Enable some stuff
ansible.builtin.systemd: ansible.builtin.systemd:
name: qemu-guest-agent name: qemu-guest-agent
state: started state: started
enabled: true enabled: true
become: true