You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2021/06/03 03:03:16 UTC

[GitHub] [trafficcontrol] jhg03a commented on a change in pull request #5909: Update Ansible automation to initialize Traffic Vault Postgres backend

jhg03a commented on a change in pull request #5909:
URL: https://github.com/apache/trafficcontrol/pull/5909#discussion_r644446468



##########
File path: infrastructure/ansible/roles/traffic_ops/defaults/main.yml
##########
@@ -138,6 +138,26 @@ todb_dbconf:
     sslmode: disable
     open_manual: ""
 
+# --- Traffic Vault Postgres backend traffic_vault_config (in cdn.conf) & dbconf.yml
+tvdb_db_name: traffic_vault
+tvdb_type: Pg
+tvdb_port: 5432
+tvdb_host: localhost
+tvdb_username:
+tvdb_password:
+tvdb_ssl_enable: false
+tvdb_aes_key_loc: /opt/traffic_ops/app/conf/aes.key
+tvdb_dbconf:

Review comment:
       These should use a `to_` prefix to be consistent with the rest of the role vars; maybe something like `to_tvdb_`.

##########
File path: infrastructure/ansible/roles/traffic_ops/templates/trafficvault_dbconf.yml.j2
##########
@@ -0,0 +1,26 @@
+{#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#}
+version: "1.0"
+name: dbconf.yml
+
+{% for db_env in tvdb_dbconf %}
+{{ db_env }}:
+    driver: {{ tvdb_dbconf[db_env]['driver'] }}
+{% if tvdb_dbconf[db_env]['open_manual'] | length %}
+    open: {{ tvdb_dbconf[db_env]['open_manual'] }}
+{% else %}
+    open: host={{ tvdb_dbconf[db_env]['host'] }} port={{ tvdb_dbconf[db_env]['port'] }} user={{ tvdb_dbconf[db_env]['user'] }} password={{ tvdb_dbconf[db_env]['password'] }} dbname={{ tvdb_dbconf[db_env]['dbname'] }} sslmode={{ tvdb_dbconf[db_env]['sslmode'] }}

Review comment:
       The conninfo string should be overridable so that any arbitrary connection string may be provided.  This avoids making template changes a requirement to use a pgpass file instead of the actual password for example or providing a fallback application_name.

##########
File path: infrastructure/ansible/roles/traffic_ops/defaults/main.yml
##########
@@ -138,6 +138,26 @@ todb_dbconf:
     sslmode: disable
     open_manual: ""
 
+# --- Traffic Vault Postgres backend traffic_vault_config (in cdn.conf) & dbconf.yml
+tvdb_db_name: traffic_vault
+tvdb_type: Pg
+tvdb_port: 5432
+tvdb_host: localhost
+tvdb_username:
+tvdb_password:
+tvdb_ssl_enable: false
+tvdb_aes_key_loc: /opt/traffic_ops/app/conf/aes.key

Review comment:
       This should make use of the `to_conf_installdir` variable to reduce potential inconsistency

##########
File path: infrastructure/ansible/roles/traffic_opsdb/tasks/initialize_traffic_opsdb.yml
##########
@@ -34,9 +34,27 @@
     ssl_rootcert: "{{ postgresql_certs_ca }}"
   no_log: true
 
+- name: Create Traffic Vault Database User
+  postgresql_user:
+    encrypted: yes
+    name: "{{ tvdb_username }}"
+    password: "{{ tvdb_password }}"
+    port: "{{ postgresql_port }}"
+    login_host: 127.0.0.1
+    role_attr_flags: SUPERUSER,LOGIN,CREATEDB

Review comment:
       Does this user need to be able to delete other databases or create new ones?

##########
File path: infrastructure/ansible/roles/traffic_ops/templates/postinstall.input.j2
##########
@@ -92,19 +92,31 @@
       "hidden": "1"
     }
   ],
-  "/opt/traffic_ops/app/db/dbconf.yml": [
+  "/opt/traffic_ops/app/conf/production/tv.conf": [

Review comment:
       Do we no longer have questions relating to `"/opt/traffic_ops/app/db/dbconf.yml"`?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org