Repository navigation
Description
I would love to see saltstack network module to be able to create
systemd-networkd files
more information:
http://www.freedesktop.org/software/systemd/man/systemd-networkd.service.html
http://www.freedesktop.org/software/systemd/man/systemd.network.html
http://www.freedesktop.org/software/systemd/man/systemd.netdev.html
http://www.freedesktop.org/software/systemd/man/systemd.link.html
The reason for this module is easy, an unified way to set network interface on all
systemd enabled operating systems, redhat/archlinux/suse/fedora
and in the future: debian
This is my setup on archlinux using a bridge and dhcp failover
The numbering is the order in which systemd-networkd parses the files
/etc/systemd/network:
10-bridge.network
30-bridge.netdev
40-dhcp.network
20-static.network
/etc/systemd/network/10-bridge.network
[Match]
Name=br0
[Network]
Address=xxx.xxx.xxx.xxx/24
Gateway=xxx.xxx.xxx.xxx
/etc/systemd/network/20-static.network
[Match]
MACAddress=xx:xx:xx:xx:xx:xx
Name=xxxxxx
[Network]
Bridge=br0
/etc/systemd/network/30-bridge.netdev
[NetDev]
Name=br0
Kind=bridge
/etc/systemd/network/40-dhcp.network
[Match]
Name=*
[Network]
DHCP=yes
Activity
gtmanfred commentedon May 28, 2014
I use this... I am working on it soonish...
@gtmanfred
aboe76 commentedon May 28, 2014
Ow I would love to test it
aboe76 commentedon Feb 16, 2015
salt has the potential to be able to do it with salt.states.ini_manage
http://docs.saltstack.com/en/latest/ref/states/all/salt.states.ini_manage.html
it only needs to learn about the systemd network/netdev and link files and the options
for network files: http://www.freedesktop.org/software/systemd/man/systemd.network.html
for link files: http://www.freedesktop.org/software/systemd/man/systemd.link.html
fo netdev files: http://www.freedesktop.org/software/systemd/man/systemd.netdev.html
example:
gtmanfred commentedon Feb 16, 2015
That is a good way to do it, but unfortunately doesn't start the networks.
I want to get to it, where we do this by passing an ini_settings.present to
http://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.state.html#salt.modules.state.template_str
Directly in a networkd module to setup the file and then start the networking.
something like that.
eliasp commentedon Mar 22, 2015
After having used
systemd-networkdfor quite some time without Salt on my Gentoo boxes, I started playing a bit with it on CentOS 7 using Salt to handle it:Using the
lnykryn/systemdCOPR repository to get a reasonable systemd-version (CentOS 7 ships the quite outdated208):And then the handling of the actual
systemd-networkdstuff, where the configuration is created based on Pillar data:{% for netservice in ['network', 'NetworkManager'] %} # make sure conflicting services are stopped before systemd-networkd takes over disable-netservice-{{ netservice }}: service.dead: - name: {{ netservice }} - enable: false - require_in: - service: systemd-networkd {% endfor %} # when there are ifcfg-* files left over, they can prevent renaming # of interfaces via *.link files - just wipe the whole network-scripts # directory as it isn't needed anymore and can otherwise be re-created # via network.managed - right? ;) /etc/sysconfig/network-scripts: file.absent: - require_in: - service: systemd-networkd systemd-networkd: service.running: - enable: true - require: - pkgrepo: systemd-copr - pkg: systemd-packages /etc/systemd/network: file.directory: - user: systemd-network - group: systemd-network - mode: '0774' {% set links = salt['pillar.get']('linux:network:links') %} {% if links is defined and links %} {% for link, linkdata in links.iteritems() %} # prefixing the config files with 00- gives them precedence # over global files, such as 99-default.link /etc/systemd/network/00-{{ link }}.link: ini.sections_present: - sections: {{ linkdata|yaml }} - require: - file: /etc/systemd/network - watch_in: - service: systemd-networkd {% endfor %} {% endif %} {% set netdevs = salt['pillar.get']('linux:network:netdevs') %} {% if netdevs is defined and netdevs %} {% for netdev, netdevdata in netdevs.iteritems() %} /etc/systemd/network/00-{{ netdev }}.netdev: ini.sections_present: - sections: {{ netdevdata|yaml }} - require: - file: /etc/systemd/network - watch_in: - service: systemd-networkd {% endfor %} {% endif %} {% set networks = salt['pillar.get']('linux:network:networks') %} {% if networks is defined and networks %} {% for network, networkdata in networks.iteritems() %} /etc/systemd/network/00-{{ network }}.network: ini.sections_present: - sections: {{ networkdata|yaml }} - require: - file: /etc/systemd/network - watch_in: - service: systemd-networkd {% endfor %} {% endif %}The major problem with this approach using the
inistate/module is, thatini.sections_presentcan't handle the weirdness that systemd's INI files are - using non-unique sections (e.g. multiple[Network]per*.networkfile) and non-unique keys (e.g. multipleDNS=).So either the
inistate/module needs to be adapted to allow a non-strict mode where a section/key might have multiple instances or the creation of thesystemd-networkdconfig files needs to be done without using theinistate/module.This all is still rather rough and CentOS7 specific, but maybe it provides some useful information for others to continue with
systemd-networkdsupport.aboe76 commentedon Feb 6, 2016
is this still being worked on?
eliasp commentedon Feb 8, 2016
@aboe76 I didn't continue further than what I described in my previous post and unfortunately won't in the foreseeable future.
alexminder commentedon Oct 7, 2016
Is the feature request is alive?
There are no ways to configure network on new versions fo Linux OSs.
The feature is very usefull.
Today almost every recent Linux host based on systemd and for servers systemd-networkd is prefered network configure tool.
I use self-made workaround based on ini/file states, but it ugly and works bad.
epcim commentedon Jun 5, 2017
@alexminder commented on Oct 7, 2016, 10:42 AM GMT+2:
can you pls share link to your workaround?
personally, systemd network support is desired, it's alternative to network module but it became a mainstream.
question is what way to enforce such support as it may be in conflict with NetworkManager or some other configurations already on a system.
vtolstov commentedon Aug 10, 2017
please share you work, i can take this and may be finish
gtmanfred commentedon Aug 10, 2017
I don't currently have any work on this unfortunately.
alexminder commentedon Aug 11, 2017
My state for systemd-networkd: https://github.com/alexminder/systemd-networkd_saltstack_state
stale commentedon Dec 4, 2018
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
10 remaining items
waynegemmell commentedon May 31, 2021
^ I linked that the incorrect issue.
Lillecarl commentedon Jan 24, 2023
@eliasp @OrangeDog netplan is written in Python, salt would depend on the pip package netplan. Standing on the shoulders of a mature network configuration library rather than building one from scratch sounds sane to me.
There's also ifupdown2 and ifupdown-ng, though salt people would probably prefer YAML.
The fact that netplan doesn't unconfigure things when you apply is an issue, at least on systemd-networkd which I've rendered to. Can be solved with extra logic for unconfiguration.
ifupdown2 unconfigures things it doesn't own anymore (used in CumulusLinux).
dmurphy18 commentedon Jul 11, 2023
Closing this since the original issue was about systemd-network in 2014, and has morphed into a discussion on netplan support. If still interested in this, please open an issue addressing netplan support on Debian / Ubuntu platforms with the current onedir packaging in mind and mark it a 'Feature Request'.
OrangeDog commentedon Jul 12, 2023
Well systemd-networkd is still not supported. The netplan suggestion was just a suggestion of how to implement it. None of this has been completed,
dmurphy18 commentedon Jul 13, 2023
@OrangeDog Given this is almost 10 years old, The OS involved have changed, systemd has been updated, and Python 2 is in the rear-view mirror, I would prefer to have a new issue for systemd-network support on the recent releases and recent OSes than use an almost 10 year old issue to drive the fix. Hmmm! now let me see , did RHEL 5 support systemd ???? :joke:
@aboe76 Are you still interested in a fix for systemd-network support, if so, please open a new request with current OSes and versions of Salt. Apologies for this having dragged on for so long, came across the issue in a cleanup sweep. Re-closing this issue due to its age and information being very out of date.
@OrangeDog If you want to open a new issue for the systemd-network with current OSes and versions of Salt, that would also be good too.
Tag me in the new issue so it gets my attention.
OrangeDog commentedon Jul 13, 2023
Just because it's been ignored for ten years doesn't mean it's changed. None of the information is out of date. All that making a new issue would do is hide the fact that it's taken so very long.
dmurphy18 commentedon Jul 13, 2023
@OrangeDog not hiding the taking so long, just wanting up to date facts, and wheezy is long gone, want what happens on Debian 10 or 11 or 12 etc.
OrangeDog commentedon Jul 13, 2023
Again, there is zero out-of-date information on this ticket.
dmurphy18 commentedon Jul 13, 2023
@OrangeDog Trust but verify lol :)
stappersg commentedon Jul 13, 2023
OrangeDog commentedon Jul 13, 2023
Rather than pointlessly close the ticket and open a new one, why didn't you just ask, or even better verify it yourself?
dmurphy18 commentedon Jul 13, 2023
@OrangeDog Get a new issue with the matters filled out, for example [FEATURE REQUEST] in the title, all the new labels pulled in to manage it, template filled out so searches etc can check on keywords etc. Basically get the issue with all the new templated information so can filter etc., and manage issues / prs etc that an issue from 2014 would not have, but included the ref to the old issue so can go check it out if needed.
Nothing nefarious, just trying to get the issue into a modern format so that tools will work on it.