Project

General

Profile

Ansible cheat sheet » History » Revision 3

Revision 2 (Jon Goldberg, 04/19/2021 08:45 PM) → Revision 3/25 (Irene Meisel, 04/20/2021 08:13 PM)

{{last_updated_at}} by {{last_updated_by}} 

 # Ansible cheat sheet 

 This page will cover some helpful one-line commands we can execute with Ansible to accomplish various tasks. Always run **git pull** and **git submodule update** before executing these commands. 

 Roll back a site to the latest commit (e.g. after a failed merge): 
 ```shell 
 ansible --become -m shell -a 'cd {{civiroot}} && git clean -fdx {{civiroot}} && get reset --hard HEAD'    mysite1.local,mysite2.local 
 ``` 

 Synchronize a non-canonical site with the live site's database 
 ``` 
 ansible-playbook main-playbook.yml --tags site-db-sync -l mysite.local  
 ``` 
 * This works on test and live sites. 
 * Depending on the sync strategy on the website inventory, it will pull from last night's backup, or sync directly from the live site. 
 * Only sites that pull from backup can sync to a site that's not on your local machine at present (I'll fix this at some point).