Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
var/
output/
salt/states/files/SHA256SUMS
salt/states/files/*.iso
salt/states/hooks/*
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ The following packages need to be installed for running it on Ubuntu:
- `genisoimage`

## Usage
After cloning this repository, change to the root directory of it (the same as the one containing this README) and execute:
After cloning this repository either copy the contents of ``hooks-samples`` to ``hooks`` (necessary because of https://github.com/saltstack/salt/issues/6237) and customize it to your liking or checkout the custom states that should be applied to your image from a different repo into ``hooks``.

Finally change to the root directory of it (the same as the one containing this README) and execute:
```bash
salt-call state.sls build
sudo salt-call state.sls build
```
The resulting ISO file will be located in `output/`

Expand Down
12 changes: 9 additions & 3 deletions salt/states/build.sls
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{%- set ubuntu_release = '20.04' %}
{%- set ubuntu_arch = 'amd64' %}
{%- set ubuntu_release = salt['pillar.get']('release', '20.04.2') %}
{%- set ubuntu_arch = salt['pillar.get']('arch', 'amd64') %}
{%- set iso_name_base = 'ubuntu-' ~ ubuntu_release ~ '-live-server-' ~ ubuntu_arch %}
{%- set iso_name = iso_name_base ~ '.iso' %}
{%- set iso_url = 'https://releases.ubuntu.com/' ~ ubuntu_release ~ '/' ~ iso_name %}
Expand Down Expand Up @@ -63,6 +63,12 @@ extract-iso:
- cache-iso
- symlink-iso

create-iso-custom-dir:
file.directory:
- name: {{ extraction_dir }}/custom
- require:
- extract-iso

extracted-iso-permissions:
file.directory:
- name: {{ extraction_dir }}
Expand All @@ -72,7 +78,7 @@ extracted-iso-permissions:
- dir_mode: 0770
- file_mode: 0660
- require:
- extract-iso
- create-iso-custom-dir

install-genisoimage:
pkg.installed:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
# for a zero-touch bootstrapping of a new system which is immediately under
# control of a SaltStack infrastructure

{%- if ubuntu_release.startswith('20.04') is sameas true %}
{%- set short_ubuntu_release = '20.04' %}
{%- endif %}

saltstack-apt-repo-gpg-key:
file.managed:
- name: {{ salt['file.join'](extraction_dir, 'SALTSTACK-GPG-KEY.pub') }}
- source: https://repo.saltstack.com/py3/ubuntu/{{ ubuntu_release }}/{{ ubuntu_arch }}/latest/SALTSTACK-GPG-KEY.pub
- source: https://repo.saltproject.io/py3/ubuntu/{{ short_ubuntu_release }}/{{ ubuntu_arch }}/latest/SALTSTACK-GPG-KEY.pub
- skip_verify: true
- require:
- extract-iso
Expand Down
2 changes: 1 addition & 1 deletion salt/states/hooks.sls
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include:
- hooks.*
- hooks.*.*