init.sls 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #
  2. # Pressed
  3. #
  4. /srv/provision:
  5. file.directory
  6. # Debian presseds
  7. /srv/provision/preseed:
  8. file.directory:
  9. - require:
  10. - file: /srv/provision
  11. {% for osrelease in ['bullseye', 'bookworm'] %}
  12. /srv/provision/preseed/apu-{{ osrelease }}.txt:
  13. file.managed:
  14. - source: salt://install-server/preseed/apu-{{ osrelease }}.txt
  15. - template: jinja
  16. - context:
  17. provision_fqdn: {{ salt['pillar.get']('globals:provision:webserver_fqdn') }}
  18. - require:
  19. - file: /srv/provision/preseed
  20. {% endfor %}
  21. # Conveniece symlink for short http URL
  22. /srv/provision/apu.txt:
  23. file.symlink:
  24. - target: /srv/provision/preseed/apu-bullseye.txt
  25. - require:
  26. - file: /srv/provision/preseed/apu-bullseye.txt
  27. # Late command downloaded into and run from preseed
  28. /srv/provision/late-command.sh:
  29. file.managed:
  30. - source: salt://install-server/late-command.sh.tmpl
  31. - template: jinja
  32. - context:
  33. nacl_url: {{ salt['pillar.get']('globals:nacl:url') }}
  34. salt_master_fqdn: {{ salt['pillar.get']("globals:salt:master") }}
  35. - require:
  36. - file: /srv/provision
  37. # First boot script + service
  38. /srv/provision/ffho-first-boot.sh:
  39. file.managed:
  40. - source: salt://install-server/ffho-first-boot.sh
  41. - require:
  42. - file: /srv/provision
  43. /srv/provision/ffho-first-boot.service:
  44. file.managed:
  45. - source: salt://install-server/ffho-first-boot.service
  46. - require:
  47. - file: /srv/provision
  48. # Local copy of NACL CLI tools
  49. Create /srv/provision/nacl:
  50. file.directory:
  51. - name: /srv/provision/nacl
  52. - require:
  53. - file: /srv/provision
  54. {% for file_name in ['get_fqdn', 'register_ssh_keys'] %}
  55. /srv/provision/nacl/{{ file_name }}:
  56. file.managed:
  57. - source: salt://install-server/nacl/{{ file_name }}
  58. - require:
  59. - file: Create /srv/provision/nacl
  60. - require_in:
  61. - file: Clean /srv/provision/nacl
  62. {% endfor %}
  63. Clean /srv/provision/nacl:
  64. file.directory:
  65. - name: /srv/provision/nacl
  66. - clean: true