Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEV] Create a plugin that populates host information for use with jinja templates #16

Open
alexlovelltroy opened this issue Oct 2, 2024 · 9 comments · May be fixed by #18
Open

[DEV] Create a plugin that populates host information for use with jinja templates #16

alexlovelltroy opened this issue Oct 2, 2024 · 9 comments · May be fixed by #18
Assignees

Comments

@alexlovelltroy
Copy link
Member

This task is to get us enough information to generate host-specific files.

example :

hostnames:
interfaces:
  - eth0
     name:
     mac: 
     ip:
     desc:
     netmask:
     hostnames:
  - eth1
     name:
     mac: 
     ip:
     description:
     netmask:
     hostnames:
  - eth2
     name:
     mac: 
     ip:
     description:
     netmask:
     hostnames:
@alexlovelltroy
Copy link
Member Author

Let's be sure to validate the yaml structure in the comments here as well.

@alexlovelltroy
Copy link
Member Author

Adding different network types to SMD may be necessary to get enough information for this plugin.

@alexlovelltroy
Copy link
Member Author

@travisbcotton can you add a jinja template here that you would like to use?

@travisbcotton
Copy link

ospfd.conf example:

password testpass123
enable password testpass123

interface {{ host.internal_interface }}
    no ip ospf authentication-key
    ip ospf dead-interval 40
    ip ospf hello-interval 10
    ip ospf priority 0

interface {{ host.external_interface }}
    no ip ospf authentication-key
    ip ospf priority 0
    ip ospf dead-interval 40
    ip ospf hello-interval 10
    ip ospf retransmit-interval 5
    ip ospf transmit-delay 1

router ospf
    ospf router-id {{ host.external_ip }}
    network {{ host.external_subnet }} area 0.0.0.15
    network {{ host.internal_subnet }} area 0.0.0.15
    area 0.0.0.15 stub no-summary

@travisbcotton
Copy link

zebra.conf example:

hostname {{ host.name }}
password testpass123
enable password testpass123

interface lo
  description loopback

interface {{ host.internal_interface }}
  description internal Infiniband
  ip address {{ host.internal_ip }}/{{ host.internal_netmask }}

interface {{ host.external_interface }}
  description external Ethernet
  ip address {{ host.external_ip }}/{{ host.external_netmask }}

@davidallendj
Copy link
Collaborator

Quick questions:

  • Is the {{ host.external_interface }} and {{ host.internal_interface }} just expecting the interface name?
  • Is the /{{ host.external_netmask }} in CIDR notation? I'm guessing that whenever you're getting the IP, it's just the IP by itself.

@travisbcotton
Copy link

For the first one, yeah that would be the interface name. Which I don't think is available in SMD at /Inventory/EthernetInteraces. Could make the interface names just be a part of the templates, but that would reduce their portability

The second one is the /24 or whatever notation. At least for these templates. Which is also not something inherit in SMD. But appears you can add IPAddresses with the form 192.168.1.1/24 to /Inventory/EthernetInteraces, but that may have an effect on other applications reading those endpoints

@davidallendj
Copy link
Collaborator

I was under the impression that the ID was supposed to be the interface name, but I guess not.

That may be the way to go with the IP address since I don't see the net mask stored anywhere. We can try storing the IP addresses in CIDR notation and see if anything breaks.

@davidallendj
Copy link
Collaborator

davidallendj commented Oct 3, 2024

Also, should we expect more than one internal and/or external interface?

@davidallendj davidallendj linked a pull request Oct 9, 2024 that will close this issue
@davidallendj davidallendj linked a pull request Oct 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants