Compare commits

19 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
29906fc462 no handlers
Some checks reported warnings
Infrastructure / Check and run Ansbile playbooks (pull_request) Has been cancelled
2023-09-10 23:42:26 +01:00
ab54c18b1b handlers
Some checks failed
Infrastructure / Check and run Ansbile playbooks (pull_request) Failing after 1m21s
2023-09-10 23:33:43 +01:00
fce7d91115 debug create
Some checks failed
Infrastructure / Check and run Ansbile playbooks (pull_request) Failing after 6m35s
2023-09-10 23:12:18 +01:00
20bee24b19 facts are bad
Some checks failed
Infrastructure / Check and run Ansbile playbooks (pull_request) Failing after 6m34s
2023-09-09 00:00:30 +01:00
f891d1e6a8 improve stuff
Some checks failed
Infrastructure / Check and run Ansbile playbooks (pull_request) Failing after 1m12s
2023-09-08 23:58:04 +01:00
8406db7eaf change until:
All checks were successful
Infrastructure / Check and run Ansbile playbooks (pull_request) Successful in 3m58s
2023-09-08 23:38:17 +01:00
2d8ad8f453 now less verbosity 2023-09-08 23:34:08 +01:00
3 changed files with 49 additions and 27 deletions

View File

@@ -72,4 +72,4 @@ jobs:
PROXMOX_TOKEN_ID: ${{ secrets.PROXMOX_TOKEN_ID }}
PROXMOX_TOKEN_SECRET: ${{ secrets.PROXMOX_TOKEN_SECRET }}
SSH_PUBLIC: ${{ secrets.SSH_PUBLIC }}
run: ansible-playbook --inventory ./inventory ${{ steps.playbooks.outputs.to_run }} -vvv
run: ansible-playbook --inventory ./inventory ${{ steps.playbooks.outputs.to_run }}

View File

@@ -1,6 +1,7 @@
- name: Provision joplin Proxmox VM
hosts: joplin
connection: ansible.builtin.local
gather_facts: false
vars:
api_user: "{{ lookup('ansible.builtin.env', 'PROXMOX_USER') }}"
api_host: "{{ lookup('ansible.builtin.env', 'PROXMOX_HOST' ) }}"
@@ -30,17 +31,21 @@
api_token_secret: "{{ api_token_secret }}"
name: "{{ vmname }}"
tasks:
# Initial setup
- name: Create VM
community.general.proxmox_kvm:
clone: "{{ node }}-debian-12"
storage: nvme
- name: Wait for VM to exist
register: create
- name: Wait for status
community.general.proxmox_kvm:
state: current
register: vm
retries: 30
delay: 10
until: vm.status is defined
# Networking and initial config
- name: Add HOME NIC
community.general.proxmox_nic:
interface: net0
@@ -51,6 +56,32 @@
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
# 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
community.general.proxmox_disk:
disk: scsi0
@@ -59,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,ip6=auto
agent: enabled=1
tags:
- debian-12
@@ -71,16 +97,8 @@
onboot: true
cores: 2
memory: 2048
- 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

View File

@@ -3,19 +3,23 @@
gather_facts: false
tasks:
- name: Wait for connection
ansible.builtin.wait_for:
host: "{{ inventory_hostname }}"
port: 22
ansible.builtin.wait_for_connection:
timeout: 300
delegate_to: localhost
- name: Test some stuff
ansible.builtin.shell: |
sudo apt update
sudo apt install -y qemu-guest-agent
touch ~/hmm
echo test > ~/test
echo test2 >> ~/test
retries: 10
delay: 6
until: result is not failed
mkdir ~/dir
touch ~/dir/testing
- name: Install some stuff
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