Merge branch '21535-multi-wf-delete'
[arvados.git] / tools / salt-install / config_examples / multi_host / aws / pillars / postgresql.sls
index 2eed52a1db93b80fad73051d00d22195d37d8dcb..1f5d8df83d71e116b71aca8b23f4b250f737c6dc 100644 (file)
@@ -3,12 +3,18 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
+{%- set domain = "__DOMAIN__" %}
+{%- set controller_nodes = "__CONTROLLER_NODES__".split(",") %}
+{%- set websocket_ip = "__WEBSOCKET_INT_IP__" %}
+{%- set keepbalance_ip = "__KEEPBALANCE_INT_IP__" %}
+{%- set pg_version = "__DATABASE_POSTGRESQL_VERSION__" %}
+
 ### POSTGRESQL
 postgres:
   pkgs_extra:
     - postgresql-contrib
   use_upstream_repo: true
-  version: '12'
+  version: {{ pg_version }}
   postgresconf: |-
     listen_addresses = '*'  # listen on all interfaces
   acls:
@@ -17,26 +23,24 @@ postgres:
     - ['host', 'all', 'all', '127.0.0.1/32', 'md5']
     - ['host', 'all', 'all', '::1/128', 'md5']
     - ['host', '__CLUSTER___arvados', '__CLUSTER___arvados', '127.0.0.1/32']
-    - ['host', '__CLUSTER___arvados', '__CLUSTER___arvados', '__CONTROLLER_INT_IP__/32']
+    - ['host', '__CLUSTER___arvados', '__CLUSTER___arvados', '{{ websocket_ip }}/32']
+    - ['host', '__CLUSTER___arvados', '__CLUSTER___arvados', '{{ keepbalance_ip }}/32']
+    {%- for controller_hostname in controller_nodes %}
+    {%- set controller_ip = salt['cmd.run']("getent hosts "+controller_hostname+" | awk '{print $1 ; exit}'", python_shell=True) %}
+    - ['host', '__CLUSTER___arvados', '__CLUSTER___arvados', '{{ controller_ip }}/32']
+    {%- endfor %}
   users:
     __CLUSTER___arvados:
       ensure: present
       password: "__DATABASE_PASSWORD__"
     prometheus:
       ensure: present
-
-  # tablespaces:
-  #   arvados_tablespace:
-  #     directory: /path/to/some/tbspace/arvados_tbsp
-  #     owner: arvados
-
   databases:
     __CLUSTER___arvados:
       owner: __CLUSTER___arvados
       template: template0
       lc_ctype: en_US.utf8
       lc_collate: en_US.utf8
-      # tablespace: arvados_tablespace
       schemas:
         public:
           owner: __CLUSTER___arvados