Compare commits

...

15 Commits

Author SHA1 Message Date
Benedikt Penner
ec2a7b5f7d next... 2026-03-15 15:59:05 +01:00
Benedikt Penner
8a785c8e19 next... 2026-03-15 15:54:56 +01:00
Benedikt Penner
ffe2bbd224 ... 2026-03-15 02:14:46 +01:00
Benedikt Penner
8e82c266e7 split playbooks 2026-03-15 01:30:35 +01:00
Benedikt Penner
8f97afa26e bla 2026-03-15 01:28:13 +01:00
Benedikt Penner
67cf9ef1ae next... 2026-03-15 01:21:24 +01:00
Benedikt Penner
45d83d9d26 next try! 2026-03-15 01:13:39 +01:00
Benedikt Penner
3d2d6a057f cleanup 2026-03-15 01:06:25 +01:00
Benedikt Penner
0ac3dc09c4 add ssh key 2026-03-15 00:58:57 +01:00
Benedikt Penner
8d4cd6b3ad remove unneeded files 2026-03-15 00:51:13 +01:00
Benedikt Penner
742878febe change target host 2026-03-15 00:42:04 +01:00
Benedikt Penner
54c5f00370 fix ini 2026-03-14 22:24:22 +01:00
Benedikt Penner
86460b69f2 rename yml to ini 2026-03-14 22:20:27 +01:00
Benedikt Penner
05dcf8ca20 Adapted proxycommand 2026-03-14 22:17:49 +01:00
Benedikt Penner
32ac0221d1 mini playbook 2026-03-14 21:52:37 +01:00
9 changed files with 60 additions and 320 deletions

View File

@@ -0,0 +1,9 @@
---
- hosts: bastion
gather_facts: false
tasks:
- name: Set authorized key taken from file
ansible.posix.authorized_key:
user: clusteruser
state: present
key: "{{ lookup('file', './files/ansible_key.pub') }}"

View File

@@ -0,0 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACCn14U5lXczU3gyBa7x7m1RRgVOHHphBwDQTxvFiZrd9AAAAJikswD/pLMA
/wAAAAtzc2gtZWQyNTUxOQAAACCn14U5lXczU3gyBa7x7m1RRgVOHHphBwDQTxvFiZrd9A
AAAECqUlHZcmQAUp9+iZH509A3euZ6fL0MME4CC3U91H2EK6fXhTmVdzNTeDIFrvHubVFG
BU4cemEHANBPG8WJmt30AAAAEWR1bW15QGV4YW1wbGUuY29tAQIDBA==
-----END OPENSSH PRIVATE KEY-----

View File

@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfXhTmVdzNTeDIFrvHubVFGBU4cemEHANBPG8WJmt30 dummy@example.com

View File

@@ -1,19 +1,13 @@
--- ---
- hosts: glusterfs - hosts: test_server
gather_facts: true gather_facts: true
become: false become: false
tasks: tasks:
- name: "Install GlusterFS on all nodes" - name: Run hostname -a
ansible.builtin.package: command: hostname -a
name: glusterfs-server register: hostname_out
state: present
become: true
- name: "Start and enable GlusterFS service" - name: Show hostname output
ansible.builtin.service: debug:
name: glusterd var: hostname_out.stdout
state: started
enabled: true
become: true

View File

@@ -0,0 +1,19 @@
# terraform/templates/inventory.yml.tftpl
# Auto-generated by Terraform - DO NOT EDIT
[bastion]
Jumphost ansible_host="192.168.178.59"
[test_server]
gluster1 ansible_host="10.100.0.3"
gluster2 ansible_host="10.100.0.4"
gluster3 ansible_host="10.100.0.5"
[all:vars]
ansible_connection=ssh
ansible_user=clusteruser
ansible_ssh_pass=password
[test_server:vars]
ansible_ssh_common_args='-o ProxyCommand="ssh -i /root/.ssh/ansible_key -W %h:%p -q clusteruser@192.168.178.59"'

View File

