Working Template - tested with music
This commit is contained in:
@@ -52,37 +52,38 @@ jobs:
|
|||||||
run: terraform apply -auto-approve
|
run: terraform apply -auto-approve
|
||||||
working-directory: "terraform"
|
working-directory: "terraform"
|
||||||
|
|
||||||
- name: Install Ansible
|
#### Needs review / determine if worth keeping
|
||||||
shell: bash
|
# - name: Install Ansible
|
||||||
run: |
|
# shell: bash
|
||||||
sudo apt-get update
|
# run: |
|
||||||
sudo apt-get install -y ansible rsync
|
# sudo apt-get update
|
||||||
|
# sudo apt-get install -y ansible rsync
|
||||||
|
|
||||||
- name: Set up SSH
|
# - name: Set up SSH
|
||||||
run: |
|
# run: |
|
||||||
mkdir -p ~/.ssh
|
# mkdir -p ~/.ssh
|
||||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/vlans_rsa
|
# echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/vlans_rsa
|
||||||
chmod 600 ~/.ssh/vlans_rsa
|
# chmod 600 ~/.ssh/vlans_rsa
|
||||||
cat > ~/.ssh/config <<'EOF'
|
# cat > ~/.ssh/config <<'EOF'
|
||||||
Host *
|
# Host *
|
||||||
StrictHostKeyChecking no
|
# StrictHostKeyChecking no
|
||||||
UserKnownHostsFile=/dev/null
|
# UserKnownHostsFile=/dev/null
|
||||||
EOF
|
# EOF
|
||||||
|
|
||||||
- name: Run playbook
|
# - name: Configure Git
|
||||||
run: |
|
# run: |
|
||||||
ansible-playbook ansible/playbooks/docker_copy.yml -i ansible/inventory/inventory.yml -u cloud --private-key ~/.ssh/vlans_rsa
|
# git config user.name "git-bot"
|
||||||
|
# git config user.email "got-bot@text.com"
|
||||||
|
|
||||||
- name: Configure Git
|
# - name: Commit and push to Gitea
|
||||||
run: |
|
# run: |
|
||||||
git config user.name "git-bot"
|
# git remote set-url origin https://$GITEA_USERNAME:${{ secrets.GIT_BOT_TOKEN }}@tea.charcarservices.uk/CC/N8N.git
|
||||||
git config user.email "got-bot@text.com"
|
# git add terraform/vm_data.yml ansible/inventory/inventory.yml
|
||||||
|
# git diff --cached --quiet || git commit -m "chore: update terraform outputs"
|
||||||
|
# git push origin HEAD:main
|
||||||
|
# env:
|
||||||
|
# GITEA_USERNAME: git-bot # or your bot account
|
||||||
|
|
||||||
- name: Commit and push to Gitea
|
# - name: Run playbook
|
||||||
run: |
|
# run: |
|
||||||
git remote set-url origin https://$GITEA_USERNAME:${{ secrets.GIT_BOT_TOKEN }}@tea.charcarservices.uk/CC/N8N.git
|
# ansible-playbook ansible/playbooks/docker_copy.yml -i ansible/inventory/inventory.yml -u cloud --private-key ~/.ssh/vlans_rsa
|
||||||
git add terraform/vm_data.yml ansible/inventory/inventory.yml
|
|
||||||
git diff --cached --quiet || git commit -m "chore: update terraform outputs"
|
|
||||||
git push origin HEAD:main
|
|
||||||
env:
|
|
||||||
GITEA_USERNAME: git-bot # or your bot account
|
|
||||||
|
|||||||
@@ -9,6 +9,15 @@ on:
|
|||||||
default: "terraform"
|
default: "terraform"
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
|
tfvars_file:
|
||||||
|
description: "Which tfvars file to use"
|
||||||
|
required: true
|
||||||
|
default: "single.tfvars.example"
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- single.tfvars.example
|
||||||
|
- multi.tfvars.example
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
destroy:
|
destroy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -22,6 +31,12 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Check files & Select tfvars
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cp "${{ inputs.tfvars_file || 'single.tfvars.example' }}" terraform.tfvars
|
||||||
|
cat terraform.tfvars
|
||||||
|
|
||||||
- name: Setup Terraform
|
- name: Setup Terraform
|
||||||
uses: hashicorp/setup-terraform@v4
|
uses: hashicorp/setup-terraform@v4
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
resource "proxmox_virtual_environment_file" "cloud_config" {
|
resource "proxmox_virtual_environment_file" "cloud_config" {
|
||||||
content_type = "snippets"
|
content_type = "snippets"
|
||||||
datastore_id = "local"
|
datastore_id = "hlst"
|
||||||
node_name = "pop"
|
node_name = "${var.node_name}"
|
||||||
|
|
||||||
source_raw {
|
source_raw {
|
||||||
file_name = "vm.cloud-config.yaml" # The name of the snippet file
|
file_name = "${var.vm_name}_vm.cloud-config.yaml" # The name of the snippet file
|
||||||
data = <<-EOF
|
data = <<-EOF
|
||||||
#cloud-config
|
#cloud-config
|
||||||
hostname: ${var.vm_name}
|
hostname: ${var.vm_name}
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ variable "pm_api_token" { default = "terraform@pve!provider=760580c4-5c1f-462b-9
|
|||||||
variable "storage" { default = "hlst" }
|
variable "storage" { default = "hlst" }
|
||||||
variable "bridge" { default = "vmbr0" }
|
variable "bridge" { default = "vmbr0" }
|
||||||
|
|
||||||
variable "os_type" {
|
|
||||||
default = "alpine"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "instance_configs" {
|
variable "instance_configs" {
|
||||||
type = list(object({
|
type = list(object({
|
||||||
@@ -110,7 +107,6 @@ variable "vm_name" {
|
|||||||
variable "vm_user_sshkey" {
|
variable "vm_user_sshkey" {
|
||||||
description = "Admin user SSH key of the VM"
|
description = "Admin user SSH key of the VM"
|
||||||
type = string
|
type = string
|
||||||
default = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRlWaLBt/qmWY01Cd6jN/YxLnlT+6lg+evEdN/dIajirdTj1rCbAdlG3WYvo+4BpN17HK3/eGQpGUMbgI/8MVd8YPODcD34gaNX0w2v66BwHx+S6BZUpz5T2IoQT0JtSv/TtFICoff5gXdNRpfd4eWsmTioEqLA6oToJLE4dn3jvAzFi9y7fyLqvuoQMmPidYYJjGT30eiULtXNspoEP+GmuWmVEu+znzMWaKDWKdOsii4Cv1aWCRKSDDRzDBrZI2mP+Vm4HDQBdgDYRw4ehumMDtfaSjyJCnrk691bIM+wxzICuIEecg5kq5HcUPvo2mFyWPAEXb5xlXnuopYEBd7 Generated By NeoServer"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ locals {
|
|||||||
|
|
||||||
resource "proxmox_virtual_environment_file" "cloud_config" {
|
resource "proxmox_virtual_environment_file" "cloud_config" {
|
||||||
content_type = "snippets"
|
content_type = "snippets"
|
||||||
datastore_id = "local"
|
datastore_id = "hlst"
|
||||||
node_name = "pop"
|
node_name = "${var.node_name}"
|
||||||
|
|
||||||
source_raw {
|
source_raw {
|
||||||
file_name = "vm.cloud-config.yaml" # The name of the snippet file
|
file_name = "${var.vm_name}_vm.cloud-config.yaml" # The name of the snippet file
|
||||||
data = <<-EOF
|
data = <<-EOF
|
||||||
#cloud-config
|
#cloud-config
|
||||||
hostname: ${var.vm_name}
|
hostname: ${var.vm_name}
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ variable "vm_defaults" {
|
|||||||
node_datastore = "hlst"
|
node_datastore = "hlst"
|
||||||
vm_bios = "ovmf"
|
vm_bios = "ovmf"
|
||||||
vm_machine = "q35"
|
vm_machine = "q35"
|
||||||
vm_user_sshkey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRlWaLBt/qmWY01Cd6jN/YxLnlT+6lg+evEdN/dIajirdTj1rCbAdlG3WYvo+4BpN17HK3/eGQpGUMbgI/8MVd8YPODcD34gaNX0w2v66BwHx+S6BZUpz5T2IoQT0JtSv/TtFICoff5gXdNRpfd4eWsmTioEqLA6oToJLE4dn3jvAzFi9y7fyLqvuoQMmPidYYJjGT30eiULtXNspoEP+GmuWmVEu+znzMWaKDWKdOsii4Cv1aWCRKSDDRzDBrZI2mP+Vm4HDQBdgDYRw4ehumMDtfaSjyJCnrk691bIM+wxzICuIEecg5kq5HcUPvo2mFyWPAEXb5xlXnuopYEBd7 Generated By NeoServer"
|
|
||||||
bridge = "vmbr0"
|
bridge = "vmbr0"
|
||||||
vm_cpu = 2
|
vm_cpu = 2
|
||||||
vm_ram = 4096
|
vm_ram = 4096
|
||||||
|
|||||||
Reference in New Issue
Block a user