/ansible-rails

The Ansible Collection for Rails

Ansible Rails

Ansible Lint

The Ansible collection for Ruby on Rails provision.

Requirements

  • Ansible 2.9+

Usage

Add elct9620.rails to your requirements.yml

# ...

collections:
- elct9620.rails

Install Collection

ansible-galaxy collection install -r requirements.yml

Copy the playbooks from examples to your project.

Add default variables to group_vars/all.yml (strong suggestion use ansible-vault to encryption it)

app_user: deploy
app_group: deploy

nginx_config_template: nginx.conf.j2
nginx_extra_modules:
  - passenger

ruby_version: 2.7.1
bundler: yes
bundler_version: 2.1.4
postgres: yes

postgres_username: deploy
postgres_database: my_app

deploy_key: [DEPLOY_KEY]
authorized_keys:
  - [YOUR_KEYS]

The customize nginx.conf.j2 template please copy from examples to ensure your enabled passenger

Run playbooks to setup your project.

ansible-playbook -i [INVENTORY] setup.yml

Use update.yml playbook to update configure after change variables

ansible-playbook -i [INVENTORY] update.yml

The application root will configure to /srv/app, you can use Capistrano to deploy your application.

Playbooks

  • setup.yml will used for setup the server.
  • update.yml will used for update the configurations.

Variables

TODO

Roadmap

  • Ubuntu Support
  • Setup Sidekiq Service
  • Let's Encrypt Support
  • Better nginx.conf template
  • Configure environment variables to /etc/environment