User Tools
development:applications:ansible:deployment-playbooks
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| development:applications:ansible:deployment-playbooks [2017/12/08 17:27] – [Passwords and Vaults] adsilva | development:applications:ansible:deployment-playbooks [2021/06/25 10:09] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Ansible deployment-playbooks ====== | ||
| + | This project covers all the playbooks prepared in order to automate our deployment. These playbooks are made up of re-usable Ansible roles. | ||
| + | |||
| + | Read about [[development: | ||
| + | |||
| + | Anything mentioned below, such as code or file can be found in the https:// | ||
| + | |||
| + | |||
| + | Our current MoP is roughly as mentioned below: | ||
| + | - Prework | ||
| + | - Upgrade Steps | ||
| + | - Shut down applications | ||
| + | - Deploy New Wars | ||
| + | - Grails Config Changes & StartupScript Change | ||
| + | - Startup.sh and Shutdown.sh Changes | ||
| + | - Backup certain tables (to prepare for a rollback) | ||
| + | - Startup CAS | ||
| + | - Apply upgrade scripts & start Apps one by one | ||
| + | - Post Upgrade | ||
| + | - Post Release Testing | ||
| + | - Rollback | ||
| + | |||
| + | At the time of writing this, deployment-playbooks is able to automate the first two steps (Prework and Upgrade Steps) to a certain extent. | ||
| + | |||
| + | An example of ansible commands used during deployment to SFQA is shown below: | ||
| + | |||
| + | |||
| + | <code bash> | ||
| + | #Pull all the ansible-roles | ||
| + | ./ | ||
| + | |||
| + | #upload Artifacts | ||
| + | ansible-playbook -i env/ | ||
| + | |||
| + | #deploy prometheus, startup scripts and shutdown scripts, fix permissions. | ||
| + | ansible-playbook -i env/ | ||
| + | |||
| + | #Shutdown Applications | ||
| + | ansible-playbook -i env/ | ||
| + | |||
| + | #Deploy the war files | ||
| + | ansible-playbook -i env/ | ||
| + | |||
| + | #Backup DB | ||
| + | ansible-playbook -v -i env/ | ||
| + | |||
| + | #Startup CAS | ||
| + | ansible-playbook -i env/ | ||
| + | |||
| + | #Start SNMP | ||
| + | ansible-playbook -i env/ | ||
| + | |||
| + | ansible-playbook -i env/ | ||
| + | ansible-playbook -i env/ | ||
| + | ansible-playbook -i env/ | ||
| + | ansible-playbook -i env/ | ||
| + | |||
| + | </ | ||
| + | |||
| + | As we can see above, every command requires two files: | ||
| + | - The host file | ||
| + | - The playbook YML file | ||
| + | |||
| + | The //hosts// file stores the IP address of every server for an environment(Crown-QA, | ||
| + | |||
| + | The //hosts// file when loaded will automatically load the file // | ||
| + | |||
| + | The playbook YML file contains the actual steps/ | ||
| + | |||
| + | Playbooks can be limited to specific hosts using the --limit=apps1/ | ||
| + | |||
| + | ====== Passwords and Vaults ====== | ||
| + | |||
| + | Update: Use the newer ./ | ||
| + | I have added a video tutorial for it as well in our share Dropbox: https:// | ||
| + | |||
| + | |||
| + | The passwords within the file // | ||
| + | - To ensure no server password is part of a VCS | ||
| + | - To avoid someone running the command by mistake. | ||
| + | |||
| + | The passwords are encrypted in the following manner: | ||
| + | |||
| + | Create a file called sfqa with the text: #sfqa!# (which is the master password) | ||
| + | |||
| + | < | ||
| + | ansible-vault encrypt_string --vault-id sfqa '< | ||
| + | |||
| + | Result: | ||
| + | |||
| + | ssh_pass: !vault | | ||
| + | $ANSIBLE_VAULT; | ||
| + | 62313365396662343061393464336163383764373764613633653634306231386433626436623361 | ||
| + | 6134333665353966363534333632666535333761666131620a663537646436643839616531643561 | ||
| + | 63396265333966386166373632626539326166353965363262633030333630313338646335303630 | ||
| + | 3438626666666137650a353638643435666633633964366338633066623234616432373231333331 | ||
| + | 6564 | ||
| + | </ | ||
| + | |||
| + | A master-password is expected to decrypt the passwords required to connect to any given server. | ||
| + | |||
| + | This master-password will be same as the environment name. if the environment name is //ABCQA// then the password will be //# | ||