Skip to content

Instantly share code, notes, and snippets.

@tomfanning
Created September 12, 2016 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tomfanning/562c14993cc4aabe354f535f18bd143d to your computer and use it in GitHub Desktop.
Save tomfanning/562c14993cc4aabe354f535f18bd143d to your computer and use it in GitHub Desktop.
cloud-init non-cloud static IP
#meta-data:
instance-id: hostname
network-interfaces: |
auto eth0
iface eth0 inet static
address 192.168.1.34
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.254
local-hostname: hostname
#user-data:
#cloud-config
ssh_pwauth: True
users:
- name: root
chpasswd:
list: |
root:p@55w0rd
expire: False
runcmd:
- echo "runcmd started"
- ifdown eth0
- echo "DNS1=8.8.8.8" >> /etc/sysconfig/network-scripts/ifcfg-eth0
- echo "DNS2=8.8.4.4" >> /etc/sysconfig/network-scripts/ifcfg-eth0
- ifup eth0
- echo "runcmd ended"
#script to generate ISO:
genisoimage -output cd.iso -volid cidata -joliet -rock contents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment