]> xn--ix-yja.es Git - alex.git/commitdiff
Enable ssh
authoralex <alex@pdp7.net>
Mon, 9 Jan 2023 20:04:54 +0000 (21:04 +0100)
committeralex <alex@pdp7.net>
Mon, 9 Jan 2023 20:04:54 +0000 (21:04 +0100)
personal_infra/playbooks/proxmox_create_lxc.yml

index 2483cacc8a8149794013c6ec18c0f59e7470cf82..8dd91afdcc90f6de5d9ab4bb860e4a69523f1277 100644 (file)
@@ -10,6 +10,7 @@
     flavors:
       el9:
         template: rockylinux-9-default_20221109
+        pct_ostype: centos
         
   tasks:
     - name: download template
           --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 }}"