Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Ad Hoc Tasks

chris48s edited this page Mar 4, 2020 · 1 revision

Before you Start

  • 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.

Tasks

  • Replace fred with your username
  • Replace tag_Env_test with tag_Env_prod to run against all production servers instead of all staging servers

Take down data for one council

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"

Run an ad-hoc import script

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"

Sync elections from EE

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"

Apply misc_fixes

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)

Update council contact details

ansible-playbook -u fred -i dynamic-inventory/ -l tag_Env_test ad_hoc/update_councils.yml --extra-vars @vault.yml