diff --git a/salt/pillars/harvester_cluster.sls b/salt/pillars/harvester_cluster.sls new file mode 100644 index 0000000..4bae517 --- /dev/null +++ b/salt/pillars/harvester_cluster.sls @@ -0,0 +1,9 @@ +harvester: + dns_host: harvester + token: ThisShouldBeConfiguredInYourlocal.sls + os: + ssh_authorized_keys: [] + password: rancher + install: + mgmt-interface: ensp2s0f0 + diff --git a/salt/pillars/top.sls b/salt/pillars/top.sls index 86646ad..362ae4e 100644 --- a/salt/pillars/top.sls +++ b/salt/pillars/top.sls @@ -10,6 +10,7 @@ base: - wireguard - hostapd - pxe + - harvester_cluster {% if salt['pillar.file_exists']('local.sls') %} - local {% endif %} diff --git a/salt/states/firewalld/init.sls b/salt/states/firewalld/init.sls index d3b0ca5..0ca465f 100644 --- a/salt/states/firewalld/init.sls +++ b/salt/states/firewalld/init.sls @@ -29,6 +29,7 @@ Configure firewalld for internal network: - {{ pillar['network']['interface']['internal'] }} - {{ pillar['wireguard']['iface'] }} - {{ pillar['network']['interface']['wireless'] }} + - {{ pillar['network']['interface']['bridge'] }} - sources: - {{ pillar['network']['netaddress'] }}/{{ pillar['network']['netmask'] }} - services: diff --git a/salt/states/hostname/files/hosts.jinja b/salt/states/hostname/files/hosts.jinja index 546daa3..ef2f8be 100644 --- a/salt/states/hostname/files/hosts.jinja +++ b/salt/states/hostname/files/hosts.jinja @@ -27,3 +27,4 @@ ff02::3 ipv6-allhosts {% for svc in ['rmt', 'www'] -%} {{ ip }} {{ svc }}.{{ domain }} {{ svc }} {% endfor %} +{{ pillar['network']['ip'][0:-1] }}20 harvester.{{ domain }} harvester diff --git a/salt/states/pxe/harvester/files/harvester.cfg.jinja b/salt/states/pxe/harvester/files/harvester.cfg.jinja index 191164c..3a3149f 100644 --- a/salt/states/pxe/harvester/files/harvester.cfg.jinja +++ b/salt/states/pxe/harvester/files/harvester.cfg.jinja @@ -1,7 +1,15 @@ +{% set cluster_version = 0.3.0 -%} ## Menu Colours set menu_color_normal=white/black set menu_color_highlight=white/green +menuentry 'TLU Harvester {{ cluster_version }} Server-1 --class os { + linux harvester-v{{ cluster_version }}-vmlinuz-amd64 nomodeset initrd=harvester-v{{ cluster_version }}-initrd-amd64 ip=dhcp net.ifnames=1 rd.cos.disable rd.noverifyssl console=tty1 root=live:http://{{ pillar['network']['ip'] }}/harvester/harvester-v{{ cluster_version }}-rootfs-amd64.squashfs iso_url=http://{{ pillar['network']['ip'] }}/harvester/harvester-v{{ cluster_version }}-amd64.iso harvester.install.automatic=true harvester.install.config_url=http://{{ pillar['network']['ip'] }}/harvester/tlu-cluster-create.yaml + initrd harvester-v{{ cluster_version }}-initrd-amd64 + boot +} + + {% for item in pillar['pxe']['harvester'] -%} menuentry 'Harvester {{ item['version'] }}' --class os { linux harvester-v{{ item['version'] }}-vmlinuz-amd64 nomodeset initrd=harvester-v{{ item['version'] }}-initrd-amd64 ip=dhcp net.ifnames=1 rd.cos.disable rd.noverifyssl console=tty1 root=live:http://{{ pillar['network']['ip'] }}/harvester/harvester-v{{ item['version'] }}-rootfs-amd64.squashfs iso_url=http://{{ pillar['network']['ip'] }}/harvester/harvester-v{{ item['version'] }}-amd64.iso diff --git a/salt/states/pxe/harvester/files/tlu-cluster-create.yaml.jinja b/salt/states/pxe/harvester/files/tlu-cluster-create.yaml.jinja new file mode 100644 index 0000000..f0e03fe --- /dev/null +++ b/salt/states/pxe/harvester/files/tlu-cluster-create.yaml.jinja @@ -0,0 +1,21 @@ +server_url: https://{{pillar['harvester']['dns_host'] }}.{{ pillar['network']['domain']}}:8443 +token: {{ pillar['harvester']['token'] }} +os: + ssh_authorized_keys: {{ pillar['harvester']['os']['ssh_authorized_keys'] }} + nostname: node1 + dns_nameservers: + - {{ pillar['network']['ip'] }} + password: {{ pillar['harvester']['os']['password'] }} +intall: + mode: create + networks: + harvester-mgmt: + interfaces: + - name: ensp2s0f0 + default_route: true + method: static + ip: {{ pillar['network']['ip][0:-1] }}21 + subnet_mask: 255.255.255.0 + gateway: {{ pillar['network']['ip'] }} + + device: /dev/nvme0n1