-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from clincha-org/11-packer-kickstart-delivery
11 packer kickstart delivery
- Loading branch information
Showing
10 changed files
with
78 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,88 @@ | ||
name: packer-build | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-templates: | ||
runs-on: self-hosted | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 1 | ||
matrix: | ||
node: [ bri-s-01, bri-s-02, bri-s-03 ] | ||
node: | ||
- "bri-s-01" | ||
- "bri-s-02" | ||
- "bri-s-03" | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
uses: actions/[email protected] | ||
|
||
- name: "Install WireGuard" | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y wireguard | ||
# https://superuser.com/questions/1500691/usr-bin-wg-quick-line-31-resolvconf-command-not-found-wireguard-debian | ||
ln -s /usr/bin/resolvectl /usr/local/bin/resolvconf | ||
- name: "Create WireGuard config" | ||
run: | | ||
sudo mkdir -p /etc/wireguard | ||
sudo chmod 700 /etc/wireguard | ||
sudo touch /etc/wireguard/wg0.conf | ||
sudo chmod 600 /etc/wireguard/wg0.conf | ||
sudo bash -c "cat > /etc/wireguard/wg0.conf" << EOF | ||
[Interface] | ||
PrivateKey = ${{ secrets.HL_PKR_PRIVATE_KEY }} | ||
Address = 10.1.5.3/32 | ||
DNS = 10.1.5.1 | ||
[Peer] | ||
PublicKey = 6/tGUsqU3ib5LEEua2cLCUxSDFpiEFhOT0sGkqz0LHk= | ||
PresharedKey = ${{ secrets.HL_PKR_PRESHARED_KEY }} | ||
AllowedIPs = 10.1.5.1/32,10.1.5.2/32,192.168.1.11/24,10.1.1.1/24,10.1.2.1/24,10.1.3.1/24,0.0.0.0/0 | ||
Endpoint = ${{ secrets.HL_ENDPOINT }} | ||
EOF | ||
- name: "Start WireGuard" | ||
run: | | ||
sudo wg-quick up wg0 | ||
sudo wg | ||
ping 192.168.1.11 -c 3 | ||
- name: Install Packer | ||
run: | | ||
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - | ||
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | ||
sudo apt-get update && sudo apt-get install -y packer | ||
- name: Create SSH key | ||
run: 'echo "$ANSIBLE_PK" > id_rsa && chmod 600 id_rsa' | ||
shell: bash | ||
env: | ||
ANSIBLE_PK: ${{ secrets.ANSIBLE_PK }} | ||
|
||
- name: Disable the firewall | ||
run: | | ||
sudo ufw status | ||
sudo ufw disable | ||
sudo ufw status | ||
- name: packer init | ||
working-directory: packer | ||
run: | | ||
/usr/bin/packer init . | ||
- name: packer build | ||
working-directory: packer | ||
run: | | ||
/usr/bin/packer build --force \ | ||
packer build --force \ | ||
-var "ansible_ssh_password=${{ secrets.ANSIBLE_PASSWORD }}" \ | ||
-var "proxmox_api_token_secret=${{ secrets.PACKER_BRISTOL_PROXMOX_TOKEN_SECRET }}" \ | ||
-var-file="nodes/${{ matrix.node }}.pkrvars.hcl" \ | ||
. | ||
- name: "Stop WireGuard" | ||
if: always() | ||
run: | | ||
sudo wg-quick down wg0 | ||
sudo rm -rf /etc/wireguard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM docker.io/clincha/terraform-provider-proxmox:1.0.16 | ||
|
||
COPY . . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters