subspace 0.1.3 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +152 -1
- data/TODO +34 -0
- data/ansible/roles/apache/tasks/main.yml +5 -2
- data/ansible/roles/collectd/defaults/main.yml +3 -0
- data/ansible/roles/collectd/handlers/main.yml +3 -0
- data/ansible/roles/collectd/tasks/main.yml +43 -0
- data/ansible/roles/collectd/templates/delayed_job_postgres.conf +20 -0
- data/ansible/roles/collectd/templates/df.conf +16 -0
- data/ansible/roles/collectd/templates/graphite.conf +14 -0
- data/ansible/roles/collectd/templates/hostname.conf +2 -0
- data/ansible/roles/{delayed_job/files/deploy-service → common/files/sudoers-service} +0 -1
- data/ansible/roles/common/tasks/main.yml +37 -7
- data/ansible/roles/common/tasks/swap.yml +8 -6
- data/ansible/roles/common/templates/motd +10 -7
- data/ansible/roles/common/templates/motd2 +24 -0
- data/ansible/roles/delayed_job/README.md +2 -4
- data/ansible/roles/delayed_job/defaults/main.yml +0 -2
- data/ansible/roles/delayed_job/meta/main.yml +5 -0
- data/ansible/roles/delayed_job/tasks/main.yml +3 -18
- data/ansible/roles/delayed_job/templates/delayed-job-monit-rc +1 -1
- data/ansible/roles/letsencrypt/defaults/main.yml +1 -1
- data/ansible/roles/letsencrypt/tasks/main.yml +27 -23
- data/ansible/roles/logrotate/LICENSE +27 -0
- data/ansible/roles/logrotate/README.md +70 -0
- data/ansible/roles/logrotate/defaults/main.yml +2 -0
- data/ansible/roles/logrotate/meta/main.yml +18 -0
- data/ansible/roles/logrotate/tasks/main.yml +15 -0
- data/ansible/roles/logrotate/templates/logrotate.d.j2 +16 -0
- data/ansible/roles/{delayed_job → monit}/files/monit-http.conf +0 -0
- data/ansible/roles/monit/files/sudoers-monit +1 -0
- data/ansible/roles/monit/handlers/main.yml +3 -0
- data/ansible/roles/monit/tasks/main.yml +19 -0
- data/ansible/roles/mtpereira.passenger/.bumpversion.cfg +7 -0
- data/ansible/roles/mtpereira.passenger/.gitignore +2 -0
- data/ansible/roles/mtpereira.passenger/LICENSE +20 -0
- data/ansible/roles/mtpereira.passenger/README.md +31 -0
- data/ansible/roles/mtpereira.passenger/defaults/main.yml +5 -0
- data/ansible/roles/mtpereira.passenger/handlers/main.yml +8 -0
- data/ansible/roles/mtpereira.passenger/meta/.galaxy_install_info +1 -0
- data/ansible/roles/mtpereira.passenger/meta/main.yml +21 -0
- data/ansible/roles/mtpereira.passenger/tasks/apt.yml +13 -0
- data/ansible/roles/mtpereira.passenger/tasks/main.yml +8 -0
- data/ansible/roles/mtpereira.passenger/tasks/pkg.yml +35 -0
- data/ansible/roles/mtpereira.passenger/tasks/service.yml +8 -0
- data/ansible/roles/newrelic/tasks/main.yml +4 -1
- data/ansible/roles/nginx/tasks/main.yml +8 -1
- data/ansible/roles/papertrail/tasks/main.yml +16 -1
- data/ansible/roles/passenger/meta/main.yml +6 -0
- data/ansible/roles/postgresql/README.md +15 -0
- data/ansible/roles/postgresql/defaults/main.yml +3 -0
- data/ansible/roles/postgresql/meta/main.yml +1 -1
- data/ansible/roles/postgresql/tasks/main.yml +9 -8
- data/ansible/roles/postgresql/templates/backup.sh +17 -2
- data/ansible/roles/rails/defaults/main.yml +3 -0
- data/ansible/roles/rails/tasks/main.yml +7 -7
- data/ansible/roles/redis/tasks/main.yml +1 -0
- data/ansible/roles/ruby-common/tasks/main.yml +14 -3
- data/ansible/roles/sidekiq/README.md +1 -0
- data/ansible/roles/sidekiq/meta/main.yml +8 -0
- data/ansible/roles/sidekiq/tasks/main.yml +7 -0
- data/ansible/roles/sidekiq/templates/sidekiq-monit-rc +6 -0
- data/ansible/roles/zenoamaro.postgresql/.gitignore +1 -0
- data/ansible/roles/zenoamaro.postgresql/.travis.yml +28 -0
- data/ansible/roles/zenoamaro.postgresql/LICENSE.md +21 -0
- data/ansible/roles/zenoamaro.postgresql/README.md +117 -0
- data/ansible/roles/zenoamaro.postgresql/Vagrantfile +62 -0
- data/ansible/roles/zenoamaro.postgresql/boxed.yml +26 -0
- data/ansible/roles/zenoamaro.postgresql/defaults/main.yml +606 -0
- data/ansible/roles/zenoamaro.postgresql/handlers/main.yml +8 -0
- data/ansible/roles/zenoamaro.postgresql/inventory +19 -0
- data/ansible/roles/zenoamaro.postgresql/main.yml +19 -0
- data/ansible/roles/zenoamaro.postgresql/meta/.galaxy_install_info +1 -0
- data/ansible/roles/zenoamaro.postgresql/meta/main.yml +21 -0
- data/ansible/roles/zenoamaro.postgresql/tasks/configure.yml +55 -0
- data/ansible/roles/zenoamaro.postgresql/tasks/extensions.yml +49 -0
- data/ansible/roles/zenoamaro.postgresql/tasks/install.yml +51 -0
- data/ansible/roles/zenoamaro.postgresql/tasks/main.yml +5 -0
- data/ansible/roles/zenoamaro.postgresql/templates/environment +11 -0
- data/ansible/roles/zenoamaro.postgresql/templates/pg_ctl.conf +5 -0
- data/ansible/roles/zenoamaro.postgresql/templates/pg_hba.conf +112 -0
- data/ansible/roles/zenoamaro.postgresql/templates/pg_ident.conf +46 -0
- data/ansible/roles/zenoamaro.postgresql/templates/postgresql.conf +530 -0
- data/ansible/roles/zenoamaro.postgresql/test.yml +24 -0
- data/exe/subspace +2 -82
- data/lib/subspace/cli.rb +85 -0
- data/lib/subspace/commands/ansible.rb +20 -0
- data/lib/subspace/commands/base.rb +36 -0
- data/lib/subspace/commands/bootstrap.rb +47 -0
- data/lib/subspace/commands/configure.rb +27 -0
- data/lib/subspace/commands/init.rb +79 -0
- data/lib/subspace/commands/override.rb +21 -0
- data/lib/subspace/commands/provision.rb +10 -0
- data/lib/subspace/commands/ssh.rb +14 -0
- data/lib/subspace/commands/vars.rb +11 -0
- data/lib/subspace/configuration.rb +71 -0
- data/lib/subspace/version.rb +1 -1
- data/lib/subspace.rb +8 -1
- data/subspace.gemspec +2 -0
- data/template/provision/ansible.cfg.erb +4 -1
- data/template/provision/group_vars/all.erb +2 -0
- data/template/provision/group_vars/template.erb +0 -3
- data/template/provision/host_vars/template.erb +1 -1
- data/template/provision/playbook.yml.erb +0 -10
- data/template/provision.rb.erb +94 -0
- metadata +90 -8
- data/ansible/roles/aws/tasks/main.yml +0 -46
- data/lib/subspace/railtie.rb +0 -9
- data/lib/tasks/provision.rake +0 -12
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
- name: Install certbot dependencies
|
|
3
|
+
become: true
|
|
3
4
|
apt:
|
|
4
5
|
pkg: "{{item}}"
|
|
5
6
|
state: present
|
|
@@ -19,75 +20,78 @@
|
|
|
19
20
|
- python-virtualenv
|
|
20
21
|
- python2.7-dev
|
|
21
22
|
|
|
23
|
+
- name: "Create certbot dir"
|
|
24
|
+
become: true
|
|
25
|
+
file:
|
|
26
|
+
path: "{{certbot_dir}}"
|
|
27
|
+
state: directory
|
|
28
|
+
mode: 0750
|
|
29
|
+
|
|
22
30
|
- name: Get certbot
|
|
31
|
+
become: true
|
|
23
32
|
get_url:
|
|
24
33
|
url: "https://dl.eff.org/certbot-auto"
|
|
25
|
-
dest: "{{certbot_dir}}"
|
|
34
|
+
dest: "{{certbot_dir}}/certbot-auto"
|
|
26
35
|
mode: a+x
|
|
27
36
|
|
|
28
|
-
- name: Run
|
|
29
|
-
|
|
37
|
+
- name: Run default
|
|
38
|
+
become: true
|
|
39
|
+
command: "{{certbot_dir}}/certbot-auto certonly --email {{letsencrypt_email}} --domains {{([server_name] + server_aliases) | join(',')}} --apache --agree-tos --expand --non-interactive"
|
|
30
40
|
args:
|
|
31
41
|
creates: /etc/letsencrypt/live/{{server_name}}/cert.pem
|
|
32
42
|
|
|
33
43
|
- name: Enable mod_rewrite
|
|
44
|
+
become: true
|
|
34
45
|
apache2_module:
|
|
35
46
|
name: rewrite
|
|
36
47
|
state: present
|
|
37
|
-
|
|
48
|
+
|
|
38
49
|
|
|
39
50
|
- name: Enable mod_ssl
|
|
51
|
+
become: true
|
|
40
52
|
apache2_module:
|
|
41
53
|
name: ssl
|
|
42
54
|
state: present
|
|
43
|
-
sudo: true
|
|
44
55
|
|
|
45
56
|
- name: Create SSL Apache config
|
|
57
|
+
become: true
|
|
46
58
|
template:
|
|
47
59
|
src: project-le-ssl.conf
|
|
48
60
|
dest: /etc/apache2/sites-available/{{project_name}}-le-ssl.conf
|
|
49
|
-
sudo: true
|
|
50
61
|
notify: apache restart
|
|
51
62
|
|
|
52
63
|
- name: Symlink {{project_name}}-le-ssl.conf to sites-enabled
|
|
64
|
+
become: true
|
|
53
65
|
file:
|
|
54
66
|
src: /etc/apache2/sites-available/{{project_name}}-le-ssl.conf
|
|
55
67
|
dest: /etc/apache2/sites-enabled/{{project_name}}-le-ssl.conf
|
|
56
68
|
state: link
|
|
57
|
-
sudo: true
|
|
58
69
|
notify: apache restart
|
|
59
70
|
|
|
60
|
-
- name: Force redirect to https (1/
|
|
71
|
+
- name: Force redirect to https (1/2)
|
|
72
|
+
become: true
|
|
61
73
|
lineinfile:
|
|
62
74
|
dest: /etc/apache2/sites-available/{{project_name}}.conf
|
|
63
75
|
line: "RewriteEngine on"
|
|
64
76
|
state: present
|
|
65
77
|
insertbefore: "</VirtualHost>"
|
|
66
|
-
sudo: true
|
|
67
|
-
notify: apache restart
|
|
68
|
-
|
|
69
|
-
- name: Force redirect to https (2/3)
|
|
70
|
-
lineinfile:
|
|
71
|
-
dest: /etc/apache2/sites-available/{{project_name}}.conf
|
|
72
|
-
line: "RewriteCond %{SERVER_NAME} ={{server_name}}"
|
|
73
|
-
state: present
|
|
74
|
-
insertbefore: "</VirtualHost>"
|
|
75
|
-
sudo: true
|
|
76
78
|
notify: apache restart
|
|
77
79
|
|
|
78
|
-
- name: Force redirect to https (
|
|
80
|
+
- name: Force redirect to https (2/2)
|
|
81
|
+
become: true
|
|
79
82
|
lineinfile:
|
|
80
83
|
dest: /etc/apache2/sites-available/{{project_name}}.conf
|
|
81
|
-
line: "
|
|
84
|
+
line: "RewriteCond %{SERVER_NAME} ={{item}}\nRewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,NE,R=permanent]"
|
|
82
85
|
state: present
|
|
83
86
|
insertbefore: "</VirtualHost>"
|
|
84
|
-
|
|
87
|
+
with_items: "{{ ([server_name] + server_aliases) }}"
|
|
85
88
|
notify: apache restart
|
|
86
89
|
|
|
87
90
|
- name: Setup cron job to auto renew
|
|
91
|
+
become: true
|
|
88
92
|
cron:
|
|
89
93
|
name: Auto-renew SSL
|
|
90
94
|
job: "{{certbot_dir}}/certbot-auto renew --quiet --no-self-upgrade"
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
hour: 0
|
|
96
|
+
minute: 33
|
|
93
97
|
state: present
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Copyright (c) 2016-14, Nick Hammond
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
* Neither the name of ansiblebit nor the names of its
|
|
15
|
+
contributors may be used to endorse or promote products derived from
|
|
16
|
+
this software without specific prior written permission.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
19
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
22
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
23
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
24
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
25
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
26
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# logrotate
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
Installs logrotate and provides an easy way to setup additional logrotate scripts by
|
|
6
|
+
specifying a list of directives.
|
|
7
|
+
|
|
8
|
+
## Requirements
|
|
9
|
+
|
|
10
|
+
None
|
|
11
|
+
|
|
12
|
+
## Role Variables
|
|
13
|
+
|
|
14
|
+
**logrotate_scripts**: A list of logrotate scripts and the directives to use for the rotation.
|
|
15
|
+
|
|
16
|
+
* name - The name of the script that goes into /etc/logrotate.d/
|
|
17
|
+
* path - Path to point logrotate to for the log rotation
|
|
18
|
+
* options - List of directives for logrotate, view the logrotate man page for specifics
|
|
19
|
+
* scripts - Dict of scripts for logrotate (see Example below)
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
logrotate_scripts:
|
|
23
|
+
- name: rails
|
|
24
|
+
path: "/srv/current/log/*.log"
|
|
25
|
+
options:
|
|
26
|
+
- weekly
|
|
27
|
+
- size 25M
|
|
28
|
+
- missingok
|
|
29
|
+
- compress
|
|
30
|
+
- delaycompress
|
|
31
|
+
- copytruncate
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Dependencies
|
|
35
|
+
|
|
36
|
+
None
|
|
37
|
+
|
|
38
|
+
## Example Playbook
|
|
39
|
+
|
|
40
|
+
Setting up logrotate for additional Nginx logs, with postrotate script (assuming this role is located in `roles/logrotate`).
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
- role: logrotate
|
|
44
|
+
logrotate_scripts:
|
|
45
|
+
- name: nginx
|
|
46
|
+
path: /var/log/nginx/*.log
|
|
47
|
+
options:
|
|
48
|
+
- weekly
|
|
49
|
+
- size 25M
|
|
50
|
+
- rotate 7
|
|
51
|
+
- missingok
|
|
52
|
+
- compress
|
|
53
|
+
- delaycompress
|
|
54
|
+
- copytruncate
|
|
55
|
+
scripts:
|
|
56
|
+
postrotate: "[ -s /run/nginx.pid ] && kill -USR1 `cat /run/nginx.pid`"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
[BSD](https://raw.githubusercontent.com/nickhammond/logrotate/master/LICENSE)
|
|
62
|
+
|
|
63
|
+
## Author Information
|
|
64
|
+
|
|
65
|
+
* [nickhammond](https://github.com/nickhammond) | [www](http://www.nickhammond.com) | [twitter](http://twitter.com/nickhammond)
|
|
66
|
+
* [bigjust](https://github.com/bigjust)
|
|
67
|
+
* [steenzout](https://github.com/steenzout)
|
|
68
|
+
* [jeancornic](https://github.com/jeancornic)
|
|
69
|
+
* [duhast](https://github.com/duhast)
|
|
70
|
+
* [kagux](https://github.com/kagux)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
galaxy_info:
|
|
3
|
+
author: Nick Hammond
|
|
4
|
+
description: Role to configure logrotate scripts
|
|
5
|
+
license: BSD
|
|
6
|
+
min_ansible_version: 1.9
|
|
7
|
+
platforms:
|
|
8
|
+
- name: Ubuntu
|
|
9
|
+
versions:
|
|
10
|
+
- lucid
|
|
11
|
+
- precise
|
|
12
|
+
- trusty
|
|
13
|
+
- name: EL
|
|
14
|
+
versions:
|
|
15
|
+
- 7
|
|
16
|
+
categories:
|
|
17
|
+
- system
|
|
18
|
+
dependencies: []
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
- name: logrotate | Install logrotate
|
|
3
|
+
become: true
|
|
4
|
+
apt:
|
|
5
|
+
name: logrotate
|
|
6
|
+
state: present
|
|
7
|
+
when: logrotate_scripts is defined and logrotate_scripts|length > 0
|
|
8
|
+
|
|
9
|
+
- name: logrotate | Setup logrotate.d scripts
|
|
10
|
+
become: true
|
|
11
|
+
template:
|
|
12
|
+
src: logrotate.d.j2
|
|
13
|
+
dest: "{{ logrotate_conf_dir }}{{ item.name }}"
|
|
14
|
+
with_items: "{{ logrotate_scripts }}"
|
|
15
|
+
when: logrotate_scripts is defined
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# {{ ansible_managed }}
|
|
2
|
+
|
|
3
|
+
"{{ item.path }}" {
|
|
4
|
+
{% if item.options is defined -%}
|
|
5
|
+
{% for option in item.options -%}
|
|
6
|
+
{{ option }}
|
|
7
|
+
{% endfor -%}
|
|
8
|
+
{% endif %}
|
|
9
|
+
{%- if item.scripts is defined -%}
|
|
10
|
+
{%- for name, script in item.scripts.iteritems() -%}
|
|
11
|
+
{{ name }}
|
|
12
|
+
{{ script }}
|
|
13
|
+
endscript
|
|
14
|
+
{% endfor -%}
|
|
15
|
+
{% endif -%}
|
|
16
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
deploy ALL=(root) NOPASSWD: /usr/bin/monit
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
- name: Install monit
|
|
3
|
+
apt:
|
|
4
|
+
name: monit
|
|
5
|
+
state: present
|
|
6
|
+
sudo: true
|
|
7
|
+
|
|
8
|
+
- name: Copy sudoers file so that deploy can use monit without entering password.
|
|
9
|
+
copy:
|
|
10
|
+
src: sudoers-monit
|
|
11
|
+
dest: /etc/sudoers.d/monit
|
|
12
|
+
sudo: true
|
|
13
|
+
|
|
14
|
+
- name: Copy monit config to enable http from localhost
|
|
15
|
+
copy:
|
|
16
|
+
src: monit-http.conf
|
|
17
|
+
dest: /etc/monit/conf.d/monit-http.conf
|
|
18
|
+
sudo: true
|
|
19
|
+
notify: monit
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 Manuel Tiago Pereira
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Passenger
|
|
2
|
+
========
|
|
3
|
+
|
|
4
|
+
Installs or updates Pushion Passenger.
|
|
5
|
+
|
|
6
|
+
It will install apache, nginx or standalone modes, depending on **passenger_webserver** variable value (defaults to standalone).
|
|
7
|
+
|
|
8
|
+
In the `tests` folder, there are a set of tests for this role, that will provision a VM using Vagrant and setup a simple hello world app. To use them, `cd` into the `tests/{passenger_webserver}/` and execute `vagrant up`. At the moment, only `apache` tests are done.
|
|
9
|
+
|
|
10
|
+
Requirements
|
|
11
|
+
------------
|
|
12
|
+
|
|
13
|
+
Assumes that the host is ansible-ready (check **mtpereira.common** role).
|
|
14
|
+
|
|
15
|
+
Role Variables
|
|
16
|
+
--------------
|
|
17
|
+
|
|
18
|
+
* `passenger_webserver`: Specifies the webserver to be used by passenger. Possible values: `apache`, `nginx` and `standalone`. Defaults to `standalone`.
|
|
19
|
+
* `passenger_pkgs_state`: Specifies if this role will garantee that the packages are installed or installed and updated. Possible values: `installed` and `latest`. Defaults to `installed`.
|
|
20
|
+
|
|
21
|
+
License
|
|
22
|
+
-------
|
|
23
|
+
|
|
24
|
+
MIT
|
|
25
|
+
|
|
26
|
+
Author Information
|
|
27
|
+
------------------
|
|
28
|
+
|
|
29
|
+
[GitHub project page](https://github.com/mtpereira/ansible-passenger)
|
|
30
|
+
|
|
31
|
+
[Manuel Tiago Pereira](http://mtpereira.github.io)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{install_date: 'Mon Jan 2 18:15:18 2017', version: 1.0.2}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
galaxy_info:
|
|
3
|
+
author: Manuel Tiago Pereira
|
|
4
|
+
description: Installs Phusion Passenger.
|
|
5
|
+
license: MIT
|
|
6
|
+
min_ansible_version: 1.4
|
|
7
|
+
platforms:
|
|
8
|
+
- name: Debian
|
|
9
|
+
versions:
|
|
10
|
+
- wheezy
|
|
11
|
+
- jessie
|
|
12
|
+
- name: Ubuntu
|
|
13
|
+
versions:
|
|
14
|
+
- lucid
|
|
15
|
+
- precise
|
|
16
|
+
- saucy
|
|
17
|
+
- trusty
|
|
18
|
+
categories:
|
|
19
|
+
- web
|
|
20
|
+
dependencies: []
|
|
21
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
- name: apt - add key for passenger repos
|
|
3
|
+
apt_key: url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x561F9B9CAC40B2F7 id=AC40B2F7 state=present
|
|
4
|
+
|
|
5
|
+
- name: apt - add support for https
|
|
6
|
+
apt: pkg={{ item }} state={{ passenger_pkgs_state }} update_cache=yes cache_valid_time=3600
|
|
7
|
+
with_items:
|
|
8
|
+
- apt-transport-https
|
|
9
|
+
- ca-certificates
|
|
10
|
+
|
|
11
|
+
- name: apt - add passenger repo
|
|
12
|
+
apt_repository: repo='deb https://oss-binaries.phusionpassenger.com/apt/passenger {{ ansible_lsb.codename }} main' state=present update_cache=yes
|
|
13
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
- name: pkg - install apache passenger packages
|
|
3
|
+
apt: pkg={{ item }} state={{ passenger_pkgs_state }}
|
|
4
|
+
with_items:
|
|
5
|
+
- libapache2-mod-passenger
|
|
6
|
+
- apache2
|
|
7
|
+
notify: apache restart
|
|
8
|
+
when: passenger_webserver == "apache"
|
|
9
|
+
|
|
10
|
+
- name: pkg - install nginx passenger packages
|
|
11
|
+
apt: pkg={{ item }} state={{ passenger_pkgs_state }}
|
|
12
|
+
with_items:
|
|
13
|
+
- nginx-extras
|
|
14
|
+
- passenger
|
|
15
|
+
notify: nginx restart
|
|
16
|
+
when: passenger_webserver == "nginx"
|
|
17
|
+
|
|
18
|
+
- name: pkg - install standalone passenger packages
|
|
19
|
+
apt: pkg={{ item }} state={{ passenger_pkgs_state }}
|
|
20
|
+
with_items:
|
|
21
|
+
- passenger
|
|
22
|
+
when: passenger_webserver == "standalone"
|
|
23
|
+
|
|
24
|
+
- name: pkg - fix passenger utils shebang
|
|
25
|
+
lineinfile:
|
|
26
|
+
dest: "{{ item }}"
|
|
27
|
+
regexp: '^#\!/usr/bin/ruby\s*'
|
|
28
|
+
line: "#!/usr/bin/env ruby"
|
|
29
|
+
backrefs: yes
|
|
30
|
+
state: present
|
|
31
|
+
with_items:
|
|
32
|
+
- /usr/sbin/passenger-memory-stats
|
|
33
|
+
- /usr/sbin/passenger-status
|
|
34
|
+
when: passenger_pkgs_fix_shebang
|
|
35
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
- name: service - ensure apache is running
|
|
3
|
+
service: name=apache2 state=started enabled=yes
|
|
4
|
+
when: passenger_webserver == "apache"
|
|
5
|
+
|
|
6
|
+
- name: service - ensure nginx is running
|
|
7
|
+
service: name=nginx state=started enabled=yes
|
|
8
|
+
when: passenger_webserver == "nginx"
|
|
@@ -3,18 +3,21 @@
|
|
|
3
3
|
apt_repository:
|
|
4
4
|
repo: deb http://apt.newrelic.com/debian/ newrelic non-free
|
|
5
5
|
state: present
|
|
6
|
+
sudo: true
|
|
6
7
|
|
|
7
8
|
- name: Add New Relic apt key
|
|
8
9
|
apt_key:
|
|
9
10
|
url: https://download.newrelic.com/548C16BF.gpg
|
|
10
11
|
state: present
|
|
12
|
+
sudo: true
|
|
11
13
|
|
|
12
14
|
- name: Install New Relic server agent
|
|
13
15
|
apt:
|
|
14
16
|
pkg: newrelic-sysmond
|
|
15
17
|
state: present
|
|
16
18
|
update_cache: true
|
|
17
|
-
|
|
19
|
+
sudo: true
|
|
18
20
|
|
|
19
21
|
- shell: "nrsysmond-config --set license_key={{newrelic_licence}}"
|
|
22
|
+
sudo: true
|
|
20
23
|
notify: start newrelic agent
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
- name: Install nginx
|
|
2
2
|
apt: pkg=nginx state=latest
|
|
3
|
+
become: true
|
|
3
4
|
|
|
4
5
|
- name: Remove the default app
|
|
5
6
|
command: rm -rf /etc/nginx/sites-enabled/default
|
|
7
|
+
become: true
|
|
6
8
|
|
|
7
9
|
- name: Remove the app's config, if exists
|
|
8
10
|
command: rm -rf /etc/nginx/sites-enabled/default
|
|
11
|
+
become: true
|
|
9
12
|
|
|
10
13
|
- name: Remove the app's symlink, if exists
|
|
11
14
|
command: rm -rf /etc/nginx/sites-enabled/{{project_name}}
|
|
15
|
+
become: true
|
|
12
16
|
|
|
13
17
|
- name: Configure nginx for the app
|
|
14
18
|
template: src=nginx-project dest=/etc/nginx/sites-available/{{project_name}} group=www-data owner=www-data force=yes
|
|
19
|
+
become: true
|
|
15
20
|
|
|
16
21
|
- name: Enable the app
|
|
17
22
|
command: ln -s /etc/nginx/sites-available/{{project_name}} /etc/nginx/sites-enabled/{{project_name}}
|
|
23
|
+
become: true
|
|
18
24
|
|
|
19
25
|
- name: Restart nginx
|
|
20
|
-
action: service name=nginx state=restarted
|
|
26
|
+
action: service name=nginx state=restarted
|
|
27
|
+
become: true
|
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
---
|
|
2
2
|
- name: Install remote_syslog from papertrail
|
|
3
3
|
command: wget -O /tmp/remote_syslog.tar.gz https://github.com/papertrail/remote_syslog2/releases/download/v0.13/remote_syslog_linux_amd64.tar.gz creates=/usr/bin/remote_syslog
|
|
4
|
+
|
|
4
5
|
- command: tar xzf /tmp/remote_syslog.tar.gz chdir=/tmp/ creates=/usr/bin/remote_syslog
|
|
6
|
+
|
|
5
7
|
- command: mv /tmp/remote_syslog/remote_syslog /usr/bin/remote_syslog creates=/usr/bin/remote_syslog
|
|
8
|
+
sudo: true
|
|
9
|
+
|
|
6
10
|
- file: path=/usr/bin/remote_syslog owner=root group=root mode=0755
|
|
11
|
+
sudo: true
|
|
12
|
+
|
|
7
13
|
- command: wget -O /etc/init.d/remote_syslog https://raw.githubusercontent.com/papertrail/remote_syslog2/v0.13/examples/remote_syslog.init.d creates=/etc/init.d/remote_syslog
|
|
14
|
+
sudo: true
|
|
15
|
+
|
|
8
16
|
- file: path=/etc/init.d/remote_syslog owner=root group=root mode=0755
|
|
17
|
+
sudo: true
|
|
18
|
+
|
|
9
19
|
- file: path=/tmp/remote_syslog/ state=absent
|
|
20
|
+
|
|
10
21
|
- file: path=/tmp/remote_syslog.tar.gz state=absent
|
|
22
|
+
|
|
11
23
|
- service: name=remote_syslog state=restarted enabled=yes
|
|
12
|
-
|
|
24
|
+
sudo: true
|
|
25
|
+
|
|
26
|
+
- template: src=log_files.yml dest=/etc/log_files.yml owner=root group=root mode=0644
|
|
27
|
+
sudo: true
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Attach this as a bucket policy to allow unauthenticated writes. Then you can set "s3_db_backup_bucket" to upload backups to your s3 bucket instead of keeping backups on the local machine.
|
|
2
|
+
#TODO: add authentication option
|
|
3
|
+
{
|
|
4
|
+
"Version": "2012-10-17",
|
|
5
|
+
"Id": "Policy1477442935689",
|
|
6
|
+
"Statement": [
|
|
7
|
+
{
|
|
8
|
+
"Sid": "Stmt1477442933718",
|
|
9
|
+
"Effect": "Allow",
|
|
10
|
+
"Principal": "*",
|
|
11
|
+
"Action": "s3:PutObject",
|
|
12
|
+
"Resource": "arn:aws:s3:::<BUCKET_NAME>/*"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
name: "{{database_user}}"
|
|
5
5
|
password: "{{database_password}}"
|
|
6
6
|
state: present
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
become: true
|
|
8
|
+
become_user: postgres
|
|
9
9
|
|
|
10
10
|
- name: Create postgresql database
|
|
11
11
|
postgresql_db:
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
owner: "{{database_user}}"
|
|
14
14
|
template: template1
|
|
15
15
|
state: present
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
become: true
|
|
17
|
+
become_user: postgres
|
|
18
18
|
|
|
19
19
|
- name: Grant all privileges on database to user
|
|
20
20
|
postgresql_privs:
|
|
@@ -23,15 +23,16 @@
|
|
|
23
23
|
roles: "{{database_user}}"
|
|
24
24
|
state: present
|
|
25
25
|
type: database
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
become: true
|
|
27
|
+
become_user: postgres
|
|
28
28
|
|
|
29
29
|
- name: "Enable postgres hstore"
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
become: true
|
|
31
|
+
become_user: postgres
|
|
32
32
|
postgresql_ext:
|
|
33
33
|
db: "{{database_name}}"
|
|
34
34
|
name: hstore
|
|
35
35
|
state: present
|
|
36
36
|
|
|
37
37
|
- include: backups.yml
|
|
38
|
+
become: true
|