routeros: Move sw-backup script to role
This commit is contained in:
parent
fd6b5542d9
commit
7f7abc0ee7
3 changed files with 19 additions and 11 deletions
|
@ -180,14 +180,3 @@
|
|||
mode: "0755"
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
|
||||
- name: Create sw-backup script
|
||||
ansible.builtin.copy:
|
||||
dest: /usr/local/bin/sw-backup
|
||||
content: |
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
ssh "admin@${1}" /export > "/srv/backup/${1}.rsc"
|
||||
mode: "0755"
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
|
|
11
roles/routeros/files/sw-backup.sh
Executable file
11
roles/routeros/files/sw-backup.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
umask 022
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $(basename "$0") <hostname>" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ssh "admin@${1}" /export > "/srv/backup/${1}.rsc"
|
|
@ -101,3 +101,11 @@
|
|||
mode: "0644"
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
|
||||
- name: Copy sw-backup script
|
||||
ansible.builtin.copy:
|
||||
dest: /usr/local/bin/sw-backup
|
||||
src: sw-backup.sh
|
||||
mode: "0755"
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue