subspace 0.1.1 → 3.1.2

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 (210) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -0
  3. data/.ruby-version +1 -1
  4. data/.travis.yml +1 -1
  5. data/CHANGELOG.md +380 -0
  6. data/README.md +511 -9
  7. data/TODO +34 -0
  8. data/UPGRADING.md +10 -0
  9. data/ansible/playbooks/local_template.yml +13 -0
  10. data/ansible/playbooks/maintenance_mode.yml +5 -0
  11. data/ansible/roles/alienvault/tasks/main.yml +29 -0
  12. data/ansible/roles/apache/defaults/main.yml +2 -5
  13. data/ansible/roles/apache/handlers/main.yml +9 -1
  14. data/ansible/roles/apache/tasks/main.yml +37 -9
  15. data/ansible/roles/apache/templates/server_status.conf +6 -0
  16. data/ansible/roles/apache-rails/tasks/main.yml +26 -0
  17. data/ansible/roles/apache-rails/templates/_canonical_domain.conf +10 -0
  18. data/ansible/roles/apache-rails/templates/_rails.conf +23 -0
  19. data/ansible/roles/apache-rails/templates/project-ssl.conf +23 -0
  20. data/ansible/roles/apache-rails/templates/project.conf +5 -0
  21. data/ansible/roles/collectd/defaults/main.yml +3 -0
  22. data/ansible/roles/collectd/handlers/main.yml +3 -0
  23. data/ansible/roles/collectd/tasks/main.yml +82 -0
  24. data/ansible/roles/collectd/templates/apache2.conf +6 -0
  25. data/ansible/roles/collectd/templates/delayed_job_postgres.conf +21 -0
  26. data/ansible/roles/collectd/templates/df.conf +16 -0
  27. data/ansible/roles/collectd/templates/graphite.conf +14 -0
  28. data/ansible/roles/collectd/templates/hostname.conf +2 -0
  29. data/ansible/roles/collectd/templates/nginx.conf +28 -0
  30. data/ansible/roles/collectd/templates/nodejs-process.conf +3 -0
  31. data/ansible/roles/collectd/templates/puma-process.conf +3 -0
  32. data/ansible/roles/collectd/templates/rails_lograge.conf +31 -0
  33. data/ansible/roles/common/defaults/main.yml +2 -1
  34. data/ansible/roles/common/files/sudoers-service +1 -0
  35. data/ansible/roles/common/tasks/main.yml +307 -19
  36. data/ansible/roles/common/tasks/no_swap.yml +26 -0
  37. data/ansible/roles/common/tasks/swap.yml +34 -8
  38. data/ansible/roles/common/templates/motd +13 -0
  39. data/ansible/roles/common/templates/motd2 +24 -0
  40. data/ansible/roles/common/templates/terminalcolor +25 -0
  41. data/ansible/roles/delayed_job/README.md +2 -4
  42. data/ansible/roles/delayed_job/defaults/main.yml +0 -2
  43. data/ansible/roles/delayed_job/handlers/main.yml +1 -1
  44. data/ansible/roles/delayed_job/tasks/main.yml +22 -29
  45. data/ansible/roles/delayed_job/templates/delayed-job-monit-rc +6 -5
  46. data/ansible/roles/delayed_job/templates/delayed-job-systemd.service +33 -0
  47. data/ansible/roles/gem-patch-report/README.md +137 -0
  48. data/ansible/roles/gem-patch-report/defaults/main.yml +2 -0
  49. data/ansible/roles/gem-patch-report/tasks/main.yml +89 -0
  50. data/ansible/roles/gem-patch-report/templates/gem-patch-report.sh.j2 +114 -0
  51. data/ansible/roles/letsencrypt/defaults/main.yml +11 -1
  52. data/ansible/roles/letsencrypt/tasks/legacy.yml +44 -0
  53. data/ansible/roles/letsencrypt/tasks/main.yml +72 -76
  54. data/ansible/roles/letsencrypt/tasks/modern.yml +39 -0
  55. data/ansible/roles/logrotate/LICENSE +27 -0
  56. data/ansible/roles/logrotate/README.md +70 -0
  57. data/ansible/roles/logrotate/defaults/main.yml +2 -0
  58. data/ansible/roles/logrotate/meta/main.yml +18 -0
  59. data/ansible/roles/logrotate/tasks/main.yml +15 -0
  60. data/ansible/roles/logrotate/templates/logrotate.d.j2 +16 -0
  61. data/ansible/roles/memcache/defaults/main.yml +2 -0
  62. data/ansible/roles/memcache/tasks/main.yml +16 -1
  63. data/ansible/roles/mysql/meta/main.yml +1 -1
  64. data/ansible/roles/mysql/tasks/main.yml +2 -2
  65. data/ansible/roles/mysql2_gem/meta/main.yml +1 -1
  66. data/ansible/roles/mysql2_gem/tasks/main.yml +1 -1
  67. data/ansible/roles/newrelic/tasks/main.yml +8 -1
  68. data/ansible/roles/newrelic-infra/defaults/main.yml +2 -0
  69. data/ansible/roles/newrelic-infra/handlers/main.yml +5 -0
  70. data/ansible/roles/newrelic-infra/tasks/main.yml +38 -0
  71. data/ansible/roles/newrelic-infra/templates/logs.yml.j2 +5 -0
  72. data/ansible/roles/newrelic-infra/templates/newrelic-infra.yml.j2 +2 -0
  73. data/ansible/roles/nginx/defaults/main.yml +4 -0
  74. data/ansible/roles/nginx/handlers/main.yml +12 -0
  75. data/ansible/roles/nginx/tasks/main.yml +113 -14
  76. data/ansible/roles/nginx/templates/nginx.conf +29 -0
  77. data/ansible/roles/nginx/templates/status +10 -0
  78. data/ansible/roles/nginx-maintenance/tasks/main.yml +33 -0
  79. data/ansible/roles/nginx-rails/defaults/main.yml +6 -0
  80. data/ansible/roles/nginx-rails/tasks/main.yml +54 -0
  81. data/ansible/roles/nginx-rails/templates/_asset_cors.conf +11 -0
  82. data/ansible/roles/nginx-rails/templates/_rails.conf +35 -0
  83. data/ansible/roles/nginx-rails/templates/_upstream.conf +11 -0
  84. data/ansible/roles/nginx-rails/templates/default_server +5 -0
  85. data/ansible/roles/nginx-rails/templates/nginx-project +9 -0
  86. data/ansible/roles/nginx-rails/templates/nginx-project-ssl +23 -0
  87. data/ansible/roles/nodejs/tasks/main.yml +33 -0
  88. data/ansible/roles/papertrail/tasks/main.yml +23 -4
  89. data/ansible/roles/papertrail/templates/log_files.yml +8 -1
  90. data/ansible/roles/postgis/.gitignore +3 -0
  91. data/ansible/roles/postgis/CHANGELOG.md +24 -0
  92. data/ansible/roles/postgis/LICENSE +202 -0
  93. data/ansible/roles/postgis/README.md +12 -0
  94. data/ansible/roles/postgis/meta/main.yml +15 -0
  95. data/ansible/roles/postgis/tasks/main.yml +20 -0
  96. data/ansible/roles/postgresql/README.md +15 -0
  97. data/ansible/roles/postgresql/defaults/main.yml +3 -0
  98. data/ansible/roles/postgresql/handlers/main.yml +1 -1
  99. data/ansible/roles/postgresql/meta/main.yml +1 -6
  100. data/ansible/roles/postgresql/tasks/backups.yml +8 -6
  101. data/ansible/roles/postgresql/tasks/main.yml +89 -9
  102. data/ansible/roles/postgresql/templates/backup.sh +17 -2
  103. data/ansible/roles/postgresql-client/tasks/main.yml +91 -0
  104. data/ansible/roles/puma/tasks/main.yml +38 -19
  105. data/ansible/roles/puma/templates/puma-monit-rc +5 -0
  106. data/ansible/roles/puma/templates/puma-systemd.service +43 -0
  107. data/ansible/roles/puma/templates/puma-systemd.socket +14 -0
  108. data/ansible/roles/puma/templates/puma.rb +24 -12
  109. data/ansible/roles/rails/defaults/main.yml +1 -3
  110. data/ansible/roles/rails/tasks/main.yml +76 -18
  111. data/ansible/roles/rails/templates/application.yml +1 -1
  112. data/ansible/roles/rails/templates/database.yml +3 -3
  113. data/ansible/roles/redis/defaults/main.yml +2 -0
  114. data/ansible/roles/redis/tasks/main.yml +45 -3
  115. data/ansible/roles/resque/tasks/main.yml +14 -0
  116. data/ansible/roles/resque/templates/resque-monit-rc +4 -0
  117. data/ansible/roles/resque/templates/resque-systemd.service +54 -0
  118. data/ansible/roles/ruby-common/README.md +1 -1
  119. data/ansible/roles/ruby-common/defaults/main.yml +1 -0
  120. data/ansible/roles/ruby-common/tasks/main.yml +55 -13
  121. data/ansible/roles/sidekiq/README.md +1 -0
  122. data/ansible/roles/sidekiq/defaults/main.yml +2 -0
  123. data/ansible/roles/sidekiq/tasks/main.yml +15 -0
  124. data/ansible/roles/sidekiq/templates/sidekiq-monit-rc +4 -0
  125. data/ansible/roles/sidekiq/templates/sidekiq-systemd.service +63 -0
  126. data/ansible/roles/tailscale/defaults/main.yml +2 -0
  127. data/ansible/roles/tailscale/tasks/main.yml +40 -0
  128. data/ansible/roles/yarn/tasks/main.yml +19 -0
  129. data/ansible/roles/zenoamaro.postgresql/.gitignore +1 -0
  130. data/ansible/roles/zenoamaro.postgresql/.travis.yml +28 -0
  131. data/ansible/roles/zenoamaro.postgresql/LICENSE.md +21 -0
  132. data/ansible/roles/zenoamaro.postgresql/README.md +117 -0
  133. data/ansible/roles/zenoamaro.postgresql/Vagrantfile +62 -0
  134. data/ansible/roles/zenoamaro.postgresql/boxed.yml +26 -0
  135. data/ansible/roles/zenoamaro.postgresql/defaults/main.yml +607 -0
  136. data/ansible/roles/zenoamaro.postgresql/handlers/main.yml +8 -0
  137. data/ansible/roles/zenoamaro.postgresql/inventory +19 -0
  138. data/ansible/roles/zenoamaro.postgresql/main.yml +19 -0
  139. data/ansible/roles/zenoamaro.postgresql/meta/.galaxy_install_info +1 -0
  140. data/ansible/roles/zenoamaro.postgresql/meta/main.yml +21 -0
  141. data/ansible/roles/zenoamaro.postgresql/tasks/configure.yml +55 -0
  142. data/ansible/roles/zenoamaro.postgresql/tasks/extensions.yml +49 -0
  143. data/ansible/roles/zenoamaro.postgresql/tasks/install.yml +51 -0
  144. data/ansible/roles/zenoamaro.postgresql/tasks/main.yml +5 -0
  145. data/ansible/roles/zenoamaro.postgresql/templates/environment +11 -0
  146. data/ansible/roles/zenoamaro.postgresql/templates/pg_ctl.conf +5 -0
  147. data/ansible/roles/zenoamaro.postgresql/templates/pg_hba.conf +112 -0
  148. data/ansible/roles/zenoamaro.postgresql/templates/pg_ident.conf +46 -0
  149. data/ansible/roles/zenoamaro.postgresql/templates/postgresql.conf +536 -0
  150. data/ansible/roles/zenoamaro.postgresql/test.yml +24 -0
  151. data/bin/console +0 -4
  152. data/exe/subspace +3 -84
  153. data/lib/subspace/cli.rb +168 -0
  154. data/lib/subspace/commands/ansible.rb +35 -0
  155. data/lib/subspace/commands/base.rb +94 -0
  156. data/lib/subspace/commands/bootstrap.rb +49 -0
  157. data/lib/subspace/commands/configure.rb +27 -0
  158. data/lib/subspace/commands/exec.rb +20 -0
  159. data/lib/subspace/commands/init.rb +144 -0
  160. data/lib/subspace/commands/inventory.rb +54 -0
  161. data/lib/subspace/commands/maintain.rb +16 -0
  162. data/lib/subspace/commands/maintenance_mode.rb +16 -0
  163. data/lib/subspace/commands/override.rb +21 -0
  164. data/lib/subspace/commands/provision.rb +14 -0
  165. data/lib/subspace/commands/secrets.rb +69 -0
  166. data/lib/subspace/commands/ssh.rb +33 -0
  167. data/lib/subspace/commands/terraform.rb +89 -0
  168. data/lib/subspace/configuration.rb +71 -0
  169. data/lib/subspace/inventory.rb +144 -0
  170. data/lib/subspace/version.rb +1 -1
  171. data/lib/subspace.rb +8 -1
  172. data/subspace.gemspec +14 -3
  173. data/template/provision.rb.erb +94 -0
  174. data/template/subspace/.gitignore +6 -0
  175. data/template/subspace/ansible.cfg.erb +17 -0
  176. data/template/subspace/group_vars/all.erb +28 -0
  177. data/template/subspace/group_vars/template.erb +26 -0
  178. data/template/subspace/inventory.yml.erb +12 -0
  179. data/template/subspace/playbook.yml.erb +18 -0
  180. data/template/subspace/secrets/template.erb +5 -0
  181. data/template/subspace/templates/application.yml.template +27 -0
  182. data/template/subspace/templates/authorized_keys.erb +1 -0
  183. data/template/subspace/terraform/.gitignore +2 -0
  184. data/template/subspace/terraform/template/main-oxenwagen.tf.erb +116 -0
  185. data/template/subspace/terraform/template/main-workhorse.tf.erb +41 -0
  186. data/template/subspace/terraformrc.erb +9 -0
  187. data/terraform/modules/s3_backend/README +2 -0
  188. data/terraform/modules/s3_backend/dynamodb.tf +1 -0
  189. data/terraform/modules/s3_backend/iam_user.tf +38 -0
  190. data/terraform/modules/s3_backend/main.tf +39 -0
  191. data/terraform/modules/s3_backend/state_bucket.tf +14 -0
  192. metadata +198 -29
  193. data/ansible/roles/apache/templates/project.conf +0 -25
  194. data/ansible/roles/aws/tasks/main.yml +0 -46
  195. data/ansible/roles/delayed_job/files/deploy-service +0 -2
  196. data/ansible/roles/delayed_job/files/monit-http.conf +0 -3
  197. data/ansible/roles/letsencrypt/templates/project-le-ssl.conf +0 -31
  198. data/ansible/roles/nginx/templates/nginx-project +0 -27
  199. data/ansible/roles/puma/templates/etc-init-puma-manager.conf +0 -31
  200. data/ansible/roles/puma/templates/etc-init-puma.conf +0 -69
  201. data/lib/subspace/railtie.rb +0 -9
  202. data/lib/tasks/provision.rake +0 -12
  203. data/template/provision/.gitignore +0 -1
  204. data/template/provision/ansible.cfg.erb +0 -5
  205. data/template/provision/group_vars/all.erb +0 -12
  206. data/template/provision/group_vars/template.erb +0 -14
  207. data/template/provision/host_vars/template.erb +0 -4
  208. data/template/provision/playbook.yml.erb +0 -26
  209. data/template/provision/vars/template.erb +0 -4
  210. /data/template/{provision → subspace}/hosts.erb +0 -0
