Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. cloud-init config:
  2. #cloud-config
  3. hostname: vpn-pritunl-clientvpn-01
  4. fqdn: vpn-pritunl-clientvpn-01.inf.us-west-2.aws.acme.com
  5.  
  6. mounts:
  7. - [ephemeral0, null]
  8.  
  9. runcmd:
  10. - /usr/local/sbin/set-hostname vpn-pritunl-clientvpn-01.inf.us-west-2.aws.acme.com vpn-pritunl-clientvpn-01
  11. - /usr/local/sbin/enable-salt-minion
  12.  
  13.  
  14. set-hostname:
  15. #!/bin/bash
  16.  
  17. HOSTNAME=$1
  18. SHORTNAME=$2
  19.  
  20. INTERNAL_IPADDRESS=`ip addr show eth0 | grep 'inet ' | awk '{ print $2 }' | cut -f1 -d/`
  21.  
  22. echo >> /etc/hosts
  23. echo "$INTERNAL_IPADDRESS $HOSTNAME $SHORTNAME" >> /etc/hosts
  24. echo "$HOSTNAME" > /etc/hostname
  25. hostname $HOSTNAME
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement