summaryrefslogtreecommitdiffstats
path: root/ansible/deployment_poc/tasks/configure_dps.yml
blob: 3b56eefea1db0851d6269614e19fa52c1c259a90 (plain)
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
51
52
53
54
55
---
- name: Configure Deployment Server
  block:
  - name: Set DP host OS
    set_fact:
      dp_os: "{{ hostvars[deployment_host]['platforms'][0] }}"

  - name: Prepare Grub host file
    ansible.builtin.template:
      src: ../templates/grub.j2
      dest: "/srv/www/boot/hosts/{{ ip_address }}.cfg"
      group: wheel
      mode: '0444' #consider 0440 if group is changed to one shared by admins and webserver service user
    when: dp_os == 'fedora-x86_64' or dp_os == 'openSUSE-Leap-x86_64'

  - name: Prepare unattended installation
    ansible.builtin.template:
      src: "../templates/autoinst_{{ namespace }}.xml.j2"
      dest: "/srv/www/autoinst_{{ vm_name }}.xml"
      group: wheel
      mode: '0444' #consider 0440 if group is changed to one shared by admins and webserver service user
    when: dp_os == 'fedora-x86_64' or dp_os == 'openSUSE-Leap-x86_64'

  - name: Prepare Grub host file for http
    ansible.builtin.template:
      src: ../templates/grub.j2
      dest: "/var/www/htdocs/www/boot/hosts/{{ ip_address }}.cfg"
      group: wheel
      mode: '0444' #consider 0440 if group is changed to one shared by admins and webserver service user
    when: dp_os == 'openbsd-x86_64'

  - name: Prepare Grub host file for tftp
    ansible.builtin.template:
      src: ../templates/grub.j2
      dest: "/tftpboot/boot/hosts/{{ ip_address }}.cfg"
      group: wheel
      mode: '0444'
    when: dp_os == 'openbsd-x86_64'

  - name: Generate LUKS passphrase #does not quite belong here
    set_fact:
      luks_passphrase: "{{ lookup('password', '/dev/null', length=15, chars=hexdigits, seed=inventory_hostname) }}"
    no_log: true

  - name: Prepare unattended installation
    ansible.builtin.template:
      src: "../templates/autoinst_{{ namespace }}.xml.j2"
      dest: "/var/www/htdocs/www/autoinst_{{ vm_name }}.xml"
      group: wheel
      mode: '0444' #consider 0440 if group is changed to one shared by admins and webserver service user
    when: dp_os == 'openbsd-x86_64'

  delegate_to: "{{ deployment_host }}"
  tags:
    - init_dp