Installs and configures a Laravel and MariaDB droplet on DigitalOcean using Ansible playbooks.
Install passlib
for hashing the admin user password.
$ python -m pip install passlib --user
See geerlingguy.swap for more info.
See geerlingguy.mysql for more info.
See geerlingguy.redis for more info.
See geerlingguy.php for more info.
See geerlingguy.composer for more info.
Uses version lts/carbon
.
See geerlingguy.nodejs for more info.
Nginx details are stored in vars/web.yml
and web.yml
.
See geerlingguy.nginx for more info.
See geerlingguy.certbot for more info.
Review web.yml to see how Laravel is deployed based on the vars in group_vars/all.yml
and vars/web.yml
.
- mysql (MariaDB)
---
- name: Setup a preconfigured Laravel and MySQL droplet on DigitalOcean
role:
- stedding
Clone the project
$ git clone https://github.com/cwilby/ansible-role-laravel-do
Create a vault using ansible-vault and enter secret values.
$ EDITOR=nano ansible-vault create group_vars/vault.yml
---
vault_app_name: acme
vault_app_tld: .com
vault_app_repo_url: https://github.com/laravel/laravel.git # your repo here
vault_app_repo_branch: master
vault_upassword: changeme
vault_github_token: <https://github.com/settings/tokens>
vault_do_api_token: <https://cloud.digitalocean.com/account/api/tokens>
vault_web_droplet_ssh_pk: <https://cloud.digitalocean.com/account/security#keys>
vault_db_droplet_ssh_pk: <https://cloud.digitalocean.com/account/security#keys>
vault_github_keys: https://github.com/<yourusername>.keys
vault_web_droplet_region: sfo2
vault_db_droplet_region: sfo2
Install ansible-galaxy dependencies.
$ ansible-galaxy install -r requirements.yml
Finally, run the playbook.
$ ANSIBLE_HOST_KEY_CHECKING=false ansible-playbook -i inventory --ask-become --ask-vault-pass playbook.yml
ANSIBLE_HOST_KEY_CHECKING
is set to false to turn off host key check for new droplets.