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 15:32:48 UTC

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

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



##########
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:
       done

##########
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:
       done

##########
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:
       Nope, it turns out the answers to those questions were never actually used since the `dbconf.yml` file is generated via the answers for `database.conf`. So, I removed them.

##########
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:
       I don't think so. According to db/admin.go it looks like the superuser is used to create and drop the traffic_vault DB. So remove the `SUPERUSER` and `CREATEDB` flags?

##########
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:
       I'm confused -- doesn't L20-21 make the conninfo string overridable?




-- 
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