Show the estimated chance of rain and estimated amount in a graph. The graph is hosted on a DigitalOcean droplet configured with an ansible playbook. The website is used to determine rain gear required before heading out to bike.
Uses AerisWeather API. Secret API key is in ansible vars. You'll need to setup a testing account with them and update the values to use this.
Runs lighttpd to serve one image of a graph (.png). The image is generated by the python script using the matplotlib module.
doctl compute droplet create <name_for_machine> --size s-1vcpu-1gb --region sfo2 --image ubuntu-18-04-x64 --ssh-keys <fingerprint_of_pub_key>
Ansbile setups the machine, updates all packages, installs the http server. The python script is created in /etc/cron.hourly.
ansible-playbook -vvv -i $(doctl compute droplet list --format PublicIPv4 --no-header), playbook.yml -u root --ask-vault-pass
Johns-MacBook-Pro:howrainy john$ doctl compute droplet create weather-jlehne --size s-1vcpu-1gb --region sfo2 --image ubuntu-18-04-x64 --ssh-keys 8b:7c:e3:e4:6a:63:6c:ed:17:2f:b1:ac:2c:9a:ca:43
ID Name Public IPv4 Private IPv4 Public IPv6 Memory VCPUs Disk Region Image Status Tags Features Volumes
181888352 weather-jlehne 1024 1 25 sfo2 Ubuntu 18.04.3 (LTS) x64 new
Johns-MacBook-Pro:howrainy john$ doctl compute droplet list
ID Name Public IPv4 Private IPv4 Public IPv6 Memory VCPUs Disk Region Image Status Tags Features Volumes
181888352 weather-jlehne 167.172.198.10 1024 1 25 sfo2 Ubuntu 18.04.3 (LTS) x64 active
Johns-MacBook-Pro:howrainy john$ ansible-playbook -i $(doctl compute droplet list --format PublicIPv4 --no-header), playbook.yml -u root --ask-vault-pass
Vault password:
PLAY [all] ******************************************************************************************************************************************************************************************************
TASK [Gathering Facts] ******************************************************************************************************************************************************************************************
The authenticity of host '167.172.198.10 (167.172.198.10)' can't be established.
ECDSA key fingerprint is SHA256:5DAt+uZKhODh0pvcOZDOfSsGj8MbIGJj6YpXR9qtxNw.
Are you sure you want to continue connecting (yes/no)? yes
ok: [167.172.198.10]
TASK [Install Prerequisites] ************************************************************************************************************************************************************************************
changed: [167.172.198.10]
TASK [Make sure we have a 'wheel' group] ************************************************************************************************************************************************************************
changed: [167.172.198.10]
TASK [Allow 'wheel' group to have passwordless sudo] ************************************************************************************************************************************************************
changed: [167.172.198.10]
TASK [Create a new regular user with sudo privileges] ***********************************************************************************************************************************************************
changed: [167.172.198.10]
TASK [Set authorized key for remote user] ***********************************************************************************************************************************************************************
changed: [167.172.198.10]
TASK [Disable password authentication for root] *****************************************************************************************************************************************************************
changed: [167.172.198.10]
TASK [Upgrade all packages to the latest version] ***************************************************************************************************************************************************************
changed: [167.172.198.10]
TASK [Update apt] ***********************************************************************************************************************************************************************************************
changed: [167.172.198.10]
TASK [Install required system packages] *************************************************************************************************************************************************************************
changed: [167.172.198.10]
TASK [Install pip for python3] **********************************************************************************************************************************************************************************
changed: [167.172.198.10]
TASK [Remove lighttpd default index] ****************************************************************************************************************************************************************************
changed: [167.172.198.10]
TASK [Create Website] *******************************************************************************************************************************************************************************************
changed: [167.172.198.10]
TASK [Copy weather script] **************************************************************************************************************************************************************************************
changed: [167.172.198.10]
TASK [Run weather program] **************************************************************************************************************************************************************************************
changed: [167.172.198.10]
TASK [UFW - Allow SSH connections] ******************************************************************************************************************************************************************************
changed: [167.172.198.10]
TASK [UFW - Allow http connections] *****************************************************************************************************************************************************************************
changed: [167.172.198.10]
TASK [UFW - Deny all other incoming traffic by default] *********************************************************************************************************************************************************
changed: [167.172.198.10]
TASK [Reboot machine after updates were installed] **************************************************************************************************************************************************************
changed: [167.172.198.10]
PLAY RECAP ******************************************************************************************************************************************************************************************************
167.172.198.10 : ok=19 changed=18 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Johns-MacBook-Pro:howrainy john$