log fix, install.sh fix
This commit is contained in:
parent
ded6d274c6
commit
9b4abd2614
@ -11,8 +11,8 @@
|
|||||||
- name: backup
|
- name: backup
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: >
|
cmd: >
|
||||||
{{ routerbackup_bin }}/routerbackup --difflog --diffprint --logfile {{ routerbackup_log }}
|
{{ routerbackup_bin }}/routerbackup --difflog --diffprint --noerrors
|
||||||
--backupdir {{ routerbackup_dir }} --type {{ devtype }}
|
--logfile {{ routerbackup_log }} --backupdir {{ routerbackup_dir }} --type {{ devtype }}
|
||||||
--host {{ inventory_hostname }} --address {{ ansible_host }} --user {{ ansible_user }}
|
--host {{ inventory_hostname }} --address {{ ansible_host }} --user {{ ansible_user }}
|
||||||
{% if ansible_private_key_file is defined %} --sshkey {{ ansible_private_key_file }}{% endif %}
|
{% if ansible_private_key_file is defined %} --sshkey {{ ansible_private_key_file }}{% endif %}
|
||||||
{% if ansible_ssh_pass is defined %} --password {{ ansible_ssh_pass }}{% endif %}
|
{% if ansible_ssh_pass is defined %} --password {{ ansible_ssh_pass }}{% endif %}
|
||||||
|
|||||||
18
install.sh
18
install.sh
@ -6,19 +6,15 @@ function run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createlink() {
|
function createlink() {
|
||||||
if [[ ! -e $2 ]]; then
|
if [[ -e $2/$3 && ! -h $2/$3 ]]; then
|
||||||
run ln -sr $1 $2
|
echo "WARNING: not overwriting $2/$3: is not a symlink!"
|
||||||
else
|
return
|
||||||
if [[ -h $2 ]]; then
|
|
||||||
run ln -sfr $1 $2
|
|
||||||
else
|
|
||||||
echo "WARNING: not overwriting $2: is not a symlink!"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
run ln -sfr $1 -t $2 $3
|
||||||
}
|
}
|
||||||
|
|
||||||
createlink routerbackup.yml /etc/ansible/routerbackup.yml
|
createlink routerbackup.yml /etc/ansible routerbackup.yml
|
||||||
createlink ansible-role /etc/ansible/roles/routerbackup
|
createlink ansible-role /etc/ansible/roles routerbackup
|
||||||
createlink ansible-routerbackup /etc/ansible/bin/routerbackup
|
createlink ansible-routerbackup-cron /etc/ansible/bin routerbackup-cron
|
||||||
|
|
||||||
# vim: set tabstop=4 shiftwidth=4 expandtab smarttab:
|
# vim: set tabstop=4 shiftwidth=4 expandtab smarttab:
|
||||||
|
|||||||
@ -372,7 +372,10 @@ class AsaConfig(Config):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def setup_logging(hostname, logfile, loglevel):
|
def setup_logging(hostname, logfile, loglevel):
|
||||||
handler = logging.FileHandler(logfile, 'a')
|
if logfile:
|
||||||
|
handler = logging.FileHandler(logfile, 'a')
|
||||||
|
else:
|
||||||
|
handler = logging.StreamHandler()
|
||||||
fmt = logging.Formatter(
|
fmt = logging.Formatter(
|
||||||
"{asctime} "+ hostname +"[{process}] {name}|{levelname} {message}",
|
"{asctime} "+ hostname +"[{process}] {name}|{levelname} {message}",
|
||||||
style='{')
|
style='{')
|
||||||
@ -390,8 +393,7 @@ def setup_logging(hostname, logfile, loglevel):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = get_args()
|
args = get_args()
|
||||||
if args.logfile:
|
setup_logging(args.host, args.logfile, args.loglevel)
|
||||||
setup_logging(args.host, args.logfile, args.loglevel)
|
|
||||||
try:
|
try:
|
||||||
if args.type not in ('routeros', 'ios', 'asa'):
|
if args.type not in ('routeros', 'ios', 'asa'):
|
||||||
raise ValueError(f'Invalid devtype: {args.type}')
|
raise ValueError(f'Invalid devtype: {args.type}')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user