diff --git a/.github/workflows/packer.yaml b/.github/workflows/packer.yaml index fe3f31b..2a1a6cc 100644 --- a/.github/workflows/packer.yaml +++ b/.github/workflows/packer.yaml @@ -114,7 +114,7 @@ jobs: - name: prepare ansible config run: docker compose exec -T bambictf sh -c 'cp ansible/config_bambi.yml.sample ansible/config_bambi.yml' - name: build packer image - run: docker compose exec -T bambictf sh -c 'cd packer; packer build ${{ matrix.image }}.json' + run: docker compose exec -T bambictf sh -c 'cd packer; packer init ${{ matrix.image }}.pkr.hcl; packer build ${{ matrix.image }}.pkr.hcl' terraform-apply: runs-on: ubuntu-latest diff --git a/packer/bambichecker.pkr.hcl b/packer/bambichecker.pkr.hcl new file mode 100644 index 0000000..2df47bd --- /dev/null +++ b/packer/bambichecker.pkr.hcl @@ -0,0 +1,43 @@ +packer { + required_plugins { + hcloud = { + version = ">= 1.0.0" + source = "github.com/hetznercloud/hcloud" + } + } +} + +locals { + snapshot_timestamp = timestamp() +} + +source "hcloud" "bambichecker" { + image = "ubuntu-24.04" + location = "fsn1" + server_type = "cx22" + ssh_username = "root" + snapshot_name = "bambichecker-${local.snapshot_timestamp}" + snapshot_labels = { + type = "bambichecker" + } + temporary_key_pair_type = "ecdsa" +} + +build { + name = "bambichecker" + + sources = [ + "source.hcloud.bambichecker" + ] + + provisioner "ansible" { + playbook_file = "../ansible/bambichecker.yml" + host_alias = "packer-checker" + ansible_env_vars = [ + "ANSIBLE_PIPELINING=True" + ] + extra_arguments = [ + "--scp-extra-args", "'-O'" + ] + } +} \ No newline at end of file diff --git a/packer/bambielk.pkr.hcl b/packer/bambielk.pkr.hcl new file mode 100644 index 0000000..1d32f62 --- /dev/null +++ b/packer/bambielk.pkr.hcl @@ -0,0 +1,43 @@ +packer { + required_plugins { + hcloud = { + version = ">= 1.0.0" + source = "github.com/hetznercloud/hcloud" + } + } +} + +locals { + snapshot_timestamp = timestamp() +} + +source "hcloud" "bambielk" { + image = "ubuntu-24.04" + location = "fsn1" + server_type = "cx22" + ssh_username = "root" + snapshot_name = "bambielk-${local.snapshot_timestamp}" + snapshot_labels = { + type = "bambielk" + } + temporary_key_pair_type = "ecdsa" +} + +build { + name = "bambielk" + + sources = [ + "source.hcloud.bambielk" + ] + + provisioner "ansible" { + playbook_file = "../ansible/bambielk.yml" + host_alias = "packer-elk" + ansible_env_vars = [ + "ANSIBLE_PIPELINING=True" + ] + extra_arguments = [ + "--scp-extra-args", "'-O'" + ] + } +} \ No newline at end of file diff --git a/packer/bambiengine.pkr.hcl b/packer/bambiengine.pkr.hcl new file mode 100644 index 0000000..cd3e088 --- /dev/null +++ b/packer/bambiengine.pkr.hcl @@ -0,0 +1,43 @@ +packer { + required_plugins { + hcloud = { + version = ">= 1.0.0" + source = "github.com/hetznercloud/hcloud" + } + } +} + +locals { + snapshot_timestamp = timestamp() +} + +source "hcloud" "bambiengine" { + image = "ubuntu-24.04" + location = "fsn1" + server_type = "cx22" + ssh_username = "root" + snapshot_name = "bambiengine-${local.snapshot_timestamp}" + snapshot_labels = { + type = "bambiengine" + } + temporary_key_pair_type = "ecdsa" +} + +build { + name = "bambiengine" + + sources = [ + "source.hcloud.bambiengine" + ] + + provisioner "ansible" { + playbook_file = "../ansible/bambiengine.yml" + host_alias = "packer-engine" + ansible_env_vars = [ + "ANSIBLE_PIPELINING=True" + ] + extra_arguments = [ + "--scp-extra-args", "'-O'" + ] + } +} \ No newline at end of file diff --git a/packer/bambirouter.pkr.hcl b/packer/bambirouter.pkr.hcl new file mode 100644 index 0000000..b570389 --- /dev/null +++ b/packer/bambirouter.pkr.hcl @@ -0,0 +1,43 @@ +packer { + required_plugins { + hcloud = { + version = ">= 1.0.0" + source = "github.com/hetznercloud/hcloud" + } + } +} + +locals { + snapshot_timestamp = timestamp() +} + +source "hcloud" "bambirouter" { + image = "ubuntu-24.04" + location = "fsn1" + server_type = "cx22" + ssh_username = "root" + snapshot_name = "bambirouter-${local.snapshot_timestamp}" + snapshot_labels = { + type = "bambirouter" + } + temporary_key_pair_type = "ecdsa" +} + +build { + name = "bambirouter" + + sources = [ + "source.hcloud.bambirouter" + ] + + provisioner "ansible" { + playbook_file = "../ansible/bambirouter.yml" + host_alias = "packer-router" + ansible_env_vars = [ + "ANSIBLE_PIPELINING=True" + ] + extra_arguments = [ + "--scp-extra-args", "'-O'" + ] + } +} \ No newline at end of file diff --git a/packer/bambivulnbox.pkr.hcl b/packer/bambivulnbox.pkr.hcl new file mode 100644 index 0000000..f248da4 --- /dev/null +++ b/packer/bambivulnbox.pkr.hcl @@ -0,0 +1,43 @@ +packer { + required_plugins { + hcloud = { + version = ">= 1.0.0" + source = "github.com/hetznercloud/hcloud" + } + } +} + +locals { + snapshot_timestamp = timestamp() +} + +source "hcloud" "bambivulnbox" { + image = "ubuntu-24.04" + location = "fsn1" + server_type = "cx32" + ssh_username = "root" + snapshot_name = "bambivulnbox-${local.snapshot_timestamp}" + snapshot_labels = { + type = "bambivulnbox" + } + temporary_key_pair_type = "ecdsa" +} + +build { + name = "bambivulnbox" + + sources = [ + "source.hcloud.bambivulnbox" + ] + + provisioner "ansible" { + playbook_file = "../ansible/bambivulnbox.yml" + host_alias = "packer-vulnbox" + extra_arguments = [ + "--scp-extra-args", "'-O'" + ] + ansible_env_vars = [ + "ANSIBLE_PIPELINING=True" + ] + } +} \ No newline at end of file