Move preseed generation to a separate role
[noc.git] / ansible / roles / vm / install / tasks / main.yml
index 034cf1d..a97230f 100644 (file)
@@ -1,44 +1,4 @@
 ---
-- block:
-    - name: Make a temporary directory
-      command: mktemp -d
-      register: tmpdir
-
-    - set_fact:
-        tmpdir: "{{ tmpdir.stdout }}"
-        initramfs: "{{ vm_host.installer.preseed_path }}/vm-{{ vmname }}-{{ vmdistro }}-{{ vmdistcodename }}.initrd.gz"
-
-    - name: Copy initramfs into position
-      copy:
-        remote_src: yes
-        src: "{{ vm_host.installer.path }}/{{ vmdistro }}-{{ vmdistcodename }}/{{ hostvars[vmname].vm_install_cooked.arch | default('amd64') }}/initrd.gz"
-        dest: "{{ initramfs }}"
-
-    - name: generate preseed file
-      template:
-        src: "preseed_{{ vmdistro }}-{{ vmdistcodename }}.cfg.j2"
-        dest: "{{ tmpdir }}/preseed.cfg"
-
-    - name: generate authorized_keys file
-      authorized_key:
-        user: root
-        path: "{{ tmpdir }}/authorized_keys"
-        key: "{{ hostvars[vmname].ssh_keys | default(noc_ssh_keys) | join('\n') }}"
-
-    - name: Inject files into initramfs
-      shell: cpio -H newc -o | gzip -9 >> {{ initramfs }}
-      args:
-        chdir: "{{ tmpdir }}"
-        stdin: |
-          preseed.cfg
-          authorized_keys
-
-  always:
-    - name: Delete temporary directory
-      file:
-        path: "{{ tmpdir }}"
-        state: absent
-
 - name: create disks for vm
   with_dict: "{{ hostvars[vmname].vm_install_cooked.disks.virtio | default({}) | combine(hostvars[vmname].vm_install_cooked.disks.scsi | default({})) }}"
   lvol: