diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2024-09-24 22:37:01 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2024-09-24 22:37:01 +0200 |
commit | 5237db91a43e04bf7535056ccbd42edbe7f5d1f8 (patch) | |
tree | d6bc7c18b754dc965a90300c731ace3b9f7e784f | |
parent | 61817c6a3a07aadd5608939ba8dded4a1e77c7ae (diff) | |
download | infra-5237db91a43e04bf7535056ccbd42edbe7f5d1f8.tar.gz infra-5237db91a43e04bf7535056ccbd42edbe7f5d1f8.tar.bz2 infra-5237db91a43e04bf7535056ccbd42edbe7f5d1f8.tar.xz infra-5237db91a43e04bf7535056ccbd42edbe7f5d1f8.zip |
ipam
-rw-r--r-- | ansible/group_vars/all/ipam.yml | 13 | ||||
-rw-r--r-- | ansible/plays/ipam-generate-dns.yml | 7 | ||||
-rw-r--r-- | ansible/plays/ipam-generate-tf.yml | 4 | ||||
-rw-r--r-- | bin/requirements.txt | 3 | ||||
-rw-r--r-- | docs/2023-10-23 - tnet.drawio | 19 | ||||
-rw-r--r-- | terraform/dns/dn42.tf | 28 | ||||
-rw-r--r-- | terraform/ipam6/ipam6.tf | 52 |
7 files changed, 87 insertions, 39 deletions
diff --git a/ansible/group_vars/all/ipam.yml b/ansible/group_vars/all/ipam.yml index 9954a21..ed41105 100644 --- a/ansible/group_vars/all/ipam.yml +++ b/ansible/group_vars/all/ipam.yml @@ -10,15 +10,16 @@ ipam6: range: "fdb1:4242:3538::/48" tnet_dn42: range: "fdb1:4242:3538:2000::/52" - conflatorio_dn42: - description: Internal network on host + unused_2001: range: "fdb1:4242:3538:2001::/64" - hosts: - conflatorio: "fdb1:4242:3538:2001::ffff/64" node1_dn42: range: "fdb1:4242:3538:2002::/64" + hosts: + node1: "fdb1:4242:3538:2002::/64" node2_dn42: range: "fdb1:4242:3538:2003::/64" + hosts: + node2: "fdb1:4242:3538:2003::/64" knot_dn42: range: "fdb1:4242:3538:2004::/64" hosts: @@ -34,8 +35,8 @@ ipam6: range: "fdb1:4242:3538:2006::/64" hosts: kv24ix: "fdb1:4242:3538:2006::ffff/64" - conflatorio_dn42_2: - range: "fdb1:4242:3538:2007:1001::/112" + unused_2007: + range: "fdb1:4242:3538:2007::/64" lhn2_dn42: range: "fdb1:4242:3538:2008::/64" hosts: diff --git a/ansible/plays/ipam-generate-dns.yml b/ansible/plays/ipam-generate-dns.yml index 7bdbfaa..d29b3e8 100644 --- a/ansible/plays/ipam-generate-dns.yml +++ b/ansible/plays/ipam-generate-dns.yml @@ -22,6 +22,11 @@ {% endfor %} - debug: msg: "{{ content }}" - - copy: + when: false + - name: Generating ../../terraform/dns/dn42.tf + register: tf + copy: dest: ../../terraform/dns/dn42.tf content: "{{ content }}" + - shell: terraform fmt ../../terraform/ipam6/ipam6.tf + when: "tf.changed" diff --git a/ansible/plays/ipam-generate-tf.yml b/ansible/plays/ipam-generate-tf.yml index f905b51..e43a559 100644 --- a/ansible/plays/ipam-generate-tf.yml +++ b/ansible/plays/ipam-generate-tf.yml @@ -1,6 +1,8 @@ - hosts: localhost gather_facts: no connection: local + collections: + - ansible.utils tasks: - name: Generate terraform/ipam6/ipam6.tf register: tf @@ -10,7 +12,7 @@ output "networks" { value = { {% for name, network in ipam6.networks.items() %} - {% if not (network.range | ipv6) %} + {% if not (network.range | ansible.utils.ipv6) %} Invalid network: {{ network.range }} {% endif %} {{ name }} = { diff --git a/bin/requirements.txt b/bin/requirements.txt index 8a88990..b47e2cd 100644 --- a/bin/requirements.txt +++ b/bin/requirements.txt @@ -1,4 +1,5 @@ -ansible==10.3.0 +ansible==10.4.0 gns3fy==0.8.0 netaddr==1.3.0 swiplserver==1.0.2 +jinja2<3.1 diff --git a/docs/2023-10-23 - tnet.drawio b/docs/2023-10-23 - tnet.drawio index 80d422c..7414262 100644 --- a/docs/2023-10-23 - tnet.drawio +++ b/docs/2023-10-23 - tnet.drawio @@ -1,4 +1,4 @@ -<mxfile host="Electron" modified="2024-09-24T19:59:06.897Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/22.0.2 Chrome/114.0.5735.289 Electron/25.8.4 Safari/537.36" etag="s1qdKKbkZVLc-xAnSjrh" version="22.0.2" type="device" pages="5"> +<mxfile host="Electron" modified="2024-09-24T20:15:30.452Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/22.0.2 Chrome/114.0.5735.289 Electron/25.8.4 Safari/537.36" etag="5nmccZ1ov7ZESQxNsFWk" version="22.0.2" type="device" pages="5"> <diagram name="tnet" id="BvOL4zu76bRaQ85PTpcJ"> <mxGraphModel dx="2074" dy="1230" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="0"> <root> @@ -458,7 +458,7 @@ </mxGraphModel> </diagram> <diagram id="KZKIfHUl2okZInCISHyk" name="tnet - new"> - <mxGraphModel dx="864" dy="513" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="0"> + <mxGraphModel dx="1257" dy="745" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="0"> <root> <mxCell id="0" /> <mxCell id="1" parent="0" /> @@ -516,19 +516,19 @@ <mxCell id="rOxvz-1gei3paqyAHtll-27" value="node2<br>2003" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;" parent="1" vertex="1"> <mxGeometry x="280" y="560" width="120" height="80" as="geometry" /> </mxCell> - <mxCell id="rOxvz-1gei3paqyAHtll-30" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;" parent="1" source="rOxvz-1gei3paqyAHtll-21" target="rOxvz-1gei3paqyAHtll-27" edge="1"> + <mxCell id="rOxvz-1gei3paqyAHtll-30" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;entryX=0.5;entryY=0.108;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="rOxvz-1gei3paqyAHtll-21" target="rOxvz-1gei3paqyAHtll-27" edge="1"> <mxGeometry relative="1" as="geometry"> <mxPoint x="90" y="503" as="sourcePoint" /> <mxPoint x="620" y="257" as="targetPoint" /> </mxGeometry> </mxCell> - <mxCell id="rOxvz-1gei3paqyAHtll-31" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;" parent="1" source="rOxvz-1gei3paqyAHtll-20" target="rOxvz-1gei3paqyAHtll-26" edge="1"> + <mxCell id="rOxvz-1gei3paqyAHtll-31" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;entryX=0.5;entryY=0.107;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="rOxvz-1gei3paqyAHtll-20" target="rOxvz-1gei3paqyAHtll-26" edge="1"> <mxGeometry relative="1" as="geometry"> <mxPoint x="200" y="519" as="sourcePoint" /> <mxPoint x="119" y="531" as="targetPoint" /> </mxGeometry> </mxCell> - <mxCell id="rOxvz-1gei3paqyAHtll-43" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;" parent="1" source="rOxvz-1gei3paqyAHtll-32" target="rOxvz-1gei3paqyAHtll-40" edge="1"> + <mxCell id="rOxvz-1gei3paqyAHtll-43" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;entryX=0.5;entryY=0.105;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="rOxvz-1gei3paqyAHtll-32" target="rOxvz-1gei3paqyAHtll-40" edge="1"> <mxGeometry relative="1" as="geometry" /> </mxCell> <mxCell id="rOxvz-1gei3paqyAHtll-44" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;spacing=4;entryX=0.805;entryY=0.904;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0.211;exitY=0.092;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="rOxvz-1gei3paqyAHtll-32" target="rOxvz-1gei3paqyAHtll-11" edge="1"> @@ -537,7 +537,7 @@ <mxCell id="rOxvz-1gei3paqyAHtll-32" value="coregonus" style="sketch=0;points=[[0.5,0,0],[1,0.5,0],[0.5,1,0],[0,0.5,0],[0.145,0.145,0],[0.8555,0.145,0],[0.855,0.8555,0],[0.145,0.855,0]];verticalLabelPosition=middle;html=1;verticalAlign=middle;aspect=fixed;align=left;pointerEvents=1;shape=mxgraph.cisco19.rect;prIcon=router;fillColor=#FAFAFA;strokeColor=#005073;labelPosition=right;spacing=4;snapToPoint=0;" parent="1" vertex="1"> <mxGeometry x="920" y="480" width="40" height="40" as="geometry" /> </mxCell> - <mxCell id="rOxvz-1gei3paqyAHtll-38" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;" parent="1" source="rOxvz-1gei3paqyAHtll-37" target="rOxvz-1gei3paqyAHtll-46" edge="1"> + <mxCell id="rOxvz-1gei3paqyAHtll-38" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;entryX=0.5;entryY=0.947;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="rOxvz-1gei3paqyAHtll-37" target="rOxvz-1gei3paqyAHtll-46" edge="1"> <mxGeometry relative="1" as="geometry"> <mxPoint x="780" y="640" as="targetPoint" /> </mxGeometry> @@ -545,7 +545,7 @@ <mxCell id="rOxvz-1gei3paqyAHtll-37" value="danneri" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> <mxGeometry x="580" y="680" width="80" height="40" as="geometry" /> </mxCell> - <mxCell id="rOxvz-1gei3paqyAHtll-39" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;exitPerimeter=0;spacing=4;entryX=0.374;entryY=0.976;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="rOxvz-1gei3paqyAHtll-18" target="rOxvz-1gei3paqyAHtll-11" edge="1"> + <mxCell id="rOxvz-1gei3paqyAHtll-39" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;spacing=4;entryX=0.374;entryY=0.976;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0.619;exitY=0.022;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="rOxvz-1gei3paqyAHtll-18" target="rOxvz-1gei3paqyAHtll-11" edge="1"> <mxGeometry relative="1" as="geometry"> <mxPoint x="490" y="200" as="targetPoint" /> </mxGeometry> @@ -553,7 +553,7 @@ <mxCell id="rOxvz-1gei3paqyAHtll-40" value="2005" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;" parent="1" vertex="1"> <mxGeometry x="880" y="560" width="120" height="80" as="geometry" /> </mxCell> - <mxCell id="rOxvz-1gei3paqyAHtll-45" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;" parent="1" source="rOxvz-1gei3paqyAHtll-41" target="rOxvz-1gei3paqyAHtll-40" edge="1"> + <mxCell id="rOxvz-1gei3paqyAHtll-45" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;entryX=0.5;entryY=0.947;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="rOxvz-1gei3paqyAHtll-41" target="rOxvz-1gei3paqyAHtll-40" edge="1"> <mxGeometry relative="1" as="geometry" /> </mxCell> <mxCell id="rOxvz-1gei3paqyAHtll-41" value="akili" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1"> @@ -562,6 +562,9 @@ <mxCell id="rOxvz-1gei3paqyAHtll-46" value="2008" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;" parent="1" vertex="1"> <mxGeometry x="560" y="560" width="120" height="80" as="geometry" /> </mxCell> + <mxCell id="eAi0Ebt_qy5pI5aUobQS-5" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;entryX=0.238;entryY=0.083;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="rOxvz-1gei3paqyAHtll-13" target="rOxvz-1gei3paqyAHtll-18"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> </root> </mxGraphModel> </diagram> diff --git a/terraform/dns/dn42.tf b/terraform/dns/dn42.tf index 52a2628..2390d5d 100644 --- a/terraform/dns/dn42.tf +++ b/terraform/dns/dn42.tf @@ -7,13 +7,6 @@ resource "linode_domain_record" "dn42-conflatorio" { target = "fdb1:4242:3538:2008:8042:32ff:fe0c:7161" } -resource "linode_domain_record" "dn42-conflatorio-ix" { - domain_id = linode_domain.root.id - name = "conflatorio-ix.dn42" - record_type = "AAAA" - target = "fdb1:4242:3538:2001::ffff" -} - resource "linode_domain_record" "dn42-coregonus-ix" { domain_id = linode_domain.root.id name = "coregonus-ix.dn42" @@ -28,6 +21,13 @@ resource "linode_domain_record" "dn42-danneri" { target = "fdb1:4242:3538:2005:9422:d355:95b7:f170" } +resource "linode_domain_record" "dn42-hash" { + domain_id = linode_domain.root.id + name = "hash.dn42" + record_type = "AAAA" + target = "fdb1:4242:3538:2009::ffff" +} + resource "linode_domain_record" "dn42-knot" { domain_id = linode_domain.root.id name = "knot.dn42" @@ -48,3 +48,17 @@ resource "linode_domain_record" "dn42-lhn2pi" { record_type = "AAAA" target = "fdb1:4242:3538:2008::ffff" } + +resource "linode_domain_record" "dn42-node1" { + domain_id = linode_domain.root.id + name = "node1.dn42" + record_type = "AAAA" + target = "fdb1:4242:3538:2002::" +} + +resource "linode_domain_record" "dn42-node2" { + domain_id = linode_domain.root.id + name = "node2.dn42" + record_type = "AAAA" + target = "fdb1:4242:3538:2003::" +} diff --git a/terraform/ipam6/ipam6.tf b/terraform/ipam6/ipam6.tf index 88f8181..a41a6be 100644 --- a/terraform/ipam6/ipam6.tf +++ b/terraform/ipam6/ipam6.tf @@ -14,16 +14,11 @@ output "networks" { hosts = { } } - conflatorio_dn42 = { - description = "Internal network on host" - range = "fdb1:4242:3538:2001::/64" - address = "fdb1:4242:3538:2001::" - prefix = "64" + unused_2001 = { + range = "fdb1:4242:3538:2001::/64" + address = "fdb1:4242:3538:2001::" + prefix = "64" hosts = { - conflatorio = { - address : "fdb1:4242:3538:2001::ffff" - prefix : "64" - } } } node1_dn42 = { @@ -31,6 +26,10 @@ output "networks" { address = "fdb1:4242:3538:2002::" prefix = "64" hosts = { + node1 = { + address : "fdb1:4242:3538:2002::" + prefix : "64" + } } } node2_dn42 = { @@ -38,6 +37,10 @@ output "networks" { address = "fdb1:4242:3538:2003::" prefix = "64" hosts = { + node2 = { + address : "fdb1:4242:3538:2003::" + prefix : "64" + } } } knot_dn42 = { @@ -84,10 +87,10 @@ output "networks" { } } } - conflatorio_dn42_2 = { - range = "fdb1:4242:3538:2007:1001::/112" - address = "fdb1:4242:3538:2007:1001::" - prefix = "112" + unused_2007 = { + range = "fdb1:4242:3538:2007::/64" + address = "fdb1:4242:3538:2007::" + prefix = "64" hosts = { } } @@ -106,6 +109,17 @@ output "networks" { } } } + hash_dn42 = { + range = "fdb1:4242:3538:2009::/64" + address = "fdb1:4242:3538:2009::" + prefix = "64" + hosts = { + hash = { + address : "fdb1:4242:3538:2009::ffff" + prefix : "64" + } + } + } dn42 = { range = "fd00::/8" address = "fd00::" @@ -118,8 +132,12 @@ output "networks" { output "hosts" { value = { - conflatorio = { - address : "fdb1:4242:3538:2001::ffff" + node1 = { + address : "fdb1:4242:3538:2002::" + prefix : "64" + } + node2 = { + address : "fdb1:4242:3538:2003::" prefix : "64" } knot = { @@ -146,5 +164,9 @@ output "hosts" { address : "fdb1:4242:3538:2008:8042:32ff:fe0c:7161" prefix : "128" } + hash = { + address : "fdb1:4242:3538:2009::ffff" + prefix : "64" + } } } |