~mark-mims/+junk/ensemble-mysql

« back to all changes in this revision

Viewing changes to hooks/master-relation-changed

  • Committer: Clint Byrum
  • Date: 2011-06-15 23:56:23 UTC
  • Revision ID: clint@ubuntu.com-20110615235623-xxr6uokyyic0b1oj
removing ifconfig hacks from all but munin formulas/hooks

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
fi
34
34
chown -v -R www-data.www-data /var/www
35
35
 
36
 
remote_ip=`relation-get ip`
37
 
test -n "$remote_ip" || exit 1
38
 
local_ip=`ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'|head -n 1`
 
36
remote_host=`relation-get hostnae`
 
37
test -n "$remote_host" || exit 1
 
38
remote_ip=`dig +short $remote_host`
39
39
pass=`pwgen -s 16`
40
40
augtool -b <<EOF
41
41
defvar webroot /files/etc/apache2/sites-available/default/VirtualHost/Directory[2]
42
42
set \$webroot/directive[last()+1] allow
43
43
set \$webroot/directive[last()]/arg[1] from
44
 
set \$webroot/directive[last()]/arg[2] $remote_ip/32
 
44
set \$webroot/directive[last()]/arg[2] $remote_ip
45
45
save
46
46
EOF
47
47
service apache2 reload
49
49
relation-set dumpurl=/snaps/$name \
50
50
                     user=$ENSEMBLE_REMOTE_UNIT \
51
51
                     password=$pass \
52
 
                     ip=$local_ip \
 
52
                     hostname=`hostname -f` \
53
53
                     port=3306