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 02:31:18 UTC

[GitHub] [trafficcontrol] rawlinp opened a new pull request #5909: Update Ansible automation to initialize Traffic Vault Postgres backend

rawlinp opened a new pull request #5909:
URL: https://github.com/apache/trafficcontrol/pull/5909


   ## What does this PR (Pull Request) do?
   Updates the Ansible automation to initialize and configure the Traffic Vault Postgres backend as an alternative to the legacy Riak backend.
   
   ## Which Traffic Control components are affected by this PR?
   - Traffic Ops
   - Traffic Vault
   - Ansible roles
   
   ## What is the best way to verify this PR?
   Run the Ansible automation to install Traffic Ops / TODB, ensure that the Traffic Vault Postgres backend is configured correctly and works.
   
   ## The following criteria are ALL met by this PR
   - [x] No tests because the Ansible roles have no tests
   - [x] No docs because Ansible roles are not documented at this level of detail
   - [x] No changelog (overall feature already covered by a prior entry)
   - [x] This PR includes any and all required license headers
   - [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** (see [the Apache Software Foundation's security guidelines](https://www.apache.org/security/) for details)


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



[GitHub] [trafficcontrol] jhg03a merged pull request #5909: Update Ansible automation to initialize Traffic Vault Postgres backend

Posted by GitBox <gi...@apache.org>.
jhg03a merged pull request #5909:
URL: https://github.com/apache/trafficcontrol/pull/5909


   


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



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

Posted by GitBox <gi...@apache.org>.
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"`?

##########
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:
       Oh, you're right.  It's what I get for doing reviews that late.  Great job being ahead of the curve there.

##########
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:
       Ideally yes.  If some other user creates the DB and assigns ownership to the TVDB user, it shouldn't need anything more than LOGIN with regards to priv flags.




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



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

Posted by GitBox <gi...@apache.org>.
rawlinp commented on a change in pull request #5909:
URL: https://github.com/apache/trafficcontrol/pull/5909#discussion_r645090672



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




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



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

Posted by GitBox <gi...@apache.org>.
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?

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




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



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

Posted by GitBox <gi...@apache.org>.
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



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

Posted by GitBox <gi...@apache.org>.
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



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

Posted by GitBox <gi...@apache.org>.
jhg03a commented on pull request #5909:
URL: https://github.com/apache/trafficcontrol/pull/5909#issuecomment-854179288


   LGTM, but still testing


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



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

Posted by GitBox <gi...@apache.org>.
jhg03a commented on a change in pull request #5909:
URL: https://github.com/apache/trafficcontrol/pull/5909#discussion_r645086072



##########
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:
       Ideally yes.  If some other user creates the DB and assigns ownership to the TVDB user, it shouldn't need anything more than LOGIN with regards to priv flags.




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



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

Posted by GitBox <gi...@apache.org>.
jhg03a commented on a change in pull request #5909:
URL: https://github.com/apache/trafficcontrol/pull/5909#discussion_r645083393



##########
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:
       Oh, you're right.  It's what I get for doing reviews that late.  Great job being ahead of the curve there.




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



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

Posted by GitBox <gi...@apache.org>.
jhg03a commented on pull request #5909:
URL: https://github.com/apache/trafficcontrol/pull/5909#issuecomment-854179288


   LGTM, but still testing


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