You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# new host to use
NEW_HOSTNAME="staging.mysite.com"# grab old host to replace
OLD_HOSTNAME=$(hostname)# hostname change to apply before restart
sudo hostname $NEW_HOSTNAME# hostname change to apply after restartecho$NEW_HOSTNAME| sudo tee /etc/hostname
# replace any uses of old in /etc/hosts
sudo sed -i "s/${OLD_HOSTNAME}/${NEW_HOSTNAME}/g" /etc/hosts
Looking into this, and maybe a stupid question: I know we have a ${domain} global var available in the ansible tasks...do we have any way to see what stage we're running under? (eg, to get the full hostname we're wanting to set)
Activity
EvanK commentedon Oct 29, 2013
In bash, this would be fairly simple:
Should translate easily enough to ansible...?
EvanK commentedon Oct 29, 2013
Looking into this, and maybe a stupid question: I know we have a
${domain}global var available in the ansible tasks...do we have any way to see what stage we're running under? (eg, to get the full hostname we're wanting to set)EvanK commentedon Oct 30, 2013
Good news: we can eventually replace much of whatever we do for this with ansible/ansible#3940
Update: that PR was merged and looks like it will be part of ansible's next 1.4.* release