@@ -3,5 +3,5 @@ resource "local_file" "ansible_inventory" {
galera_servers = proxmox_vm_qemu.galera galera_servers = proxmox_vm_qemu.galera
bastion = proxmox_vm_qemu.jumphost bastion = proxmox_vm_qemu.jumphost
}) })
filename = "${path.module}/../inventory/terraform_hosts.yml" filename = "${path.module}/../inventory/terraform_hosts.ini"
} }

View File

@@ -1,17 +1,19 @@
# terraform/templates/inventory.yml.tftpl # terraform/templates/inventory.yml.tftpl
# Auto-generated by Terraform - DO NOT EDIT # Auto-generated by Terraform - DO NOT EDIT
all:
children: [bastion]
bastion: ${bastion.name} ansible_host="${bastion.default_ipv4_address}"
hosts:
bastion:
ansible_host: "${bastion.default_ipv4_address}" [test_server]
ansible_user: clusteruser
test_server:
hosts:
%{ for idx, server in galera_servers ~} %{ for idx, server in galera_servers ~}
${server.name}: ${server.name} ansible_host="${server.default_ipv4_address}"
ansible_host: "${server.default_ipv4_address}"
ansible_user: clusteruser
ansible_ssh_common_args: "-o ProxyJump=clusteruser@${bastion.default_ipv4_address}"
%{ endfor ~} %{ endfor ~}
[all:vars]
ansible_connection=ssh
ansible_user=clusteruser
ansible_ssh_pass=password
[test_server:vars]
ansible_ssh_common_args='-o ProxyCommand="ssh -i ./glusterfs/ansible/files/ansible_key -W %h:%p -q clusteruser@${bastion.default_ipv4_address}"'

View File

@@ -1,9 +0,0 @@
{
"version": 4,
"terraform_version": "1.14.6",
"serial": 30,
"lineage": "d836755f-ecfa-60b3-e3cf-b9c4ab78bfdc",
"outputs": {},
"resources": [],
"check_results": null
}

View File

