Ubuntu Pastebin

Paste from smoser at Thu, 21 Sep 2017 19:45:06 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
$ cat my.yaml
network:
  version: 1
  config:
  - type: physical
    name: eth0
    mac_address:
    subnets:
      - control: auto
        type: static
        address: {{ item.ip_address }}
        gateway: {{ item.gateway }}
        dns_nameservers:
          - 8.8.8.8
          - 8.8.4.4

$ PYTHONPATH=$PWD ./tools/net-convert.py  \
   --network-data=my.yaml --kind=yaml --output-kind=eni --directory=my.d

$ find my.d -type f
my.d/etc/network/interfaces
my.d/etc/udev/rules.d/70-persistent-net.rules

$ cat my.d/etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 192.168.1.2/24
    dns-nameservers 8.8.8.8 8.8.4.4
    gateway 192.168.1.1


$ rm -Rf my.d
$ PYTHONPATH=$PWD ./tools/net-convert.py --network-data=my.yaml \
   --kind=yaml --output-kind=sysconfig --directory=my.d

$ find my.d/ -type f
my.d/etc/resolv.conf
my.d/etc/sysconfig/network-scripts/ifcfg-eth0
my.d/etc/sysconfig/network
my.d/etc/udev/rules.d/70-persistent-net.rules

$ cat my.d/etc/sysconfig/network-scripts/ifcfg-eth0
# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
GATEWAY=192.168.1.1
IPADDR=192.168.1.2
NETMASK=255.255.255.0
NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
Download as text