Skip to content

cwilby/ansible-role-laravel-do

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible Playbook: Laravel on DigitalOcean

Installs and configures a Laravel and MariaDB droplet on DigitalOcean using Ansible playbooks.

Requirements

Install passlib for hashing the admin user password.

$ python -m pip install passlib --user

Role Variables

Swap

See geerlingguy.swap for more info.

MariaDB

See geerlingguy.mysql for more info.

Redis

See geerlingguy.redis for more info.

PHP

See geerlingguy.php for more info.

Composer

See geerlingguy.composer for more info.

Node.js

Uses version lts/carbon.

See geerlingguy.nodejs for more info.

Nginx

Nginx details are stored in vars/web.yml and web.yml.

See geerlingguy.nginx for more info.

Certbot

See geerlingguy.certbot for more info.

Laravel

Review web.yml to see how Laravel is deployed based on the vars in group_vars/all.yml and vars/web.yml.

Common

Web

Database

Example Playbook

---
- name: Setup a preconfigured Laravel and MySQL droplet on DigitalOcean
  role:
    - stedding

Run the Playbook

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.

About

A playbook to setup Laravel and MySQL on seperate instances in a DigitalOcean account.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published