Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goliatone/c78938e923e782c8f770e1edb3080b1e to your computer and use it in GitHub Desktop.
Save goliatone/c78938e923e782c8f770e1edb3080b1e 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