mirror of
https://gitea.fenix-dev.com/fenix-gitea-admin/iac-opentofu-private.git
synced 2025-10-27 15:53:06 +00:00
Compare commits
10 Commits
fenix-admi
...
1e0110fe1a
| Author | SHA1 | Date | |
|---|---|---|---|
| 1e0110fe1a | |||
| 5a24f06fd8 | |||
| 11e8997be8 | |||
| d4811cbcfe | |||
| 6258d9e279 | |||
| eaadf11a99 | |||
| 50e52fb839 | |||
| 43bd8914aa | |||
| c457178d48 | |||
| 01d40d4120 |
@ -65,8 +65,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install dante-server
|
- name: Install dante-server
|
||||||
run: |
|
run: |
|
||||||
apt-get install -y dante-server openssl
|
apt-get install -y dante-server openssl libssl1.1
|
||||||
#libssl1.1
|
|
||||||
|
|
||||||
|
|
||||||
- name: Configure dante-server
|
- name: Configure dante-server
|
||||||
@ -93,7 +92,6 @@ jobs:
|
|||||||
- name: vaultwarden urls as secrets
|
- name: vaultwarden urls as secrets
|
||||||
run: |
|
run: |
|
||||||
echo "config"
|
echo "config"
|
||||||
echo "$VAULTWARDEN_LINK"
|
|
||||||
bw config server $VAULTWARDEN_LINK
|
bw config server $VAULTWARDEN_LINK
|
||||||
echo "login"
|
echo "login"
|
||||||
bw login --apikey
|
bw login --apikey
|
||||||
@ -101,7 +99,6 @@ jobs:
|
|||||||
BW_SESSION=$(bw unlock "$BW_PASSWORD" --raw)
|
BW_SESSION=$(bw unlock "$BW_PASSWORD" --raw)
|
||||||
echo "$BW_SESSION"
|
echo "$BW_SESSION"
|
||||||
echo "getting item"
|
echo "getting item"
|
||||||
bw get item "iac.proxmox.ssh.link" --session "$BW_SESSION"
|
|
||||||
bw get item "iac.proxmox.ssh.link" --session "$BW_SESSION" | jq -r '.notes' > "proxmox-ssh-link.txt"
|
bw get item "iac.proxmox.ssh.link" --session "$BW_SESSION" | jq -r '.notes' > "proxmox-ssh-link.txt"
|
||||||
|
|
||||||
- name: Start cloudflared Access TCP -> SOCKS5 (background)
|
- name: Start cloudflared Access TCP -> SOCKS5 (background)
|
||||||
@ -168,7 +165,7 @@ jobs:
|
|||||||
elif [ "$type" == "note" ]; then
|
elif [ "$type" == "note" ]; then
|
||||||
echo "note get"
|
echo "note get"
|
||||||
bw get item "$name" --session "$BW_SESSION" | jq -r '.notes' > "$output"
|
bw get item "$name" --session "$BW_SESSION" | jq -r '.notes' > "$output"
|
||||||
#cat $output
|
cat $output
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@ -5,27 +5,19 @@ FROM ubuntu:24.04
|
|||||||
# Copy the tofu binary
|
# Copy the tofu binary
|
||||||
COPY --from=tofu /usr/local/bin/tofu /usr/local/bin/tofu
|
COPY --from=tofu /usr/local/bin/tofu /usr/local/bin/tofu
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
# Atualizar pacotes e instalar dependências básicas
|
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
curl \
|
|
||||||
git \
|
git \
|
||||||
|
curl \
|
||||||
|
nodejs \
|
||||||
|
npm \
|
||||||
unzip \
|
unzip \
|
||||||
jq \
|
|
||||||
gnupg \
|
|
||||||
ca-certificates \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Instalar Node.js 18 via NodeSource
|
RUN curl -L -o /tmp/bw.zip https://github.com/bitwarden/cli/releases/download/v1.22.1/bw-linux-1.22.1.zip \
|
||||||
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
&& unzip /tmp/bw.zip -d /usr/local/bin \
|
||||||
apt-get install -y nodejs
|
&& chmod +x /usr/local/bin/bw \
|
||||||
|
&& rm /tmp/bw.zip
|
||||||
|
|
||||||
# Verificar versões (opcional para debug)
|
|
||||||
RUN node -v && npm -v
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RUN npm install -g @bitwarden/cli
|
|
||||||
|
|
||||||
WORKDIR /workspace
|
WORKDIR /workspace
|
||||||
@ -120,7 +120,7 @@ resource "proxmox_virtual_environment_vm" "proxmox-kubernetes-VM-template" {
|
|||||||
|
|
||||||
# Configuração da interface de rede
|
# Configuração da interface de rede
|
||||||
network_device {
|
network_device {
|
||||||
bridge = "vmbr0" # rede de gestão para comunicação com Cluster A
|
bridge = "vmbr0"
|
||||||
}
|
}
|
||||||
|
|
||||||
initialization {
|
initialization {
|
||||||
@ -132,7 +132,6 @@ initialization {
|
|||||||
address = "dhcp"
|
address = "dhcp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
user_data_file_id = proxmox_virtual_environment_file.cloud_init_yaml.id
|
user_data_file_id = proxmox_virtual_environment_file.cloud_init_yaml.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,8 +40,6 @@ variable "proxmox_k8s_vms" {
|
|||||||
vm_id = number
|
vm_id = number
|
||||||
node_name = string
|
node_name = string
|
||||||
ip = string
|
ip = string
|
||||||
ip2 = string
|
|
||||||
ip3 = string
|
|
||||||
cores = optional(number)
|
cores = optional(number)
|
||||||
memory = optional(number)
|
memory = optional(number)
|
||||||
data_store = optional(string)
|
data_store = optional(string)
|
||||||
|
|||||||
@ -1,13 +0,0 @@
|
|||||||
|
|
||||||
[master]
|
|
||||||
master1 ansible_host=192.168.1.99 ansible_user=user ansible_ssh_pass=pass ansible_ssh_common_args='-o StrictHostKeyChecking=no'
|
|
||||||
|
|
||||||
[workers]
|
|
||||||
|
|
||||||
|
|
||||||
worker-192-168-1-101 ansible_host=192.168.1.101 ansible_user=user ansible_ssh_pass=pass ansible_ssh_common_args='-o StrictHostKeyChecking=no'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1 +0,0 @@
|
|||||||
proxmox-ssh.example.com
|
|
||||||
@ -1 +0,0 @@
|
|||||||
https://vaultwarden.example.com
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
#proxmox_server = "proxmox.example.com"
|
proxmox_server = "proxmox.example.com"
|
||||||
#PM_API_TOKEN_ID = "tokenid"
|
PM_API_TOKEN_ID = "tokenid"
|
||||||
#PM_API_TOKEN_SECRET = "tokensecret"
|
PM_API_TOKEN_SECRET = "tokensecret"
|
||||||
# tokenid is read automatically from PM_API_TOKEN_ID
|
# tokenid is read automatically from PM_API_TOKEN_ID
|
||||||
# token is read automatically from PM_API_TOKEN_SECRET
|
# token is read automatically from PM_API_TOKEN_SECRET
|
||||||
|
|
||||||
@ -20,7 +20,6 @@ proxmox_k8s_vms = [
|
|||||||
vm_id = 3001
|
vm_id = 3001
|
||||||
node_name = "node"
|
node_name = "node"
|
||||||
ip = "192.168.1.99/24"
|
ip = "192.168.1.99/24"
|
||||||
ip3 = "192.168.1.199/24"
|
|
||||||
cores = 2
|
cores = 2
|
||||||
memory = 2000
|
memory = 2000
|
||||||
disk_size = 32
|
disk_size = 32
|
||||||
@ -34,14 +33,13 @@ proxmox_k8s_vms = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
extra_packages = []
|
extra_packages = []
|
||||||
extra_runcmd = ["sudo ip addr add 192.168.1.199/24 dev eth0"]
|
extra_runcmd = []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "k8s-worker-01"
|
name = "k8s-worker-01"
|
||||||
vm_id = 3002
|
vm_id = 3002
|
||||||
node_name = "node"
|
node_name = "node"
|
||||||
ip = "192.168.1.101/24"
|
ip = "192.168.1.101/24"
|
||||||
ip3 = "192.168.1.201/24"
|
|
||||||
cores = 1
|
cores = 1
|
||||||
memory = 2000
|
memory = 2000
|
||||||
disk_size = 32
|
disk_size = 32
|
||||||
@ -55,6 +53,6 @@ proxmox_k8s_vms = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
extra_packages = []
|
extra_packages = []
|
||||||
extra_runcmd = ["sudo ip addr add 192.168.1.201/24 dev eth0"]
|
extra_runcmd = []
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@ -16,13 +16,6 @@ resource "vaultwarden_account_register" "vaultwarden-acount-fenix" {
|
|||||||
password = var.vaultwarden_master_password
|
password = var.vaultwarden_master_password
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "bitwarden_item_login" "administrative-user" {
|
|
||||||
name = "teste"
|
|
||||||
username = "teste"
|
|
||||||
password = "teste"
|
|
||||||
collection_ids = [vaultwarden_organization_collection.vaultwarden-collection-iac.id]
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "vaultwarden_organization" "vaultwarden-organization-fenix-iac" {
|
resource "vaultwarden_organization" "vaultwarden-organization-fenix-iac" {
|
||||||
name = "fenix-iac"
|
name = "fenix-iac"
|
||||||
}
|
}
|
||||||
@ -32,6 +25,13 @@ resource "vaultwarden_organization_collection" "vaultwarden-collection-iac" {
|
|||||||
name = "iac-collection"
|
name = "iac-collection"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "bitwarden_item_login" "administrative-user" {
|
||||||
|
name = "teste"
|
||||||
|
username = "teste"
|
||||||
|
password = "teste"
|
||||||
|
collection_ids = [vaultwarden_organization_collection.vaultwarden-collection-iac.id]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
resource "bitwarden_item_secure_note" "hosts-ini" {
|
resource "bitwarden_item_secure_note" "hosts-ini" {
|
||||||
name = "iac.ansible.hosts.ini"
|
name = "iac.ansible.hosts.ini"
|
||||||
@ -44,15 +44,16 @@ EOT
|
|||||||
}
|
}
|
||||||
|
|
||||||
locals{
|
locals{
|
||||||
|
|
||||||
hosts_ini = <<EOT
|
hosts_ini = <<EOT
|
||||||
|
|
||||||
[master]
|
[master]
|
||||||
master1 ansible_host=${split("/", var.proxmox_k8s_vms[0].ip)[0]} ansible_user=${var.proxmox_k8s_vms[0].extra_users[0].name} ansible_ssh_pass=${var.proxmox_k8s_vms[0].extra_users[0].password} ansible_ssh_common_args='-o StrictHostKeyChecking=no'
|
master ansible_host=${var.proxmox_k8s_vms[0].ip} ansible_user=${var.proxmox_k8s_vms[0].extra_users[0].name} ansible_ssh_pass=${var.proxmox_k8s_vms[0].extra_users[0].password}
|
||||||
|
|
||||||
[workers]
|
[workers]
|
||||||
%{ for i, vm in var.proxmox_k8s_vms ~}
|
%{ for i, vm in var.proxmox_k8s_vms ~}
|
||||||
%{ if i != 0 }
|
%{ if i != 0 }
|
||||||
worker-${replace(split("/", vm.ip)[0], ".", "-")} ansible_host=${split("/", vm.ip)[0]} ansible_user=${vm.extra_users[0].name} ansible_ssh_pass=${vm.extra_users[0].password} ansible_ssh_common_args='-o StrictHostKeyChecking=no'
|
worker-${replace(vm.ip, ".", "-")} ansible_host=${vm.ip} ansible_user=${vm.extra_users[0].name} ansible_ssh_pass=${vm.extra_users[0].password}
|
||||||
%{ endif }
|
%{ endif }
|
||||||
%{ endfor }
|
%{ endfor }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user