Joplin proxmox configs
Some checks failed
Infrastructure / Check and run Ansbile playbooks (pull_request) Failing after 1m31s
Some checks failed
Infrastructure / Check and run Ansbile playbooks (pull_request) Failing after 1m31s
This commit is contained in:
83
infra/joplin/0000_proxmox_playbook.yaml
Normal file
83
infra/joplin/0000_proxmox_playbook.yaml
Normal file
@@ -0,0 +1,83 @@
|
||||
- name: Provision joplin Proxmox VM
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
vars:
|
||||
api_user: "{{ lookup('env', 'PROXMOX_USER') }}"
|
||||
api_host: "{{ lookup('env', 'PROXMOX_HOST' ) }}"
|
||||
api_token_id: "{{ lookup('env', 'PROXMOX_TOKEN_ID') }}"
|
||||
api_token_secret: "{{ lookup('env', 'PROXMOX_TOKEN_SECRET') }}"
|
||||
vmname: joplin
|
||||
node: pve
|
||||
module_defaults:
|
||||
community.general.proxmox_kvm:
|
||||
api_user: "{{ api_user }}"
|
||||
api_host: "{{ api_host }}"
|
||||
api_token_id: "{{ api_token_id }}"
|
||||
api_token_secret: "{{ api_token_secret }}"
|
||||
name: "{{ vmname }}"
|
||||
node: "{{ node }}"
|
||||
community.general.proxmox_nic:
|
||||
api_user: "{{ api_user }}"
|
||||
api_host: "{{ api_host }}"
|
||||
api_token_id: "{{ api_token_id }}"
|
||||
api_token_secret: "{{ api_token_secret }}"
|
||||
name: "{{ vmname }}"
|
||||
community.general.proxmox_disk:
|
||||
api_user: "{{ api_user }}"
|
||||
api_host: "{{ api_host }}"
|
||||
api_token_id: "{{ api_token_id }}"
|
||||
api_token_secret: "{{ api_token_secret }}"
|
||||
name: "{{ vmname }}"
|
||||
tasks:
|
||||
- name: Create VM
|
||||
community.general.proxmox_kvm:
|
||||
clone: pve-debian-12
|
||||
storage: nvme
|
||||
- name: Wait for VM to exist
|
||||
community.general.proxmox_kvm:
|
||||
state: current
|
||||
register: vm
|
||||
retries: 30
|
||||
delay: 10
|
||||
- name: Add HOME NIC
|
||||
community.general.proxmox_nic:
|
||||
interface: net0
|
||||
firewall: false
|
||||
bridge: HOME
|
||||
- name: Add SRV NIC
|
||||
community.general.proxmox_nic:
|
||||
interface: net1
|
||||
firewall: false
|
||||
bridge: SRV
|
||||
- name: Resize disk
|
||||
community.general.proxmox_disk:
|
||||
disk: scsi0
|
||||
size: 64G
|
||||
state: resized
|
||||
- name: Update VM
|
||||
community.general.proxmox_kvm:
|
||||
update: true
|
||||
ciuser: debian
|
||||
sshkeys: "{{ lookup('env', 'SSH_PUBLIC') }}"
|
||||
ipconfig:
|
||||
ipconfig0: ip=dhcp,ip6=auto
|
||||
agent: enabled=1
|
||||
tags:
|
||||
- debian-12
|
||||
- managed
|
||||
onboot: true
|
||||
cores: 2
|
||||
memory: 2048
|
||||
- name: Retart VM # doesn't start if stopped
|
||||
when:
|
||||
- vm.status is defined
|
||||
- vm.status == "running"
|
||||
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
|
Reference in New Issue
Block a user