From e15d9acbd07c1ecb6e6c6b24f547b60f7d92ebaf Mon Sep 17 00:00:00 2001 From: binary Date: Sun, 8 Nov 2020 20:56:18 +0100 Subject: Add working script for ssh init on alpine vm --- roles/vmm/tasks/boot_alpine.yml | 43 ----------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 roles/vmm/tasks/boot_alpine.yml (limited to 'roles/vmm/tasks/boot_alpine.yml') diff --git a/roles/vmm/tasks/boot_alpine.yml b/roles/vmm/tasks/boot_alpine.yml deleted file mode 100644 index da4e91e..0000000 --- a/roles/vmm/tasks/boot_alpine.yml +++ /dev/null @@ -1,43 +0,0 @@ - -# vmm ~~ tasks/boot_alpine.yml -# Boot an alpine image and init its installation set. -# Required : -# - guest : vm to be be bootup and initialized - ---- - -- name: Check arguments - fail: - msg: "arguments : guest" - when: guest is not defined - -- set_fact: - iso: "{{ hostvars[guest].iso }}" - disk_file : "{{ vmm.disk.dir }}/{{ guest }}.{{ vmm.disk.format }}" - -- include: set_facts.yml - -- name: Start vm - shell: | - vmctl stop dummy - sleep 2 - vmctl start -d {{ iso_latest | quote }} \ - -d {{ disk_file | quote }} \ - -n {{ vmm.config.switch.name | quote }} \ - -m {{ hostvars[guest].memory | quote }} dummy - - sleep 2 - tty=$(vmctl show | grep dummy | tr -s " " " " | cut -d " " -f 7) - sleep 20 - - cat << EOF > /dev/${tty} - echo "mkdir /root/.ssh" - echo "echo $(cat /root/.ssh/authorized_keys) > /root/.ssh/authorized_keys" > /dev/ttyp1 - echo "apk add openssh ; rc-update add sshd ; /etc/init.d/sshd start" /dev/${tty} - EOF - - exit 0 - - args: - executable: /bin/sh - -- cgit v1.2.3