@@ -1,283 +0,0 @@
{
"version": 4,
"terraform_version": "1.14.6",
"serial": 28,
"lineage": "d836755f-ecfa-60b3-e3cf-b9c4ab78bfdc",
"outputs": {},
"resources": [
{
"mode": "managed",
"type": "proxmox_vm_qemu",
"name": "cloudinit-test1",
"provider": "provider[\"registry.terraform.io/telmate/proxmox\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"additional_wait": 5,
"agent": 1,
"agent_timeout": 90,
"args": "",
"automatic_reboot": true,
"automatic_reboot_severity": "error",
"balloon": 1024,
"bios": "seabios",
"boot": "order=scsi0",
"bootdisk": "",
"ci_wait": null,
"cicustom": null,
"cipassword": "password",
"ciupgrade": true,
"ciuser": "clusteruser",
"clone": "ubuntu-cloud-init-template",
"clone_id": null,
"clone_wait": 10,
"cores": 0,
"cpu": [
{
"affinity": "",
"cores": 2,
"flags": [],
"limit": 0,
"numa": false,
"sockets": 1,
"type": "host",
"units": 0,
"vcores": 0
}
],
"cpu_type": "",
"current_node": "pve-testing",
"default_ipv4_address": "",
"default_ipv6_address": "",
"define_connection_info": true,
"desc": "A test for using terraform and cloudinit",
"description": "Managed by Terraform.",
"disk": [],
"disks": [
{
"ide": [
{
"ide0": [],
"ide1": [],
"ide2": [],
"ide3": [
{
"cdrom": [],
"cloudinit": [
{
"storage": "local-lvm"
}
],
"disk": [],
"ignore": false,
"passthrough": []
}
]
}
],
"sata": [],
"scsi": [
{
"scsi0": [
{
"cdrom": [],
"cloudinit": [],
"disk": [
{
"asyncio": "",
"backup": true,
"cache": "",
"discard": true,
"emulatessd": false,
"format": "raw",
"id": 0,
"iops_r_burst": 0,
"iops_r_burst_length": 0,
"iops_r_concurrent": 0,
"iops_wr_burst": 0,
"iops_wr_burst_length": 0,
"iops_wr_concurrent": 0,
"iothread": true,
"linked_disk_id": -1,
"mbps_r_burst": 0,
"mbps_r_concurrent": 0,
"mbps_wr_burst": 0,
"mbps_wr_concurrent": 0,
"readonly": false,
"replicate": false,
"serial": "",
"size": "32G",
"storage": "local-lvm",
"wwn": ""
}
],
"ignore": false,
"passthrough": []
}
],
"scsi1": [],
"scsi10": [],
"scsi11": [],
"scsi12": [],
"scsi13": [],
"scsi14": [],
"scsi15": [],
"scsi16": [],
"scsi17": [],
"scsi18": [],
"scsi19": [],
"scsi2": [],
"scsi20": [],
"scsi21": [],
"scsi22": [],
"scsi23": [],
"scsi24": [],
"scsi25": [],
"scsi26": [],
"scsi27": [],
"scsi28": [],
"scsi29": [],
"scsi3": [],
"scsi30": [],
"scsi4": [],
"scsi5": [],
"scsi6": [],
"scsi7": [],
"scsi8": [],
"scsi9": []
}
],
"virtio": []
}
],
"efidisk": [],
"force_create": false,
"force_recreate_on_change_of": null,
"full_clone": true,
"hagroup": "",
"hastate": "",
"hostpci": [],
"hotplug": "network,disk,usb",
"id": "pve-testing/qemu/101",
"ipconfig0": "ip=dhcp,ip6=dhcp",
"ipconfig1": null,
"ipconfig10": null,
"ipconfig11": null,
"ipconfig12": null,
"ipconfig13": null,
"ipconfig14": null,
"ipconfig15": null,
"ipconfig2": null,
"ipconfig3": null,
"ipconfig4": null,
"ipconfig5": null,
"ipconfig6": null,
"ipconfig7": null,
"ipconfig8": null,
"ipconfig9": null,
"kvm": true,
"linked_vmid": 0,
"machine": "",
"memory": 2048,
"name": "terraform-test-vm",
"nameserver": null,
"network": [
{
"bridge": "vmbr0",
"firewall": false,
"id": 0,
"link_down": false,
"macaddr": "bc:24:11:42:9b:07",
"model": "e1000",
"mtu": 0,
"queues": 0,
"rate": 0,
"tag": 0
}
],
"numa": false,
"onboot": null,
"os_network_config": null,
"os_type": "cloud-init",
"pci": [],
"pcis": [],
"pool": "",
"protection": false,
"pxe": null,
"qemu_os": "other",
"reboot_required": false,
"rng": [],
"scsihw": "virtio-scsi-single",
"searchdomain": null,
"serial": [],
"skip_ipv4": false,
"skip_ipv6": true,
"smbios": [
{
"family": "",
"manufacturer": "",
"product": "",
"serial": "",
"sku": "",
"uuid": "4a4ba40e-3d3f-4b2e-9945-d6725bd771da",
"version": ""
}
],
"sockets": 0,
"ssh_forward_ip": null,
"ssh_host": "",
"ssh_port": "22",
"ssh_private_key": null,
"ssh_user": null,
"sshkeys": null,
"start_at_node_boot": false,
"startup": null,
"startup_shutdown": [
{
"order": -1,
"shutdown_timeout": -1,
"startup_delay": -1
}
],
"tablet": true,
"tags": "",
"target_node": "pve-testing",
"target_nodes": null,
"timeouts": null,
"tpm_state": [],
"unused_disk": [],
"usb": [],
"usbs": [],
"vcpus": 0,
"vga": [
{
"memory": null,
"type": "virtio"
}
],
"vm_state": "running",
"vmid": 101
},
"sensitive_attributes": [
[
{
"type": "get_attr",
"value": "cipassword"
}
],
[
{
"type": "get_attr",
"value": "ssh_private_key"
}
]
],
"identity_schema_version": 0,
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWZhdWx0IjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInJlYWQiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19"
}
]
}
],
"check_results": null
}