Advertisement
Guest User

Untitled

a guest
Jan 29th, 2014
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. scripts:
  2. - &hostname_config |
  3. #!/bin/sh
  4. sed -i 's/127.0.1.1.*//' /etc/hosts
  5. fqdn=`curl -H "X-Google-Metadata-Request: True" "http://metadata/computeMetadata/v1/instance/attributes/host_fqdn"`
  6. host=`echo $h | cut -d "." -f1`
  7. ipaddr=`ip addr show eth0 | grep "inet " | awk '{print $2}' | cut -d "/" -f1`
  8. echo $ipaddr $fqdn $host >> /etc/hosts
  9. hostname $host
  10.  
  11. runcmd:
  12. - [ sh, -c, *hostname_config ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement