Difference between revisions of "Make copy of file and copy to Server"

From rbachwiki
Jump to navigation Jump to search
Line 36: Line 36:
       src: /mnt/c/Users/bacchas/Dropbox (Personal)/Filing Cabinet/Karaoke Stuff/sqlitedb/sqLite_karaoke.sql
       src: /mnt/c/Users/bacchas/Dropbox (Personal)/Filing Cabinet/Karaoke Stuff/sqlitedb/sqLite_karaoke.sql
       dest: /mnt/c/Users/bacchas/Dropbox (Personal)/All Folders/websites/linode_msites/rb222/database/
       dest: /mnt/c/Users/bacchas/Dropbox (Personal)/All Folders/websites/linode_msites/rb222/database/
</pre>
<h4 class="bluebackground">copytorb222.yml</h4>
<pre>
---
- name: copy file to rb222
  hosts: msites
  tasks:
    - name: copy file
      copy:
      src: /mnt/c/Users/bacchas/Dropbox (Personal)/Filing Cabinet/Karaoke Stuff/sqlitedb/sqLite_karaoke.sql
      dest: /var/www/html/rb222/database/
</pre>
</pre>

Revision as of 15:37, 15 June 2023

#!/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/linode_msites/sb222/datab/sqLite_karaoke.sql
        dest: /mnt/c/Users/sales/Dropbox (Personal)/All Folders/websites/linode_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/bacchas/Dropbox (Personal)/Filing Cabinet/Karaoke Stuff/sqlitedb/sqLite_karaoke.sql
       dest: /mnt/c/Users/bacchas/Dropbox (Personal)/All Folders/websites/linode_msites/rb222/database/

copytorb222.yml

---
- name: copy file to rb222
  hosts: msites

  tasks:
    - name: copy file
      copy:
       src: /mnt/c/Users/bacchas/Dropbox (Personal)/Filing Cabinet/Karaoke Stuff/sqlitedb/sqLite_karaoke.sql
       dest: /var/www/html/rb222/database/