Make copy of file and copy to Server
Jump to navigation
Jump to search
sb222.sh
#!/bin/bash clear echo -e " +++++ Making a backup copy of sql file in the web folder ++++++++++++++++ \n" ansible-playbook /etc/ansible/playbook/backupsqlfirst.yml sleep 5 echo -e "++++++++++ Copying to local web folder ++++++++++++++ \n" ansible-playbook /etc/ansible/playbook/cplocal.yml sleep 5 ansible-playbook /etc/ansible/playbook/copytorb222.yml --private-key ~/.ssh/ansible echo "+++++ Done ++++++"
backupsqlfirst.yml
--- - name: make backup copy of sql file hosts: localhost tasks: - name: make a backup copy of sqlite file copy: src: /mnt/c/Users/sales/Dropbox (Personal)/All Folders/websites/msites/sb222/datab/sqLite_karaoke.sql dest: /mnt/c/Users/sales/Dropbox (Personal)/All Folders/websites/msites/sb222/datab/sqLite_karaoke_backup.sql
cplocal.yml
--- - name: copy for db to web folder hosts: localhost tasks: - name: copy file sql file to local webfolder copy: src: /mnt/c/Users/sales/Dropbox (Personal)/Filing Cabinet/Stuff/sqlitedb/sqLite_karaoke.sql dest: /mnt/c/Users/sales/Dropbox (Personal)/All Folders/websites/msites/rb222/database/
copytosb222.yml
The host file contains the website info
--- - name: copy file to mywebsite hosts: msites tasks: - name: copy file copy: src: /mnt/c/Users/sales/Dropbox (Personal)/Filing Cabinet/Stuff/sqlitedb/sqLite_karaoke.sql dest: /var/www/html/sb222/database/
hosts
rasberry ansible_ssh_host=192.168.21.6 [synology] 192.168.20.1 [mac] 192.168.20.11 [opilocal] 10.21.22.40 [client] 10.1.91.46 [msites] 10.14.25.23 [webserver] server1 ansible_ssh_host=10.16.21.22 [fileserver] server2 ansible_ssh_host=10.25.29.9 # This is the default ansible 'hosts' file. # # It should live in /etc/ansible/hosts # # - Comments begin with the '#' character # - Blank lines are ignored # - Groups of hosts are delimited by [header] elements # - You can enter hostnames or ip addresses # - A hostname/ip can be a member of multiple groups # Ex 1: Ungrouped hosts, specify before any group headers: ## green.example.com ## blue.example.com ## 192.168.100.1 ## 192.168.100.10 # Ex 2: A collection of hosts belonging to the 'webservers' group: ## [webservers] ## alpha.example.org ## beta.example.org ## 192.168.1.100 ## 192.168.1.110 # If you have multiple hosts following a pattern, you can specify # them like this: ## www[001:006].example.com # Ex 3: A collection of database servers in the 'dbservers' group: ## [dbservers] ## ## db01.intranet.mydomain.net ## db02.intranet.mydomain.net ## 10.25.1.56 ## 10.25.1.57 # Here's another example of host ranges, this time there are no # leading 0s: ## db-[99:101]-node.example.com