@@ -0,0 +1,607 @@
1
+ ---
2
+
3
+ # BS -- Commenting this out to force people to
4
+ # postgresql_version: 9.4
5
+
6
+ # This will be the main admin user, which is only allowed to connect
7
+ # from localhost, mainly for provisioning, maintenance and scripts.
8
+ postgresql_admin_user: postgres
9
+ postgresql_admin_group: "{{postgresql_admin_user}}"
10
+
11
+ # TODO: This has been modeled but there's no real support for clusters yet
12
+ postgresql_cluster: main
13
+
14
+
15
+ # File locations
16
+ # --------------
17
+
18
+
19
+ # Store postgres' configuration files here
20
+ postgresql_conf_directory: "/etc/postgresql/{{postgresql_version}}/{{postgresql_cluster}}"
21
+ # Host-based authentication file
22
+ postgresql_hba_file: "{{postgresql_conf_directory}}/pg_hba.conf"
23
+ # Ident configuration file
24
+ postgresql_ident_file: "{{postgresql_conf_directory}}/pg_ident.conf"
25
+ # Use data in another directory
26
+ postgresql_data_directory: "/var/lib/postgresql/{{postgresql_version}}/{{postgresql_cluster}}"
27
+ # Directory to store runtime data such as PIDs
28
+ postgresql_runtime_directory: "/var/run/postgresql"
29
+ # If external_pid_file is not explicitly set, on extra PID file is written
30
+ postgresql_external_pid_file: "{{postgresql_runtime_directory}}/{{postgresql_version}}-{{postgresql_cluster}}.pid"
31
+ # Store postgresql's logs files here
32
+ postgresql_log_directory: "/var/log/postgresql"
33
+
34
+
35
+ # Connections and authentication
36
+ # ------------------------------
37
+
38
+ # Use 'localhost' for local addresses only. Use '*' alone to
39
+ # listen on every available address.
40
+ postgresql_listen_addresses:
41
+ - localhost
42
+ postgresql_port: 5432
43
+
44
+ # Authenticated connections that will be inserted in `pg_hba.conf`.
45
+ # These won't overwrite the default local idents, which are left
46
+ # untouched as they are useful and safe.
47
+ #
48
+ # Specify connections as a list of hashes having this schema:
49
+ # - type: local
50
+ # user: postgres
51
+ # method: peer
52
+ # database: 'all' # defaults to 'samerole', can also be a list
53
+ # address: '192.168.0.0/24' # optional
54
+ # options: # optional
55
+ # key: value
56
+ #
57
+ # The first field is the connection type: "local" is a Unix-domain
58
+ # socket, "host" is either a plain or SSL-encrypted TCP/IP socket,
59
+ # "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a
60
+ # plain TCP/IP socket.
61
+ #
62
+ # DATABASE can be "all", "sameuser", "samerole", "replication", a
63
+ # database name, or a comma-separated list thereof. The "all"
64
+ # keyword does not match "replication". Access to replication
65
+ # must be enabled in a separate record (see example below).
66
+ #
67
+ # USER can be "all", a user name, a group name prefixed with "+", or a
68
+ # comma-separated list thereof. In both the DATABASE and USER fields
69
+ # you can also write a file name prefixed with "@" to include names
70
+ # from a separate file.
71
+ #
72
+ # ADDRESS specifies the set of hosts the record matches. It can be a
73
+ # host name, or it is made up of an IP address and a CIDR mask that is
74
+ # an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that
75
+ # specifies the number of significant bits in the mask. A host name
76
+ # that starts with a dot (.) matches a suffix of the actual host name.
77
+ # Alternatively, you can write an IP address and netmask in separate
78
+ # columns to specify the set of hosts. Instead of a CIDR-address, you
79
+ # can write "samehost" to match any of the server's own IP addresses,
80
+ # or "samenet" to match any address in any subnet that the server is
81
+ # directly connected to.
82
+ #
83
+ # METHOD can be "trust", "reject", "md5", "password", "gss", "sspi",
84
+ # "krb5", "ident", "peer", "pam", "ldap", "radius" or "cert". Note that
85
+ # "password" sends passwords in clear text; "md5" is preferred since
86
+ # it sends encrypted passwords.
87
+ #
88
+ # Database and user names containing spaces, commas, quotes and other
89
+ # special characters must be quoted. Quoting one of the keywords
90
+ # "all", "sameuser", "samerole" or "replication" makes the name lose
91
+ # its special character, and just match a database or username with
92
+ # that name.
93
+ postgresql_authentication: []
94
+
95
+ # Authenticated connections that will be inserted in `pg_hba.conf`.
96
+ # These won't overwrite the default local idents, which are left
97
+ # untouched as they are useful and safe.
98
+ # Specify connections as a list of hashes having this schema:
99
+ # - name: map_a
100
+ # user: system_user
101
+ # pg_user: postgresql_user
102
+ postgresql_user_map: []
103
+
104
+ # A dict whose `key: value`s will be provided as environment
105
+ # variables for the postmaster.
106
+ postgresql_env: {}
107
+
108
+ # Note: Increasing max_connections costs ~400 bytes of shared memory per
109
+ # connection slot, plus lock space (see max_locks_per_transaction).
110
+ postgresql_max_connections: 1024
111
+ postgresql_superuser_reserved_connections: 3
112
+
113
+ postgresql_unix_socket_directories: # comma-separated list of directories
114
+ - /var/run/postgresql
115
+ postgresql_unix_socket_group: ''
116
+ postgresql_unix_socket_permissions: '0777' # begin with 0 to use octal notation
117
+
118
+ # Automatic pg_ctl configuration. Specify a list of options containing
119
+ # cluster specific options to be passed to pg_ctl(1).
120
+ postgresql_pg_ctl_options: []
121
+
122
+ postgresql_bonjour: off # advertise server via Bonjour
123
+ postgresql_bonjour_name: '' # defaults to the computer name
124
+
125
+
126
+ # Security and Authentication
127
+ # ---------------------------
128
+
129
+ postgresql_authentication_timeout: 60s
130
+ postgresql_ssl: off
131
+ postgresql_ssl_ciphers:
132
+ - 'DEFAULT'
133
+ - '!LOW'
134
+ - '!EXP'
135
+ - '!MD5'
136
+ - '@STRENGTH'
137
+ postgresql_ssl_renegotiation_limit: 512MB # amount of data between renegotiations
138
+ postgresql_ssl_cert_file: /etc/ssl/certs/ssl-cert-snakeoil.pem
139
+ postgresql_ssl_key_file: /etc/ssl/private/ssl-cert-snakeoil.key
140
+ postgresql_ssl_ca_file: ''
141
+ postgresql_ssl_crl_file: ''
142
+ postgresql_password_encryption: on
143
+ postgresql_db_user_namespace: off
144
+
145
+ # Kerberos and GSSAPI
146
+ postgresql_krb_server_keyfile: ''
147
+ postgresql_krb_caseins_users: off
148
+
149
+ # TCP Keepalives, 0 selects the system default
150
+ postgresql_tcp_keepalives_idle: 0
151
+ postgresql_tcp_keepalives_interval: 0
152
+ postgresql_tcp_keepalives_count: 0
153
+
154
+
155
+ # Memory
156
+ # ------
157
+
158
+ postgresql_shared_buffers: 128MB # min 128kB
159
+ postgresql_temp_buffers: 8MB # min 800kB
160
+ postgresql_work_mem: 1MB # min 64kB
161
+ postgresql_maintenance_work_mem: 16MB # min 1MB
162
+ postgresql_max_stack_depth: 2MB # min 100kB
163
+
164
+ # Note: Increasing max_prepared_transactions costs ~600 bytes of shared memory
165
+ # per transaction slot, plus lock space (see max_locks_per_transaction).
166
+ # It is not advisable to set max_prepared_transactions nonzero unless you
167
+ # actively intend to use prepared transactions.
168
+ postgresql_max_prepared_transactions: 0 # zero disables the feature
169
+
170
+ # Disk
171
+ # ----
172
+
173
+ # limits per-session temp file space in kB, or -1 for off limit
174
+ postgresql_temp_file_limit: -1
175
+
176
+ # Kernel Resource Usage
177
+ # ---------------------
178
+
179
+ postgresql_max_files_per_process: 1000 # min 25
180
+ postgresql_shared_preload_libraries: []
181
+
182
+
183
+ # Lock Management
184
+ # ---------------
185
+
186
+ postgresql_deadlock_timeout: 1s
187
+ postgresql_max_locks_per_transaction: 64 # min 10
188
+
189
+ # Note: Each lock table slot uses ~270 bytes of shared memory, and there are
190
+ # max_locks_per_transaction * (max_connections + max_prepared_transactions)
191
+ # lock table slots.
192
+ postgresql_max_pred_locks_per_transaction: 64 # min 10
193
+
194
+
195
+ # Write Ahead Log
196
+ # ---------------
197
+
198
+ postgresql_wal_level: minimal # minimal, archive, or hot_standby
199
+ postgresql_fsync: on # turns forced synchronization on or off
200
+
201
+ # Synchronization level:
202
+ # - off
203
+ # - local
204
+ # - remote_write
205
+ # - on
206
+ postgresql_synchronous_commit: on
207
+
208
+ # The default is the first option supported by the operating system:
209
+ # - open_datasync
210
+ # - fdatasync (default on Linux)
211
+ # - fsync
212
+ # - fsync_writethrough
213
+ # - open_sync
214
+ postgresql_wal_sync_method: fsync
215
+
216
+ # recover from partial page writes
217
+ postgresql_full_page_writes: on
218
+
219
+ postgresql_wal_buffers: -1 # min 32kB, -1 sets based on shared_buffers
220
+ postgresql_wal_writer_delay: 200ms # 1-10000 milliseconds
221
+ postgresql_commit_delay: 0 # range 0-100000, in microseconds
222
+ postgresql_commit_siblings: 5 # range 1-1000
223
+
224
+ postgresql_checkpoint_segments: 3 # in logfile segments, min 1, 16MB each
225
+ postgresql_checkpoint_timeout: 5min # range 30s-1h
226
+ postgresql_checkpoint_completion_target: 0.5 # checkpoint target duration, 0.0 - 1.0
227
+ postgresql_checkpoint_warning: 30s # 0 disables
228
+
229
+ # allows archiving to be done
230
+ postgresql_archive_mode: off
231
+
232
+ # Command to use to archive a logfile segment.
233
+ # Placeholders: %p = path of file to archive
234
+ # %f = file name only
235
+ # e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'
236
+ postgresql_archive_command: ''
237
+
238
+ # force a logfile segment switch after this
239
+ postgresql_archive_timeout: 0
240
+
241
+
242
+ # Replication
243
+ # -----------
244
+
245
+ # Set these on the master and on any standby that will send replication data.
246
+
247
+ # max number of walsender processes
248
+ postgresql_max_wal_senders: 0
249
+
250
+ postgresql_wal_keep_segments: 0 # in logfile segments, 16MB each; 0 disables
251
+ postgresql_wal_sender_timeout: 60s # in milliseconds; 0 disables
252
+
253
+ # Replication (masters)
254
+ # ---------------------
255
+
256
+ # These settings are ignored on a standby server.
257
+
258
+ # Standby servers that provide sync rep.
259
+ # Comma-separated list of application_name from standby(s)
260
+ postgresql_synchronous_standby_names: [] # '*' means 'all'
261
+
262
+ # number of xacts by which cleanup is delayed
263
+ postgresql_vacuum_defer_cleanup_age: 0
264
+
265
+ # "on" allows queries during recovery
266
+ postgresql_hot_standby: off
267
+ # max delay before canceling queries when reading WAL from archive
268
+ postgresql_max_standby_archive_delay: 30s # -1 allows indefinite delay
269
+ # max delay before canceling queries when reading streaming WAL;
270
+ postgresql_max_standby_streaming_delay: 30s # -1 allows indefinite delay
271
+ # send replies at least this often
272
+ postgresql_wal_receiver_status_interval: 10s # 0 disables
273
+ # send info from standby to prevent query conflicts
274
+ postgresql_hot_standby_feedback: off
275
+ #time that receiver waits for communication from master in milliseconds
276
+ postgresql_wal_receiver_timeout: 60s
277
+
278
+
279
+ # Error Reporting And Logging
280
+ # ---------------------------
281
+
282
+ # Valid values are combinations of stderr, csvlog, syslog, and eventlog.
283
+ # depending on platform. Csvlog requires logging_collector to be on.
284
+ postgresql_log_destination: stderr
285
+
286
+ # Enable capturing of stderr and csvlog into log files.
287
+ # Required to be on for csvlogs.
288
+ postgresql_logging_collector: on
289
+
290
+ # These are only used if logging_collector is on:
291
+
292
+ # Log file name pattern, can include strftime() escapes
293
+ postgresql_log_filename: postgresql-%Y-%m-%d_%H%M%S.log
294
+ postgresql_log_file_mode: '0600' # begin with 0 to use octal notation
295
+ # If on, an existing log file with the same name as the new log file will be
296
+ # truncated rather than appended to. But such truncation only occurs on
297
+ # time-driven rotation, not on restarts or size-driven rotation. Default is
298
+ # off, meaning append to existing files in all cases.
299
+ postgresql_log_truncate_on_rotation: off
300
+ # Automatic rotation of logfiles will happen after that time.
301
+ postgresql_log_rotation_age: 1d
302
+ # Automatic rotation of logfiles will happen after that much log output.
303
+ postgresql_log_rotation_size: 10MB
304
+
305
+ # These are relevant when logging to syslog:
306
+ postgresql_syslog_facility: LOCAL0
307
+ postgresql_syslog_ident: postgres
308
+ # This is only relevant when logging to eventlog (win32):
309
+ postgresql_event_source: PostgreSQL
310
+
311
+ # Values in order of decreasing detail:
312
+ # - debug5
313
+ # - debug4
314
+ # - debug3
315
+ # - debug2
316
+ # - debug1
317
+ # - log
318
+ # - notice
319
+ # - warning
320
+ # - error
321
+ postgresql_client_min_messages: notice
322
+
323
+ # Values in order of decreasing detail:
324
+ # - debug5
325
+ # - debug4
326
+ # - debug3
327
+ # - debug2
328
+ # - debug1
329
+ # - info
330
+ # - notice
331
+ # - warning
332
+ # - error
333
+ # - log
334
+ # - fatal
335
+ # - panic
336
+ postgresql_log_min_messages: warning
337
+
338
+ # Values in order of decreasing detail:
339
+ # - debug5
340
+ # - debug4
341
+ # - debug3
342
+ # - debug2
343
+ # - debug1
344
+ # - info
345
+ # - notice
346
+ # - warning
347
+ # - error
348
+ # - log
349
+ # - fatal
350
+ # - panic (effectively off)
351
+ postgresql_log_min_error_statement: error
352
+
353
+ # -1 is disabled, 0 logs all statements and their durations, > 0 logs only
354
+ # statements running at least this number of milliseconds
355
+ postgresql_log_min_duration_statement: -1
356
+
357
+ postgresql_debug_print_parse: off
358
+ postgresql_debug_print_rewritten: off
359
+ postgresql_debug_print_plan: off
360
+ postgresql_debug_pretty_print: on
361
+ postgresql_log_checkpoints: off
362
+ postgresql_log_connections: off
363
+ postgresql_log_disconnections: off
364
+ postgresql_log_duration: off
365
+ postgresql_log_error_verbosity: default # terse, default, or verbose messages
366
+ postgresql_log_hostname: off
367
+
368
+ # Special values:
369
+ # %a = application name
370
+ # %u = user name
371
+ # %d = database name
372
+ # %r = remote host and port
373
+ # %h = remote host
374
+ # %p = process ID
375
+ # %t = timestamp without milliseconds
376
+ # %m = timestamp with milliseconds
377
+ # %i = command tag
378
+ # %e = SQL state
379
+ # %c = session ID
380
+ # %l = session line number
381
+ # %s = sessioan start timestamp
382
+ # %v = virtual transaction ID
383
+ # %x = transaction ID (0 if none)
384
+ # %q = stop here in non-session
385
+ # processes
386
+ # %% = '%'
387
+ postgresql_log_line_prefix: '%t '
388
+
389
+ # log lock waits >= deadlock_timeout
390
+ postgresql_log_lock_waits: off
391
+ postgresql_log_statement: none # none, ddl, mod, all
392
+ # log temporary files equal or larger
393
+ postgresql_log_temp_files: -1
394
+ postgresql_log_timezone: UTC
395
+
396
+
397
+ # Runtime statistics
398
+ # ------------------
399
+
400
+ postgresql_track_activities: on
401
+ postgresql_track_counts: on
402
+ postgresql_track_io_timing: off
403
+ postgresql_track_functions: none # none, pl, all
404
+ postgresql_track_activity_query_size: 1024
405
+ postgresql_update_process_title: on
406
+ postgresql_stats_temp_directory: pg_stat_tmp
407
+
408
+ postgresql_log_parser_stats: off
409
+ postgresql_log_planner_stats: off
410
+ postgresql_log_executor_stats: off
411
+ postgresql_log_statement_stats: off
412
+
413
+
414
+ # Error Handling
415
+ # --------------
416
+
417
+ # Terminate session on any error?
418
+ postgresql_exit_on_error: off
419
+ # Reinitialize after backend crash?
420
+ postgresql_restart_after_crash: on
421
+
422
+
423
+ # Query Tuning (Planner)
424
+ # ----------------------
425
+
426
+ postgresql_enable_bitmapscan: on
427
+ postgresql_enable_hashagg: on
428
+ postgresql_enable_hashjoin: on
429
+ postgresql_enable_indexscan: on
430
+ postgresql_enable_indexonlyscan: on
431
+ postgresql_enable_material: on
432
+ postgresql_enable_mergejoin: on
433
+ postgresql_enable_nestloop: on
434
+ postgresql_enable_seqscan: on
435
+ postgresql_enable_sort: on
436
+ postgresql_enable_tidscan: on
437
+
438
+ postgresql_seq_page_cost: 1.0 # measured on an arbitrary scale
439
+ postgresql_random_page_cost: 4.0 # same scale as above
440
+ postgresql_cpu_tuple_cost: 0.01 # same scale as above
441
+ postgresql_cpu_index_tuple_cost: 0.005 # same scale as above
442
+ postgresql_cpu_operator_cost: 0.0025 # same scale as above
443
+ postgresql_effective_cache_size: 128MB
444
+
445
+ # Query Tuning (Genetic Query Optimizer)
446
+ # --------------------------------------
447
+
448
+ postgresql_geqo: on
449
+ postgresql_geqo_threshold: 12
450
+ postgresql_geqo_effort: 5 # range 1-10
451
+ postgresql_geqo_pool_size: 0 # selects default based on effort
452
+ postgresql_geqo_generations: 0 # selects default based on effort
453
+ postgresql_geqo_selection_bias: 2.0 # range 1.5-2.0
454
+ postgresql_geqo_seed: 0.0 # range 0.0-1.0
455
+
456
+ # Query Tuning (Other Planner Options)
457
+ # ------------------------------------
458
+
459
+ postgresql_default_statistics_target: 100 # range 1-10000
460
+ postgresql_constraint_exclusion: partition # on, off, or partition
461
+ postgresql_cursor_tuple_fraction: 0.1 # range 0.0-1.0
462
+ postgresql_from_collapse_limit: 8
463
+ postgresql_join_collapse_limit: 8 # 1 disables collapsing of explicit
464
+
465
+
466
+ # Cost-Based Vacuum Delay
467
+ # -----------------------
468
+
469
+ postgresql_vacuum_cost_delay: 0 # 0-100 milliseconds
470
+ postgresql_vacuum_cost_page_hit: 1 # 0-10000 credits
471
+ postgresql_vacuum_cost_page_miss: 10 # 0-10000 credits
472
+ postgresql_vacuum_cost_page_dirty: 20 # 0-10000 credits
473
+ postgresql_vacuum_cost_limit: 200 # 1-10000 credits
474
+
475
+
476
+ # Autovacuum Parameters
477
+ # ---------------------
478
+
479
+ # Enable autovacuum subprocess? 'on' requires track_counts to also be on.
480
+ postgresql_autovacuum: on
481
+ # -1 disables, 0 logs all actions and their durations, > 0 logs only
482
+ # actions running at least this number of milliseconds.
483
+ postgresql_log_autovacuum_min_duration: -1
484
+ # max number of autovacuum subprocesses
485
+ postgresql_autovacuum_max_workers: 3
486
+ # time between autovacuum runs
487
+ postgresql_autovacuum_naptime: 1min
488
+ # min number of row updates before vacuum
489
+ postgresql_autovacuum_vacuum_threshold: 50
490
+ # min number of row updates before analyze
491
+ postgresql_autovacuum_analyze_threshold: 50
492
+ # fraction of table size before vacuum
493
+ postgresql_autovacuum_vacuum_scale_factor: 0.2
494
+ # fraction of table size before analyze
495
+ postgresql_autovacuum_analyze_scale_factor: 0.1
496
+ # maximum XID age before forced vacuum
497
+ postgresql_autovacuum_freeze_max_age: 200000000
498
+ # default vacuum cost delay for autovacuum, in milliseconds
499
+ postgresql_autovacuum_vacuum_cost_delay: 20ms
500
+ # default vacuum cost limit for autovacuum,
501
+ postgresql_autovacuum_vacuum_cost_limit: -1
502
+
503
+
504
+ # Background Writer
505
+ # -----------------
506
+
507
+ postgresql_bgwriter_delay: 200ms # 10-10000ms between rounds
508
+ postgresql_bgwriter_lru_maxpages: 100 # 0-1000 max buffers written/round
509
+ postgresql_bgwriter_lru_multiplier: 2.0 # 0-10.0 multipler on buffers scanned/round
510
+
511
+
512
+ # Asynchronous Behavior
513
+ # ---------------------
514
+
515
+ postgresql_effective_io_concurrency: 1 # 1-1000; 0 disables prefetching
516
+
517
+
518
+ # Client Connection Defaults
519
+ # --------------------------
520
+
521
+ postgresql_search_path: # schema names
522
+ - '"$user"'
523
+ - public
524
+ postgresql_default_tablespace: '' # a tablespace name, '' uses the default
525
+ postgresql_temp_tablespaces: [] # a list of tablespace names
526
+
527
+ postgresql_check_function_bodies: on
528
+ postgresql_default_transaction_isolation: read committed
529
+ postgresql_default_transaction_read_only: off
530
+ postgresql_default_transaction_deferrable: off
531
+ postgresql_session_replication_role: origin
532
+
533
+ postgresql_statement_timeout: 0 # in milliseconds, 0 is disabled
534
+ postgresql_lock_timeout: 0 # in milliseconds, 0 is disabled
535
+ postgresql_vacuum_freeze_min_age: 50000000
536
+ postgresql_vacuum_freeze_table_age: 150000000
537
+
538
+ postgresql_bytea_output: hex # hex, escape
539
+ postgresql_xmlbinary: base64
540
+ postgresql_xmloption: content
541
+
542
+ # Select the set of available time zone abbreviations. Currently, there are:
543
+ # Default
544
+ # Australia
545
+ # India
546
+ # You can create your own file in `share/timezonesets/`.
547
+ postgresql_timezone_abbreviations: Default
548
+
549
+ postgresql_datestyle:
550
+ - iso
551
+ - mdy
552
+ postgresql_intervalstyle: postgres
553
+ postgresql_timezone: UTC
554
+ postgresql_extra_float_digits: 0 # min -15, max 3
555
+ postgresql_client_encoding: sql_ascii # 'sql_ascii' actually defaults to database encoding
556
+
557
+ # These settings are initialized by initdb, but they can be changed.
558
+
559
+ # locale for system error message
560
+ postgresql_lc_messages: en_US.UTF-8
561
+ # locale for monetary formatting
562
+ postgresql_lc_monetary: en_US.UTF-8
563
+ # locale for number formatting
564
+ postgresql_lc_numeric: en_US.UTF-8
565
+ # locale for time formatting
566
+ postgresql_lc_time: en_US.UTF-8
567
+
568
+ postgresql_default_text_search_config: pg_catalog.english
569
+
570
+ postgresql_dynamic_library_path: '$libdir'
571
+ postgresql_local_preload_libraries: []
572
+
573
+
574
+ # Version/platform Compatibility
575
+ # ------------------------------
576
+
577
+ postgresql_array_nulls: on
578
+ postgresql_backslash_quote: safe_encoding # on, off, or safe_encoding
579
+ postgresql_default_with_oids: off
580
+ postgresql_escape_string_warning: on
581
+ postgresql_lo_compat_privileges: off
582
+ postgresql_quote_all_identifiers: off
583
+ postgresql_sql_inheritance: on
584
+ postgresql_standard_conforming_strings: on
585
+ postgresql_synchronize_seqscans: on
586
+ postgresql_transform_null_equals: off
587
+
588
+
589
+ # Extensions
590
+ # ----------
591
+
592
+ # If enabled, this will install the contrib packages.
593
+
594
+ postgresql_contrib: no
595
+
596
+
597
+ # If enabled, will install the [PostGIS] extension
598
+ # from the repositories, at the indicated version.
599
+ # [PostGIS] http://postgis.net/
600
+
601
+ postgresql_postgis: no
602
+ postgresql_postgis_version: '2.1'
603
+
604
+
605
+ # If enabled, this will install the development headers.
606
+
607
+ postgresql_dev_headers: no
@@ -0,0 +1,8 @@
1
+ ---
2
+ - name: restart postgresql
3
+ become: yes
4
+ service: name=postgresql state=restarted
5
+
6
+ - name: reload postgresql
7
+ become: yes
8
+ service: name=postgresql state=reloaded
@@ -0,0 +1,19 @@
1
+ [boxed]
2
+ 192.168.33.10 ansible_ssh_private_key_file=.vagrant/machines/boxed/virtualbox/private_key
3
+
4
+ [test-ubuntu-precise]
5
+ 192.168.33.20 ansible_ssh_private_key_file=.vagrant/machines/test-ubuntu-precise/virtualbox/private_key
6
+
7
+ [test-ubuntu-trusty]
8
+ 192.168.33.21 ansible_ssh_private_key_file=.vagrant/machines/test-ubuntu-trusty/virtualbox/private_key
9
+
10
+ [test:children]
11
+ test-ubuntu-precise
12
+ test-ubuntu-trusty
13
+
14
+ [vagrant:children]
15
+ test
16
+ boxed
17
+
18
+ [vagrant:vars]
19
+ ansible_ssh_user=vagrant
@@ -0,0 +1,19 @@
1
+ ---
2
+
3
+ # Quick-provisioning playbook
4
+ # ---------------------------
5
+
6
+ # A Simple, straight playbook for quick remote installations.
7
+ # You will be asked which hosts to provision before-hand.
8
+
9
+
10
+ - name: 'PostgreSQL'
11
+
12
+ vars_prompt:
13
+ selected_hosts: Specify the hosts to provision
14
+
15
+ hosts: "{{selected_hosts}}"
16
+
17
+ roles:
18
+ - '.' # The current directory itself is the role
19
+
@@ -0,0 +1 @@
1
+ {install_date: 'Mon Jan 2 18:15:21 2017', version: v0.1.2}
@@ -0,0 +1,21 @@
1
+ ---
2
+
3
+ galaxy_info:
4
+ author: zenoamaro
5
+ description: A role for installing and configuring PostgreSQL
6
+ version: 0.1.2
7
+ license: MIT
8
+ min_ansible_version: 1.4
9
+
10
+ platforms:
11
+ - name: Debian
12
+ - name: Ubuntu
13
+ versions:
14
+ - precise
15
+ - trusty
16
+
17
+ categories:
18
+ - database
19
+ - database:sql
20
+
21
+ dependencies: []