mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-19 21:41:05 +02:00
Merge pull request #730 from crawford/teeth
coreos-base/oem-rackspace-teeth: Add support for network
This commit is contained in:
commit
62460afb6f
@ -1,23 +1,62 @@
|
|||||||
#cloud-config
|
#cloud-config
|
||||||
|
|
||||||
write_files:
|
write_files:
|
||||||
- path: /run/systemd/system/user-configdrive.service.d/netconf.conf
|
- path: /run/udev/rules.d/79-netname.rules
|
||||||
permissions: 0644
|
permissions: 444
|
||||||
|
content: |
|
||||||
|
SUBSYSTEM!="net", GOTO="netname_end"
|
||||||
|
ACTION!="add", GOTO="netname_end"
|
||||||
|
ENV{ID_BUS}!="pci", GOTO="netname_end"
|
||||||
|
|
||||||
|
IMPORT{program}="/usr/share/oem/bin/netname.sh $env{IFINDEX}"
|
||||||
|
|
||||||
|
NAME=="", ENV{ID_NET_NAME_SIMPLE}!="", NAME="$env{ID_NET_NAME_SIMPLE}"
|
||||||
|
|
||||||
|
LABEL="netname_end"
|
||||||
|
|
||||||
|
coreos:
|
||||||
|
units:
|
||||||
|
- name: user-configdrive.service.d/netconf.conf
|
||||||
|
runtime: yes
|
||||||
content: |
|
content: |
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=
|
ExecStart=
|
||||||
ExecStart=/usr/bin/coreos-cloudinit --from-configdrive=/media/configdrive --convert-netconf=debian
|
ExecStart=/usr/bin/coreos-cloudinit --from-configdrive=/media/configdrive --convert-netconf=debian
|
||||||
|
- name: ping-out.service
|
||||||
|
runtime: yes
|
||||||
|
enable: yes
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
After=user-config.target
|
||||||
|
|
||||||
coreos:
|
[Service]
|
||||||
units:
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/usr/bin/sh -c "ping -A -c1 $(ip route | awk '/default/ { print $3 }')"
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=user-config.target
|
||||||
|
- name: rename-network-interfaces.service
|
||||||
|
command: start
|
||||||
|
runtime: yes
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
Before=user-config.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/usr/bin/systemctl stop systemd-networkd
|
||||||
|
ExecStart=/usr/bin/bash -c "for dev in $(ip link show | gawk -F ':' '/^[0-9]+/ { print $2 }' | tr -d ' ' | sed 's/lo//'); do ip link set $dev down; done"
|
||||||
|
ExecStart=/usr/bin/bash -c "udevadm test /sys/class/net/*"
|
||||||
|
ExecStart=/usr/bin/systemctl start systemd-networkd
|
||||||
- name: media-configdrive.mount
|
- name: media-configdrive.mount
|
||||||
command: start
|
command: start
|
||||||
runtime: yes
|
runtime: yes
|
||||||
content: |
|
content: |
|
||||||
[Unit]
|
[Unit]
|
||||||
DefaultDependencies=no
|
Wants=user-configdrive.service
|
||||||
Conflicts=umount.target
|
Before=user-configdrive.service
|
||||||
Before=local-fs.target umount.target
|
|
||||||
|
|
||||||
[Mount]
|
[Mount]
|
||||||
What=/dev/disk/by-label/config-2
|
What=/dev/disk/by-label/config-2
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
IFINDEX=$1
|
||||||
|
echo "ID_NET_NAME_SIMPLE=eth$((${IFINDEX} - 2))"
|
@ -15,6 +15,9 @@ KEYWORDS="amd64 x86"
|
|||||||
S="${WORKDIR}"
|
S="${WORKDIR}"
|
||||||
|
|
||||||
src_install() {
|
src_install() {
|
||||||
|
into "/usr/share/oem"
|
||||||
|
dobin ${FILESDIR}/netname.sh
|
||||||
|
|
||||||
insinto "/usr/share/oem"
|
insinto "/usr/share/oem"
|
||||||
doins ${FILESDIR}/cloud-config.yml
|
doins ${FILESDIR}/cloud-config.yml
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user