Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Use this repository as a bootstrap for your organization custom Ansible project. | ||
|
||
In case you're new to Ansible, I added some demo playbooks to understand how you should do things. You should configure your inventory and then run the playbooks like this: | ||
|
||
``` | ||
ansible-playbook -i inventory/production/demo provision_demo.yml | ||
``` | ||
|
||
The content of this project was created following the Ansible best practices: | ||
|
||
https://docs.ansible.com/playbooks_best_practices.html#content-organization |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
- hosts: web | ||
vars: | ||
ansible_ssh_user: "{{ user }}" | ||
tasks: | ||
- name: update project source | ||
git: repo={{repository}} dest={{app_path}} accept_hostkey=yes | ||
|
||
- name: install gems with bundler | ||
command: bundle install --deployment chdir={{ app_path }} | ||
|
||
- name: migrate the database | ||
command: bundle exec rake db:migrate RAILS_ENV={{ rails_env }} chdir={{ app_path }} | ||
|
||
- name: compile assets | ||
command: bundle exec rake assets:precompile RAILS_ENV={{ rails_env }} chdir={{ app_path }} | ||
|
||
- name: registers puma pid | ||
command: cat tmp/pids/puma.pid chdir={{ app_path }} | ||
register: puma_pid | ||
|
||
- name: restart puma | ||
command: kill -USR2 {{ puma_pid.stdout }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
web1 ansible_ssh_host=<host or ip> | ||
web2 ansible_ssh_host=<host or ip> | ||
|
||
[web] | ||
web1 | ||
web2 | ||
|
||
[database] | ||
db1 | ||
|
||
[web:vars] | ||
repository=<git repository url> | ||
ansible_ssh_private_key_file=~/.ssh/demo_private_key | ||
ansible_ssh_user=ubuntu | ||
app_name=demo | ||
app_path=/var/local/apps/demo | ||
rails_env=production | ||
user=deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
- hosts: database | ||
sudo: true | ||
roles: | ||
- postgresql-server | ||
|
||
- hosts: web | ||
sudo: true | ||
vars: | ||
ruby_version: 2.2.2 | ||
roles: | ||
- git | ||
- postgresql-client | ||
- phantomjs | ||
- nginx | ||
- rails | ||
- puma |