aboutsummaryrefslogtreecommitdiff
path: root/personal_infra/playbooks/proxmox_create_lxc.yml
diff options
context:
space:
mode:
Diffstat (limited to 'personal_infra/playbooks/proxmox_create_lxc.yml')
-rw-r--r--personal_infra/playbooks/proxmox_create_lxc.yml56
1 files changed, 0 insertions, 56 deletions
diff --git a/personal_infra/playbooks/proxmox_create_lxc.yml b/personal_infra/playbooks/proxmox_create_lxc.yml
deleted file mode 100644
index c904fa8d..00000000
--- a/personal_infra/playbooks/proxmox_create_lxc.yml
+++ /dev/null
@@ -1,56 +0,0 @@
----
-- name: create lxc
- hosts: lxc
- gather_facts: false
- collections:
- - ansible.builtin
- - community.general
-
- vars:
- flavors:
- el8:
- template: rockylinux-8-default_20210929
- pct_ostype: centos
- el9:
- template: rockylinux-9-default_20221109
- pct_ostype: centos
-
- tasks:
- - name: download template
- command: "pveam download local {{ flavors[proxmox.flavor].template }}_amd64.tar.xz"
- args:
- creates: "/var/lib/vz/template/cache/{{ flavors[proxmox.flavor].template }}_amd64.tar.xz"
- delegate_to: "{{ proxmox.host }}"
- - name: create host
- command: >
- pct create {{ proxmox.id }} "/var/lib/vz/template/cache/{{ flavors[proxmox.flavor].template }}_amd64.tar.xz"
- --hostname {{ inventory_hostname }}
- --storage local-zfs
- -net0 name=eth0,bridge=vmbr0,ip=dhcp
- -onboot 1
- --unprivileged
- --password {{ ansible_password }}
- --nameserver {{ hostvars[proxmox.host].network.self_internal_ip }}
- --ostype {{ flavors[proxmox.flavor].pct_ostype }}
- args:
- creates: "/etc/pve/lxc/{{ proxmox.id }}.conf"
- delegate_to: "{{ proxmox.host }}"
- # https://bugzilla.proxmox.com/show_bug.cgi?id=4460
- - name: set hostname
- copy:
- content: "{{ inventory_hostname }}"
- dest: /rpool/data/subvol-{{ proxmox.id }}-disk-0/etc/hostname
- delegate_to: "{{ proxmox.host }}"
- - name: start host
- command: pct start {{ proxmox.id }}
- delegate_to: "{{ proxmox.host }}"
- - name: install ssh
- command: pct exec {{ proxmox.id }} -- dnf install -y openssh-server
- retries: 10
- delay: 1
- until: result.rc == 0
- register: result
- delegate_to: "{{ proxmox.host }}"
- - name: enable ssh
- command: pct exec {{ proxmox.id }} -- systemctl enable --now sshd
- delegate_to: "{{ proxmox.host }}"