This is an Ansible playbook used for managing my website www.antonioalaniz.com. This was tested against Ubuntu 16.04 (Xenial) using Vagrant and pushed live to DigitalOcean.
provision.yml
: Updates theapt
repo and installs Python2setup-vagrant.yml
: Creates a non-root user and group, elevates sudo permissions, allows passwordless sudo. These tasks are also available in thecommon-vagrant
role listed belowdev-deploy.yml
andlive-deploy.yml
: installs pelican, nginx, sets up firewall rules for live and development machinesdev-update-blog.yml
andlive-update-blog.yml
: deletes and re-installs the blogs to update new entries. This playbook does not perform the thecommon-vagrant
,pelican-nginx
,ansible-nginx
andwtanaka.certbot
roles.
These playbooks utilize the following roles:
ansible-ufw
: closes the firewall and allows only theaccess_ports
listed in the variables belowcommon-vagrant
: a series of common tasks to set up the Vagrant environment for testingpelican-nginx
: a role for setting up Pelican to work with nginxpelican-vagrant
: adds Pelican to a Vagrant or live Digitalocean dropletwtanaka.certbot
: a role by Wesley Tanaka that automates letsencrypt certificate generation
home_dir
: home directory for the non-root userpelican_env
: directory where virtualenv is installedpelican_themes
: location of pelican themes to be installedweb_root
: /var/www/antonioalaniz.comblog_repo
: https://github.com/talaniz/antonioalaniz.com.gitnginx
: location of nginxblog_template_dir
: location of the blog template in `{{pelican_themes}}``files_dir
: directory containing all files to be copied to the remote machinetemplates_dir
: directory containing all templates to be copieddomain
: website domain (ex. antonioalaniz.com)www_domain
: domain with www added (ex. www.antonioalaniz.com)access_ports
: ports to be opened on the firewallssh_port
: port to connect to the remote machine via sshemail
: an email address to be used to generate certifications (dev only)ssl_cert
: location letsencrypt generates the ssl certificate--/etc/letsencrypt/live/{{www_domain}}/fullchain.pemssl_cert_key
: location letsencrypt generates the ssl certificate /etc/letsencrypt/live/{{domain}}/privkey.pemletsencrypt_email
: an email address to be used to generate certifications (live only)letsencrypt_webroot
: location of web root for letsencrypt to generate certletsencrypt_fake_key
: If set to true (dev only), the letsencrypt role will copy fake pem files instead of generating a certificateletsencrypt_renew_by_default
: option to renew letsencrypt certificatesletsencrypt_domains
: domains letsencrypt will use to generate certificatesgoogle_analytics
: Google Analytics ID to use for tracking
- Clone the repository: git clone https://github.com/talaniz/ansible-pelican.git
- Install requirements: pip install -r requirements.txt
- Create a variables file and populate the variables above
- Install roles: mkdir roles && cd roles, then clone/install roles--
- git clone https://github.com/talaniz/common-vagrant.git
- git clone https://github.com/talaniz/ansible-ufw.git
- git clone https://github.com/talaniz/pelican-nginx.git
- ansible-galaxy install wtanaka.certbot
- Use the
Vagrantfile
to create the virtual environment: vagrant up - Run the
dev-deploy.yml
file: ansible-playbook playbooks/dev-deploy.yml
- Clean up
files
andtemplates
to only include used files (some included for development)