commit
8a654f809f
@ -0,0 +1,15 @@
|
||||
[submodule "roles/ansible-debian-baseline"]
|
||||
path = roles/ansible-debian-baseline
|
||||
url = https://git.bitpack.io/sps/ansible-debian-baseline
|
||||
[submodule "roles/ansible-debian-nftables"]
|
||||
path = roles/ansible-debian-nftables
|
||||
url = https://git.bitpack.io/sps/ansible-debian-nftables
|
||||
[submodule "roles/ansible-debian-ntp"]
|
||||
path = roles/ansible-debian-ntp
|
||||
url = https://git.bitpack.io/sps/ansible-debian-ntp
|
||||
[submodule "roles/ansible-podman-host"]
|
||||
path = roles/ansible-podman-host
|
||||
url = https://git.bitpack.io/sps/ansible-podman-host
|
||||
[submodule "roles/ansible-globaleaks-podman"]
|
||||
path = roles/ansible-globaleaks-podman
|
||||
url = https://g.hazardous.org/fkr/ansible-globaleaks-podman.git
|
@ -0,0 +1,9 @@
|
||||
Copyright (c) <year> <owner> All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@ -0,0 +1,10 @@
|
||||
---
|
||||
|
||||
- hosts: all
|
||||
vars:
|
||||
roles:
|
||||
- ansible-debian-nftables
|
||||
- ansible-debian-baseline
|
||||
- ansible-debian-ntp
|
||||
- ansible-podman-host
|
||||
- ansible-globaleaks-podman
|
@ -0,0 +1 @@
|
||||
Subproject commit 492e9961513237564e0ee4434d43db9385c001c9
|
@ -0,0 +1 @@
|
||||
Subproject commit e384d292c4003a62e1f5980d3b7f705623b4ca96
|
@ -0,0 +1 @@
|
||||
Subproject commit ee4b8019b87e35e8bbfb56c8908a957ff5e792a4
|
@ -0,0 +1 @@
|
||||
Subproject commit 16ce709e62e7780cfce0f6c39a5a04284ed22449
|
@ -0,0 +1 @@
|
||||
Subproject commit ab99c15b2185b621228d02d17507b04e8a81eacd
|
@ -0,0 +1,158 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
gridscale = {
|
||||
source = "gridscale/gridscale"
|
||||
}
|
||||
|
||||
dnsimple = {
|
||||
source = "dnsimple/dnsimple"
|
||||
version = "0.11.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "dnsimple" {
|
||||
# Configuration options
|
||||
token = "${var.dnsimple_token}"
|
||||
account = "${var.dnsimple_account}"
|
||||
}
|
||||
|
||||
variable "dnsimple_token" {
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "dnsimple_account" {
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "dnsimple_domain" {
|
||||
type = string
|
||||
default = "example.net"
|
||||
}
|
||||
|
||||
variable "hostname_fqdn" {
|
||||
type = string
|
||||
default = "my-hostname.example.net"
|
||||
}
|
||||
|
||||
variable "hostname" {
|
||||
type = string
|
||||
default = "my-hostname"
|
||||
}
|
||||
|
||||
variable "hostname_alias" {
|
||||
type = string
|
||||
default = "my-hostname-alias"
|
||||
}
|
||||
|
||||
variable "cores" {
|
||||
type = number
|
||||
default = 2
|
||||
}
|
||||
|
||||
variable "memory" {
|
||||
type = number
|
||||
default = 4
|
||||
}
|
||||
|
||||
variable "capacity" {
|
||||
type = number
|
||||
default = 20
|
||||
}
|
||||
|
||||
variable "ansible_sshkey" {
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
data "gridscale_public_network" "pubnet" {
|
||||
}
|
||||
|
||||
resource "gridscale_server" "server" {
|
||||
name = var.hostname_fqdn
|
||||
cores = var.cores
|
||||
memory = var.memory
|
||||
power = true
|
||||
ipv4 = gridscale_ipv4.ip.id
|
||||
hardware_profile = "q35"
|
||||
|
||||
storage {
|
||||
object_uuid = gridscale_storage.storage.id
|
||||
}
|
||||
|
||||
network {
|
||||
object_uuid = data.gridscale_public_network.pubnet.id
|
||||
}
|
||||
}
|
||||
|
||||
resource "gridscale_storage" "storage" {
|
||||
name = "p.hazardous.org-storage"
|
||||
capacity = var.capacity
|
||||
template {
|
||||
template_uuid = data.gridscale_template.debian.id
|
||||
hostname = var.hostname
|
||||
sshkeys = [gridscale_sshkey.ssh_key.id]
|
||||
}
|
||||
}
|
||||
|
||||
resource "local_file" "ansible_inventory" {
|
||||
content = "${gridscale_server.server.name} ansible_host=${gridscale_ipv4.ip.ip} ansible_user=root"
|
||||
filename = "hosts"
|
||||
file_permission = "0644"
|
||||
}
|
||||
|
||||
resource "null_resource" "storage_provisioner" {
|
||||
|
||||
triggers = {
|
||||
storage_id = gridscale_storage.storage.id
|
||||
}
|
||||
|
||||
provisioner "remote-exec" {
|
||||
inline = ["echo ${gridscale_server.server.id}"]
|
||||
connection {
|
||||
user = "root"
|
||||
port = 22
|
||||
host = gridscale_ipv4.ip.ip
|
||||
timeout = "2m"
|
||||
}
|
||||
}
|
||||
|
||||
provisioner "local-exec" {
|
||||
command = "ansible-playbook --ssh-common-args '-o StrictHostKeyChecking=no' --inventory hosts main.yml"
|
||||
}
|
||||
}
|
||||
|
||||
data "gridscale_template" "debian" {
|
||||
name = "Debian 11"
|
||||
}
|
||||
|
||||
resource "gridscale_sshkey" "ssh_key" {
|
||||
name = "ed"
|
||||
sshkey = var.ansible_sshkey
|
||||
}
|
||||
|
||||
resource "gridscale_ipv4" "ip" {
|
||||
name = "p.hazardous.org-ip"
|
||||
}
|
||||
|
||||
output "server_ip" {
|
||||
value = gridscale_ipv4.ip.ip
|
||||
}
|
||||
|
||||
resource "dnsimple_zone_record" "foobar" {
|
||||
zone_name = "${var.dnsimple_domain}"
|
||||
name = var.hostname
|
||||
value = gridscale_ipv4.ip.ip
|
||||
type = "A"
|
||||
ttl = 3600
|
||||
}
|
||||
|
||||
resource "dnsimple_zone_record" "foobar2" {
|
||||
zone_name = "${var.dnsimple_domain}"
|
||||
name = var.hostname_alias
|
||||
value = gridscale_ipv4.ip.ip
|
||||
type = "A"
|
||||
ttl = 3600
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
cores = 2
|
||||
memory = 4
|
||||
capacity = 20
|
||||
hostname_fqdn = "globaleaks-host.example.org"
|
||||
hostname = "globaleaks-host"
|
||||
ansible_sshkey = "<ssh key>"
|
||||
dnsimple_token = "<dnsimple token>"
|
||||
dnsimple_account = "<dnsimple account>"
|
||||
dnsimple_domain = "exmaple.org"
|
Reference in new issue