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.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +152 -1
  3. data/TODO +34 -0
  4. data/ansible/roles/apache/tasks/main.yml +5 -2
  5. data/ansible/roles/collectd/defaults/main.yml +3 -0
  6. data/ansible/roles/collectd/handlers/main.yml +3 -0
  7. data/ansible/roles/collectd/tasks/main.yml +43 -0
  8. data/ansible/roles/collectd/templates/delayed_job_postgres.conf +20 -0
  9. data/ansible/roles/collectd/templates/df.conf +16 -0
  10. data/ansible/roles/collectd/templates/graphite.conf +14 -0
  11. data/ansible/roles/collectd/templates/hostname.conf +2 -0
  12. data/ansible/roles/{delayed_job/files/deploy-service → common/files/sudoers-service} +0 -1
  13. data/ansible/roles/common/tasks/main.yml +37 -7
  14. data/ansible/roles/common/tasks/swap.yml +8 -6
  15. data/ansible/roles/common/templates/motd +10 -7
  16. data/ansible/roles/common/templates/motd2 +24 -0
  17. data/ansible/roles/delayed_job/README.md +2 -4
  18. data/ansible/roles/delayed_job/defaults/main.yml +0 -2
  19. data/ansible/roles/delayed_job/meta/main.yml +5 -0
  20. data/ansible/roles/delayed_job/tasks/main.yml +3 -18
  21. data/ansible/roles/delayed_job/templates/delayed-job-monit-rc +1 -1
  22. data/ansible/roles/letsencrypt/defaults/main.yml +1 -1
  23. data/ansible/roles/letsencrypt/tasks/main.yml +27 -23
  24. data/ansible/roles/logrotate/LICENSE +27 -0
  25. data/ansible/roles/logrotate/README.md +70 -0
  26. data/ansible/roles/logrotate/defaults/main.yml +2 -0
  27. data/ansible/roles/logrotate/meta/main.yml +18 -0
  28. data/ansible/roles/logrotate/tasks/main.yml +15 -0
  29. data/ansible/roles/logrotate/templates/logrotate.d.j2 +16 -0
  30. data/ansible/roles/{delayed_job → monit}/files/monit-http.conf +0 -0
  31. data/ansible/roles/monit/files/sudoers-monit +1 -0
  32. data/ansible/roles/monit/handlers/main.yml +3 -0
  33. data/ansible/roles/monit/tasks/main.yml +19 -0
  34. data/ansible/roles/mtpereira.passenger/.bumpversion.cfg +7 -0
  35. data/ansible/roles/mtpereira.passenger/.gitignore +2 -0
  36. data/ansible/roles/mtpereira.passenger/LICENSE +20 -0
  37. data/ansible/roles/mtpereira.passenger/README.md +31 -0
  38. data/ansible/roles/mtpereira.passenger/defaults/main.yml +5 -0
  39. data/ansible/roles/mtpereira.passenger/handlers/main.yml +8 -0
  40. data/ansible/roles/mtpereira.passenger/meta/.galaxy_install_info +1 -0
  41. data/ansible/roles/mtpereira.passenger/meta/main.yml +21 -0
  42. data/ansible/roles/mtpereira.passenger/tasks/apt.yml +13 -0
  43. data/ansible/roles/mtpereira.passenger/tasks/main.yml +8 -0
  44. data/ansible/roles/mtpereira.passenger/tasks/pkg.yml +35 -0
  45. data/ansible/roles/mtpereira.passenger/tasks/service.yml +8 -0
  46. data/ansible/roles/newrelic/tasks/main.yml +4 -1
  47. data/ansible/roles/nginx/tasks/main.yml +8 -1
  48. data/ansible/roles/papertrail/tasks/main.yml +16 -1
  49. data/ansible/roles/passenger/meta/main.yml +6 -0
  50. data/ansible/roles/postgresql/README.md +15 -0
  51. data/ansible/roles/postgresql/defaults/main.yml +3 -0
  52. data/ansible/roles/postgresql/meta/main.yml +1 -1
  53. data/ansible/roles/postgresql/tasks/main.yml +9 -8
  54. data/ansible/roles/postgresql/templates/backup.sh +17 -2
  55. data/ansible/roles/rails/defaults/main.yml +3 -0
  56. data/ansible/roles/rails/tasks/main.yml +7 -7
  57. data/ansible/roles/redis/tasks/main.yml +1 -0
  58. data/ansible/roles/ruby-common/tasks/main.yml +14 -3
  59. data/ansible/roles/sidekiq/README.md +1 -0
  60. data/ansible/roles/sidekiq/meta/main.yml +8 -0
  61. data/ansible/roles/sidekiq/tasks/main.yml +7 -0
  62. data/ansible/roles/sidekiq/templates/sidekiq-monit-rc +6 -0
  63. data/ansible/roles/zenoamaro.postgresql/.gitignore +1 -0
  64. data/ansible/roles/zenoamaro.postgresql/.travis.yml +28 -0
  65. data/ansible/roles/zenoamaro.postgresql/LICENSE.md +21 -0
  66. data/ansible/roles/zenoamaro.postgresql/README.md +117 -0
  67. data/ansible/roles/zenoamaro.postgresql/Vagrantfile +62 -0
  68. data/ansible/roles/zenoamaro.postgresql/boxed.yml +26 -0
  69. data/ansible/roles/zenoamaro.postgresql/defaults/main.yml +606 -0
  70. data/ansible/roles/zenoamaro.postgresql/handlers/main.yml +8 -0
  71. data/ansible/roles/zenoamaro.postgresql/inventory +19 -0
  72. data/ansible/roles/zenoamaro.postgresql/main.yml +19 -0
  73. data/ansible/roles/zenoamaro.postgresql/meta/.galaxy_install_info +1 -0
  74. data/ansible/roles/zenoamaro.postgresql/meta/main.yml +21 -0
  75. data/ansible/roles/zenoamaro.postgresql/tasks/configure.yml +55 -0
  76. data/ansible/roles/zenoamaro.postgresql/tasks/extensions.yml +49 -0
  77. data/ansible/roles/zenoamaro.postgresql/tasks/install.yml +51 -0
  78. data/ansible/roles/zenoamaro.postgresql/tasks/main.yml +5 -0
  79. data/ansible/roles/zenoamaro.postgresql/templates/environment +11 -0
  80. data/ansible/roles/zenoamaro.postgresql/templates/pg_ctl.conf +5 -0
  81. data/ansible/roles/zenoamaro.postgresql/templates/pg_hba.conf +112 -0
  82. data/ansible/roles/zenoamaro.postgresql/templates/pg_ident.conf +46 -0
  83. data/ansible/roles/zenoamaro.postgresql/templates/postgresql.conf +530 -0
  84. data/ansible/roles/zenoamaro.postgresql/test.yml +24 -0
  85. data/exe/subspace +2 -82
  86. data/lib/subspace/cli.rb +85 -0
  87. data/lib/subspace/commands/ansible.rb +20 -0
  88. data/lib/subspace/commands/base.rb +36 -0
  89. data/lib/subspace/commands/bootstrap.rb +47 -0
  90. data/lib/subspace/commands/configure.rb +27 -0
  91. data/lib/subspace/commands/init.rb +79 -0
  92. data/lib/subspace/commands/override.rb +21 -0
  93. data/lib/subspace/commands/provision.rb +10 -0
  94. data/lib/subspace/commands/ssh.rb +14 -0
  95. data/lib/subspace/commands/vars.rb +11 -0
  96. data/lib/subspace/configuration.rb +71 -0
  97. data/lib/subspace/version.rb +1 -1
  98. data/lib/subspace.rb +8 -1
  99. data/subspace.gemspec +2 -0
  100. data/template/provision/ansible.cfg.erb +4 -1
  101. data/template/provision/group_vars/all.erb +2 -0
  102. data/template/provision/group_vars/template.erb +0 -3
  103. data/template/provision/host_vars/template.erb +1 -1
  104. data/template/provision/playbook.yml.erb +0 -10
  105. data/template/provision.rb.erb +94 -0
  106. metadata +90 -8
  107. data/ansible/roles/aws/tasks/main.yml +0 -46
  108. data/lib/subspace/railtie.rb +0 -9
  109. data/lib/tasks/provision.rake +0 -12
