Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N
#!/bin/bash
DOW=$(/usr/bin/date +%u)
((DOW--))
echo Restoring weekday: $DOW
ALLF={{ hostvars[original_host_alias]['ansible_host']}}_ALL_$DOW.tar.gz
cd /var/log/astguiclient/archive/
/bin/tar xvfz $ALLF
/usr/bin/mv /var/log/astguiclient/archive/var/log/astguiclient/archive/temp/{{ hostvars[original_host_alias]['ansible_host']}}* /
cd /
/usr/bin/rm -rf /var/log/astguiclient/archive/var/
/bin/tar xvf /{{ hostvars[original_host_alias]['ansible_host']}}_VOICEMAIL_$DOW.tar
/bin/tar xvf /{{ hostvars[original_host_alias]['ansible_host']}}_CONF_$DOW.tar
/bin/tar xvf /{{ hostvars[original_host_alias]['ansible_host']}}_BIN_$DOW.tar
/bin/tar xvf /{{ hostvars[original_host_alias]['ansible_host']}}_LINUX_$DOW.tar
/bin/tar xvf /{{ hostvars[original_host_alias]['ansible_host']}}_SOUNDS_$DOW.tar
/usr/bin/gunzip -f /{{ hostvars[original_host_alias]['ansible_host']}}asterisk$DOW.gz
/usr/bin/mysql -uroot asterisk < /{{ hostvars[original_host_alias]['ansible_host']}}asterisk$DOW
rm -rf /{{ hostvars[original_host_alias]['ansible_host']}}*
/usr/bin/sed -i 's/{{ backup_host_external_ip }}/{{ restore_host_external_ip }}/g' /etc/asterisk/sip.conf
# update ip address
/usr/bin/perl /usr/share/astguiclient/ADMIN_update_server_ip.pl --old-server_ip={{ hostvars[original_host_alias]['ansible_host']}} --server_ip={{ hostvars[restore_host_alias]['ansible_host']}} --auto
# update carrier data
/usr/bin/mysql -uroot <<EOF
UPDATE asterisk.vicidial_server_carriers SET account_entry = "[twac]
type=peer
secret={{ tw_secret }}
username={{ tw_user }}
host={{ pstn_host }}
dtmfmode=rfc2833
canreinvite=no
disallow=all
allow=ulaw
insecure=port,invite
fromuser={{ tw_fromuser }}
fromdomain={{ pstn_host }}
context=trunkinbound-dynamic"
where carrier_id = 'TW1';
EOF
# update system settings
/usr/bin/mysql -uroot <<EOF
UPDATE asterisk.system_settings SET sounds_web_server = '{{ hostvars[restore_host_alias]['ansible_host']}}';
UPDATE asterisk.system_settings SET active_voicemail_server = '{{ hostvars[restore_host_alias]['ansible_host']}}';
UPDATE asterisk.servers SET external_server_ip = '{{ restore_host_external_ip }}' WHERE server_id = 'vicibox8';
EOF
# Reload asterisk
/usr/sbin/asterisk -x reload
Care to share your ansible deployment scripting?
cd /usr/src/astguiclient/trunk/
svn update -r 2872
perl install.pl --help
Users browsing this forum: Bing [Bot] and 93 guests