-
Notifications
You must be signed in to change notification settings - Fork 4
Ad Hoc Tasks
- Set up env vars
export AWS_PROFILE=wheredoivote
export ANSIBLE_HOST_KEY_CHECKING=False # Disable 'The authenticity of host X can't be established' prompt
- Set a firewall exception for your IP on port 22 in relevant security groups.
- Replace
fred
with your username - Replace
tag_Env_test
withtag_Env_prod
to run against all production servers instead of all staging servers
ansible -u fred -i dynamic-inventory/ -b --become-user polling_stations tag_Env_test -m shell -a "cd /var/www/polling_stations/code/ && ../env/bin/python manage.py teardown -c X01000001"
ansible -u fred -i dynamic-inventory/ -b --become-user polling_stations tag_Env_test -m shell -a "cd /var/www/polling_stations/code/ && git pull && ../env/bin/python manage.py import_areaname --nochecks"
ansible -u fred -i dynamic-inventory/ -b --become-user every_election tag_Env_test -m shell -a "cd /var/www/every_election/code/ && ../env/bin/python manage.py sync_elections"
ansible -u fred -i dynamic-inventory/ -b --become-user polling_stations tag_Env_test -m shell -a "cd /var/www/polling_stations/code/ && git pull && ../env/bin/python manage.py misc_fixes"
You can also do ansible-playbook -u fred -i dynamic-inventory/ -l tag_Env_test ad_hoc/misc_fixes.yml --extra-vars @vault.yml
but the first option allows you to see the console output (which is useful)
ansible-playbook -u fred -i dynamic-inventory/ -l tag_Env_test ad_hoc/update_councils.yml --extra-vars @vault.yml