@@ -0,0 +1,55 @@
1
+ ---
2
+
3
+ - name: Create the necessary directories
4
+ sudo: yes
5
+ file:
6
+ dest: "{{item}}"
7
+ state: directory
8
+ owner: "{{postgresql_admin_user}}"
9
+ group: "{{postgresql_admin_group}}"
10
+ with_items:
11
+ - "{{postgresql_conf_directory}}"
12
+ - "{{postgresql_data_directory}}"
13
+ - "{{postgresql_runtime_directory}}"
14
+ - "{{postgresql_log_directory}}"
15
+ tags:
16
+ - postgresql
17
+ - db
18
+ - conf
19
+
20
+ - name: Configure PostgreSQL
21
+ sudo: yes
22
+ template:
23
+ src: "{{item}}"
24
+ dest: "{{postgresql_conf_directory}}/{{item}}"
25
+ with_items:
26
+ - postgresql.conf
27
+ - pg_ctl.conf
28
+ - environment
29
+ notify: restart postgresql
30
+ tags:
31
+ - postgresql
32
+ - db
33
+ - conf
34
+
35
+ - name: Configure PostgreSQL (authentication)
36
+ sudo: yes
37
+ template:
38
+ src: pg_hba.conf
39
+ dest: "{{postgresql_hba_file}}"
40
+ notify: restart postgresql
41
+ tags:
42
+ - postgresql
43
+ - db
44
+ - conf
45
+
46
+ - name: Configure PostgreSQL (ident)
47
+ sudo: yes
48
+ template:
49
+ src: pg_ident.conf
50
+ dest: "{{postgresql_ident_file}}"
51
+ notify: restart postgresql
52
+ tags:
53
+ - postgresql
54
+ - db
55
+ - conf
@@ -0,0 +1,49 @@
1
+ ---
2
+
3
+
4
+ # Development headers and libraries
5
+ # ---------------------------------
6
+
7
+ - name: Install development headers
8
+ when: postgresql_dev_headers == True
9
+ sudo: yes
10
+ apt:
11
+ name: libpq-dev
12
+ tags:
13
+ - postgresql
14
+ - db
15
+ - deps
16
+ - dev
17
+
18
+
19
+ # Contributed extensions
20
+ # ----------------------
21
+
22
+ - name: Install PostgreSQL contribs
23
+ when: postgresql_contrib
24
+ sudo: yes
25
+ apt:
26
+ name: "postgresql-contrib-{{postgresql_version}}"
27
+ notify: restart postgresql
28
+ tags:
29
+ - postgresql
30
+ - db
31
+ - deps
32
+
33
+
34
+ # PostGIS
35
+ # -------
36
+
37
+ - name: Add postgis extensions
38
+ when: postgresql_postgis
39
+ sudo: yes
40
+ apt:
41
+ name: "{{item}}"
42
+ with_items:
43
+ - "postgresql-{{postgresql_version}}-postgis-{{postgresql_postgis_version}}"
44
+ - libgeos-c1
45
+ notify: restart postgresql
46
+ tags:
47
+ - postgresql
48
+ - db
49
+ - deps
@@ -0,0 +1,51 @@
1
+ ---
2
+
3
+ # Official PostgreSQL [repository] for debian-based distributions
4
+ # [repository]: http://www.postgresql.org/download/
5
+
6
+ - name: Adding APT repository key
7
+ when: ansible_os_family == 'Debian'
8
+ sudo: yes
9
+ apt_key:
10
+ id: ACCC4CF8
11
+ url: https://www.postgresql.org/media/keys/ACCC4CF8.asc
12
+ tags:
13
+ - postgresql
14
+ - db
15
+ - repo
16
+
17
+ - name: Add PostgreSQL official APT repository
18
+ when: ansible_os_family == 'Debian'
19
+ sudo: yes
20
+ apt_repository:
21
+ repo: "deb http://apt.postgresql.org/pub/repos/apt/ {{ansible_distribution_release}}-pgdg main"
22
+ tags:
23
+ - postgresql
24
+ - db
25
+ - repo
26
+
27
+ - name: Install PostgreSQL
28
+ when: ansible_os_family == 'Debian'
29
+ sudo: yes
30
+ apt:
31
+ name: "postgresql-{{postgresql_version}}"
32
+ state: present
33
+ update_cache: yes
34
+ cache_valid_time: 3600
35
+ tags:
36
+ - postgresql
37
+ - db
38
+ - deps
39
+
40
+ - name: Install dependencies for the Ansible module
41
+ when: ansible_os_family == 'Debian'
42
+ sudo: yes
43
+ apt:
44
+ name: "{{item}}"
45
+ state: latest
46
+ with_items:
47
+ - python-psycopg2
48
+ tags:
49
+ - postgresql
50
+ - db
51
+ - deps
@@ -0,0 +1,5 @@
1
+ ---
2
+
3
+ - include: install.yml
4
+ - include: extensions.yml
5
+ - include: configure.yml
@@ -0,0 +1,11 @@
1
+ # environment variables for postmaster process
2
+ # This file has the same syntax as postgresql.conf:
3
+ # VARIABLE = simple_value
4
+ # VARIABLE2 = 'any value!'
5
+ # I. e. you need to enclose any value which does not only consist of letters,
6
+ # numbers, and '-', '_', '.' in single quotes. Shell commands are not
7
+ # evaluated.
8
+
9
+ {% if postgresql_env %}{% for k,v in postgresql_env.items() %}
10
+ {{k}} = {{v}}
11
+ {% endfor %}{% endif %}
@@ -0,0 +1,5 @@
1
+ # Automatic pg_ctl configuration
2
+ # This configuration file contains cluster specific options to be passed to
3
+ # pg_ctl(1).
4
+
5
+ pg_ctl_options = '{{ postgresql_pg_ctl_options|join(' ')|replace('\'', '\\\'') }}'
@@ -0,0 +1,112 @@
1
+ # PostgreSQL Client Authentication Configuration File
2
+ # ===================================================
3
+ #
4
+ # Refer to the "Client Authentication" section in the PostgreSQL
5
+ # documentation for a complete description of this file. A short
6
+ # synopsis follows.
7
+ #
8
+ # This file controls: which hosts are allowed to connect, how clients
9
+ # are authenticated, which PostgreSQL user names they can use, which
10
+ # databases they can access. Records take one of these forms:
11
+ #
12
+ # local DATABASE USER METHOD [OPTIONS]
13
+ # host DATABASE USER ADDRESS METHOD [OPTIONS]
14
+ # hostssl DATABASE USER ADDRESS METHOD [OPTIONS]
15
+ # hostnossl DATABASE USER ADDRESS METHOD [OPTIONS]
16
+ #
17
+ # (The uppercase items must be replaced by actual values.)
18
+ #
19
+ # The first field is the connection type: "local" is a Unix-domain
20
+ # socket, "host" is either a plain or SSL-encrypted TCP/IP socket,
21
+ # "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a
22
+ # plain TCP/IP socket.
23
+ #
24
+ # DATABASE can be "all", "sameuser", "samerole", "replication", a
25
+ # database name, or a comma-separated list thereof. The "all"
26
+ # keyword does not match "replication". Access to replication
27
+ # must be enabled in a separate record (see example below).
28
+ #
29
+ # USER can be "all", a user name, a group name prefixed with "+", or a
30
+ # comma-separated list thereof. In both the DATABASE and USER fields
31
+ # you can also write a file name prefixed with "@" to include names
32
+ # from a separate file.
33
+ #
34
+ # ADDRESS specifies the set of hosts the record matches. It can be a
35
+ # host name, or it is made up of an IP address and a CIDR mask that is
36
+ # an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that
37
+ # specifies the number of significant bits in the mask. A host name
38
+ # that starts with a dot (.) matches a suffix of the actual host name.
39
+ # Alternatively, you can write an IP address and netmask in separate
40
+ # columns to specify the set of hosts. Instead of a CIDR-address, you
41
+ # can write "samehost" to match any of the server's own IP addresses,
42
+ # or "samenet" to match any address in any subnet that the server is
43
+ # directly connected to.
44
+ #
45
+ # METHOD can be "trust", "reject", "md5", "password", "gss", "sspi",
46
+ # "krb5", "ident", "peer", "pam", "ldap", "radius" or "cert". Note that
47
+ # "password" sends passwords in clear text; "md5" is preferred since
48
+ # it sends encrypted passwords.
49
+ #
50
+ # OPTIONS are a set of options for the authentication in the format
51
+ # NAME=VALUE. The available options depend on the different
52
+ # authentication methods -- refer to the "Client Authentication"
53
+ # section in the documentation for a list of which options are
54
+ # available for which authentication methods.
55
+ #
56
+ # Database and user names containing spaces, commas, quotes and other
57
+ # special characters must be quoted. Quoting one of the keywords
58
+ # "all", "sameuser", "samerole" or "replication" makes the name lose
59
+ # its special character, and just match a database or username with
60
+ # that name.
61
+ #
62
+ # This file is read on server startup and when the postmaster receives
63
+ # a SIGHUP signal. If you edit the file on a running system, you have
64
+ # to SIGHUP the postmaster for the changes to take effect. You can
65
+ # use "pg_ctl reload" to do that.
66
+
67
+ # Put your actual configuration here
68
+ # ----------------------------------
69
+ #
70
+ # If you want to allow non-local connections, you need to add more
71
+ # "host" records. In that case you will also need to make PostgreSQL
72
+ # listen on a non-local interface via the listen_addresses
73
+ # configuration parameter, or via the -i or -h command line switches.
74
+
75
+ # TYPE DATABASE USER ADDRESS METHOD
76
+
77
+ {% for auth in postgresql_authentication %}
78
+ {{auth.type}} {% if 'database' not in auth %}
79
+ samerole{% elif auth.database is string %}
80
+ {{auth.database}}{% elif auth.database is sequence %}
81
+ {{auth.database|join(',')}}{% endif %} {{auth.user}} {{auth.address|default('')}} {{auth.method}} {% if 'options' in auth %} {% for k,v in auth.options.items() %}
82
+ {{k}}={{v}} {% endfor %}{% endif %}
83
+
84
+ {% endfor %}
85
+
86
+
87
+ # DO NOT DISABLE!
88
+ # If you change this first entry you will need to make sure that the
89
+ # database superuser can access the database using some other method.
90
+ # Noninteractive access to all databases is required during automatic
91
+ # maintenance (custom daily cronjobs, replication, and similar tasks).
92
+ #
93
+ # Database administrative login by Unix domain socket
94
+
95
+ # TYPE DATABASE USER ADDRESS METHOD
96
+
97
+ local all {{postgresql_admin_user|default('postgres')}} peer
98
+
99
+ # "local" is for Unix domain socket connections only
100
+ local all all peer
101
+
102
+ # IPv4 local connections:
103
+ host all all 127.0.0.1/32 md5
104
+
105
+ # IPv6 local connections:
106
+ host all all ::1/128 md5
107
+
108
+ # Allow replication connections from localhost, by a user with the
109
+ # replication privilege.
110
+ #local replication postgres peer
111
+ #host replication postgres 127.0.0.1/32 md5
112
+ #host replication postgres ::1/128 md5
@@ -0,0 +1,46 @@
1
+ # PostgreSQL User Name Maps
2
+ # =========================
3
+ #
4
+ # Refer to the PostgreSQL documentation, chapter "Client
5
+ # Authentication" for a complete description. A short synopsis
6
+ # follows.
7
+ #
8
+ # This file controls PostgreSQL user name mapping. It maps external
9
+ # user names to their corresponding PostgreSQL user names. Records
10
+ # are of the form:
11
+ #
12
+ # MAPNAME SYSTEM-USERNAME PG-USERNAME
13
+ #
14
+ # (The uppercase quantities must be replaced by actual values.)
15
+ #
16
+ # MAPNAME is the (otherwise freely chosen) map name that was used in
17
+ # pg_hba.conf. SYSTEM-USERNAME is the detected user name of the
18
+ # client. PG-USERNAME is the requested PostgreSQL user name. The
19
+ # existence of a record specifies that SYSTEM-USERNAME may connect as
20
+ # PG-USERNAME.
21
+ #
22
+ # If SYSTEM-USERNAME starts with a slash (/), it will be treated as a
23
+ # regular expression. Optionally this can contain a capture (a
24
+ # parenthesized subexpression). The substring matching the capture
25
+ # will be substituted for \1 (backslash-one) if present in
26
+ # PG-USERNAME.
27
+ #
28
+ # Multiple maps may be specified in this file and used by pg_hba.conf.
29
+ #
30
+ # No map names are defined in the default configuration. If all
31
+ # system user names and PostgreSQL user names are the same, you don't
32
+ # need anything in this file.
33
+ #
34
+ # This file is read on server startup and when the postmaster receives
35
+ # a SIGHUP signal. If you edit the file on a running system, you have
36
+ # to SIGHUP the postmaster for the changes to take effect. You can
37
+ # use "pg_ctl reload" to do that.
38
+
39
+ # Put your actual configuration here
40
+ # ----------------------------------
41
+
42
+ # MAPNAME SYSTEM-USERNAME PG-USERNAME
43
+
44
+ {% for mapping in postgresql_user_map %}
45
+ {{mapping.name}} {{mapping.user}} {{mapping.pg_user}}
46
+ {% endfor %}