mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
rinnosuke: IPv6
This commit is contained in:
parent
a5f30ff1d0
commit
d10f9d6292
2 changed files with 69 additions and 26 deletions
|
|
@ -1,32 +1,57 @@
|
|||
{ config, tf, meta, kw, pkgs, lib, sources, ... }: with lib; let
|
||||
oci-root = meta.deploy.targets.oci-root.tf;
|
||||
addr_ipv6_nix = let
|
||||
prefix = head (splitString "/" (oci-root.resources.oci_kw_subnet.importAttr "ipv6cidr_block"));
|
||||
in assert hasSuffix "::" prefix; prefix + "7";
|
||||
in
|
||||
{
|
||||
imports = (with (import (sources.tf-nix + "/modules")); [
|
||||
nixos.ubuntu-linux
|
||||
nixos.oracle
|
||||
./oracle.nix
|
||||
]) ++ (with meta; [ services.nginx ]);
|
||||
{
|
||||
imports = (with (import (sources.tf-nix + "/modules")); [
|
||||
nixos.ubuntu-linux
|
||||
nixos.oracle
|
||||
./oracle.nix
|
||||
]) ++ (with meta; [
|
||||
services.knot
|
||||
services.nginx
|
||||
]);
|
||||
|
||||
services.nginx.virtualHosts =
|
||||
let
|
||||
splashy = pkgs.host-splash-site config.networking.hostName;
|
||||
in
|
||||
kw.virtualHostGen {
|
||||
networkFilter = [ "public" ];
|
||||
block.locations."/" = { root = splashy; };
|
||||
};
|
||||
services.nginx.virtualHosts =
|
||||
let
|
||||
splashy = pkgs.host-splash-site config.networking.hostName;
|
||||
in
|
||||
kw.virtualHostGen {
|
||||
networkFilter = [ "public" ];
|
||||
block.locations."/" = { root = splashy; };
|
||||
};
|
||||
|
||||
networking = {
|
||||
hostName = "rinnosuke";
|
||||
};
|
||||
networking = {
|
||||
useDHCP = false;
|
||||
hostName = "rinnosuke";
|
||||
interfaces.ens3 = {
|
||||
useDHCP = true;
|
||||
ipv6 = {
|
||||
addresses = [{
|
||||
address = addr_ipv6_nix;
|
||||
prefixLength = 64;
|
||||
}];
|
||||
routes = [{
|
||||
address = "::";
|
||||
prefixLength = 0;
|
||||
}];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
network = {
|
||||
addresses.public.enable = true;
|
||||
firewall.public.interfaces = singleton "ens3";
|
||||
tf = {
|
||||
enable = true;
|
||||
ipv4_attr = "public_ip";
|
||||
};
|
||||
};
|
||||
}
|
||||
network = {
|
||||
addresses = {
|
||||
public = {
|
||||
enable = true;
|
||||
ipv6.address = addr_ipv6_nix;
|
||||
};
|
||||
};
|
||||
firewall.public.interfaces = singleton "ens3";
|
||||
tf = {
|
||||
enable = true;
|
||||
ipv4_attr = "public_ip";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,24 @@ in
|
|||
sort_order = "DESC";
|
||||
};
|
||||
};
|
||||
rinnosuke_vnic = {
|
||||
provider = "oci";
|
||||
type = "core_vnic_attachments";
|
||||
dataSource = true;
|
||||
inputs = {
|
||||
inherit compartment_id;
|
||||
instance_id = tf.resources.rinnosuke.refAttr "id";
|
||||
};
|
||||
};
|
||||
rinnosuke_ipv6 = {
|
||||
provider = "oci";
|
||||
type = "core_ipv6";
|
||||
inputs = {
|
||||
vnic_id = tf.resources.rinnosuke_vnic.refAttr "vnic_attachments[0].vnic_id";
|
||||
display_name = config.networking.hostName;
|
||||
ip_address = terraformExpr ''cidrhost("${oci-root.resources.oci_kw_subnet.importAttr "ipv6cidr_block"}", 7)'';
|
||||
};
|
||||
};
|
||||
rinnosuke = {
|
||||
provider = "oci";
|
||||
type = "core_instance";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue