add playbook
This commit is contained in:
19
glusterfs/ansible/setup_galery.yml
Normal file
19
glusterfs/ansible/setup_galery.yml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- hosts: glusterfs
|
||||||
|
gather_facts: true
|
||||||
|
become: false
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: "Install GlusterFS on all nodes"
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: glusterfs-server
|
||||||
|
state: present
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: "Start and enable GlusterFS service"
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: glusterd
|
||||||
|
state: started
|
||||||
|
enabled: true
|
||||||
|
become: true
|
||||||
23
glusterfs/inventory/terraform_hosts.yml
Executable file
23
glusterfs/inventory/terraform_hosts.yml
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
# terraform/templates/inventory.yml.tftpl
|
||||||
|
# Auto-generated by Terraform - DO NOT EDIT
|
||||||
|
all:
|
||||||
|
children:
|
||||||
|
bastion:
|
||||||
|
hosts:
|
||||||
|
bastion:
|
||||||
|
ansible_host: "192.168.178.52"
|
||||||
|
ansible_user: clusteruser
|
||||||
|
test_server:
|
||||||
|
hosts:
|
||||||
|
gluster1:
|
||||||
|
ansible_host: "10.100.0.3"
|
||||||
|
ansible_user: clusteruser
|
||||||
|
ansible_ssh_common_args: "-o ProxyJump=clusteruser@192.168.178.52"
|
||||||
|
gluster2:
|
||||||
|
ansible_host: "10.100.0.5"
|
||||||
|
ansible_user: clusteruser
|
||||||
|
ansible_ssh_common_args: "-o ProxyJump=clusteruser@192.168.178.52"
|
||||||
|
gluster3:
|
||||||
|
ansible_host: "10.100.0.2"
|
||||||
|
ansible_user: clusteruser
|
||||||
|
ansible_ssh_common_args: "-o ProxyJump=clusteruser@192.168.178.52"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
resource "proxmox_vm_qemu" "cloudinit-test1" {
|
resource "proxmox_vm_qemu" "galera" {
|
||||||
for_each = toset(var.hosts)
|
for_each = toset(var.hosts)
|
||||||
name = "${each.value}"
|
name = "${each.value}"
|
||||||
desc = "A test for using terraform and cloudinit"
|
desc = "A test for using terraform and cloudinit"
|
||||||
@@ -48,7 +48,7 @@ resource "proxmox_vm_qemu" "cloudinit-test1" {
|
|||||||
network {
|
network {
|
||||||
id = 0
|
id = 0
|
||||||
model = "e1000"
|
model = "e1000"
|
||||||
bridge = var.nic_name
|
bridge = var.nic_name_internal
|
||||||
}
|
}
|
||||||
|
|
||||||
vga {
|
vga {
|
||||||
@@ -71,4 +71,6 @@ resource "proxmox_vm_qemu" "cloudinit-test1" {
|
|||||||
ciuser = "clusteruser"
|
ciuser = "clusteruser"
|
||||||
cipassword = "password"
|
cipassword = "password"
|
||||||
ciupgrade = true
|
ciupgrade = true
|
||||||
|
cicustom = "vendor=oldnasisos:snippets/qemu-guest-agent.yml"
|
||||||
|
|
||||||
}
|
}
|
||||||
7
glusterfs/terraform/inventory.tf
Normal file
7
glusterfs/terraform/inventory.tf
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
resource "local_file" "ansible_inventory" {
|
||||||
|
content = templatefile("${path.module}/templates/inventory.yml.tftpl", {
|
||||||
|
galera_servers = proxmox_vm_qemu.galera
|
||||||
|
bastion = proxmox_vm_qemu.jumphost
|
||||||
|
})
|
||||||
|
filename = "${path.module}/../inventory/terraform_hosts.yml"
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
resource "proxmox_vm_qemu" "cloudinit-test1" {
|
resource "proxmox_vm_qemu" "jumphost" {
|
||||||
name = "Jumphost"
|
name = "Jumphost"
|
||||||
desc = "A test for using terraform and cloudinit"
|
desc = "A test for using terraform and cloudinit"
|
||||||
|
|
||||||
@@ -77,4 +77,5 @@ resource "proxmox_vm_qemu" "cloudinit-test1" {
|
|||||||
ciuser = "clusteruser"
|
ciuser = "clusteruser"
|
||||||
cipassword = "password"
|
cipassword = "password"
|
||||||
ciupgrade = true
|
ciupgrade = true
|
||||||
|
cicustom = "vendor=oldnasisos:snippets/qemu-guest-agent.yml"
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,10 @@ terraform {
|
|||||||
source = "telmate/proxmox"
|
source = "telmate/proxmox"
|
||||||
version = "3.0.2-rc07"
|
version = "3.0.2-rc07"
|
||||||
}
|
}
|
||||||
|
local = {
|
||||||
|
source = "hashicorp/local"
|
||||||
|
version = "2.7.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
17
glusterfs/terraform/templates/inventory.yml.tftpl
Normal file
17
glusterfs/terraform/templates/inventory.yml.tftpl
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# terraform/templates/inventory.yml.tftpl
|
||||||
|
# Auto-generated by Terraform - DO NOT EDIT
|
||||||
|
all:
|
||||||
|
children:
|
||||||
|
bastion:
|
||||||
|
hosts:
|
||||||
|
bastion:
|
||||||
|
ansible_host: "${bastion.default_ipv4_address}"
|
||||||
|
ansible_user: clusteruser
|
||||||
|
test_server:
|
||||||
|
hosts:
|
||||||
|
%{ for idx, server in galera_servers ~}
|
||||||
|
${server.name}:
|
||||||
|
ansible_host: "${server.default_ipv4_address}"
|
||||||
|
ansible_user: clusteruser
|
||||||
|
ansible_ssh_common_args: "-o ProxyJump=clusteruser@${bastion.default_ipv4_address}"
|
||||||
|
%{ endfor ~}
|
||||||
Reference in New Issue
Block a user