summaryrefslogtreecommitdiff
path: root/roles/installer/debian/preseed/tasks/main.yml
blob: e3ea660f9453b3a014038773ad7e5b5f9720836c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
- name: Generate preseed file
  template:
    src: "preseed_{{ debian_preseed_template_name | default(install_distro + '-' + install_codename) }}.cfg.j2"
    dest: "{{ debian_preseed_tmpdir }}/preseed.cfg"

- name: Generate partmam early-command script
  when: not debian_preseed_manual_partitioning
  template:
    src: "partman_early-command.sh.j2"
    dest: "{{ debian_preseed_tmpdir }}/partman_early-command.sh"
    mode: 0755

- name: Generate authorized_keys file
  authorized_key:
    user: root
    manage_dir: no
    path: "{{ debian_preseed_tmpdir }}/authorized_keys"
    key: "{{ ssh_keys_root | join('\n') }}"

- name: force net interface name policy
  when: debian_preseed_force_net_ifnames_policy is defined
  block:
  - name: prepare directories to force network interface name policy
    file:
      path: "{{ debian_preseed_tmpdir }}/etc/systemd/network"
      state: directory

  - name: install link unit to force network interface name policy
    copy:
      dest: "{{ debian_preseed_tmpdir }}/etc/systemd/network/90-namepolicy.link"
      content: |
        [Match]
        OriginalName=*

        [Link]
        NamePolicy={{ debian_preseed_force_net_ifnames_policy }}

- name: Inject files into initramfs
  shell: cpio -H newc -o | gzip -9 >> '{{ debian_preseed_initrd }}'
  args:
    chdir: "{{ debian_preseed_tmpdir }}"
    stdin: |
      preseed.cfg
      partman_early-command.sh
      authorized_keys
      etc/
      etc/systemd/
      etc/systemd/network/
      etc/systemd/network/90-namepolicy.link