automation/ansible/README.md
2020-05-01 15:40:16 +02:00

1.4 KiB

Deployer: deploy your shit and make it run

So lame to have to configure nginx, MySQL, and your filesystem to install a stupid Wordpress instance.

Deployer does my config for me like the slave it is.

All the configuration is defined in group_vars/all/vars.yml, go check.

Create a side group_vars/all/vault.yml for your secrets, and encrypt it with Ansible Vault:

ansible-vault encrypt group_vars/all/vault.yml
# other sub-commands: edit, decrypt...

I usually run the following command:

ansible-playbook --ask-vault-pass sites.yml -i inventory -v

Required packages on remote

Python modules:

  • docker
  • docker-compose
  • pymysql

TODO: Ansible task to install that before the rest

Features

  • Creating Wordpress instances (yoohoo, da best)

    • That send mail!!11!1!

Does not support

  • Setting up the host

  • SSL certificate creation (bro, do it yourself!). That is:

    # Make an nginx file for certbot 
    cat << EOF > /etc/nginx/sites-enabled/yoursite.com
    server {
    	listen 80;
    	server_name www.yoursite.com yoursite.com;
    	include snippets/letsencrypt.conf;
    }
    EOF
    nginx -t # Is everything alright?
    # If so, restart nginx
    service nginx restart 
    # Create the certificate
    certbot certonly --webroot -w /var/www/letsencrypt -d yoursite.com -d www.yoursite.com
    # Remove the stupid file
    rm /etc/nginx/sites-enabled/yoursite.com
    service nginx restart