openqa-onebox: tweak db host stuff
Using the machine's own hostname works for the ansible delegate stuff but doesn't work for openQA itself (if you try and access the DB by hostname like this, postgres denies access; you have to use 'localhost' for postgres to allow it). Using 'localhost' works for postgres but doesn't do the right thing for delegation. Let's use 'localhost' and split the two play steps into delegated and non-delegated versions. Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
parent
1d594b13d6
commit
42e930e97f
3 changed files with 17 additions and 8 deletions
|
@ -28,6 +28,7 @@ openqa_compose_arches: x86_64
|
|||
openqa_dbname: openqa-onebox
|
||||
openqa_dbpassword: "{{ stg_openqa_dbpassword }}"
|
||||
openqa_dbuser: openqastg
|
||||
openqa_dbhost: localhost
|
||||
openqa_env: staging
|
||||
openqa_env_prefix: stg-
|
||||
# this is because openqa staging isn't really a staging host
|
||||
|
|
|
@ -68,7 +68,3 @@ sudoers: "{{ private }}/files/sudo/qavirt-sudoers"
|
|||
# $ENV{QEMUPORT} = ($options{instance}) * 10 + 20002;
|
||||
# so for worker 1 it's 20012, for worker 2 it's 20022, etc etc
|
||||
tcp_ports: ['20013', '20023', '20033', '20043', '20053', '20063', '20073', '20083', '20093', '20103', '20113', '20123', '20133', '20143', '20153', '20163', '20173', '20183', '20193', '20203', '20213', '20223', '20233', '20243', '20253', '20263', '20273', '20283', '20293', '20303']
|
||||
|
||||
# ONLY FOR WHEN THIS IS ONEBOX_TEST. we make it its own pgsql server.
|
||||
# I hope delegating to self works...
|
||||
openqa_dbhost: openqa-x86-worker05.iad2.fedoraproject.org
|
||||
|
|
|
@ -260,19 +260,31 @@
|
|||
tags:
|
||||
- config
|
||||
|
||||
- name: Create database
|
||||
- name: Create database (delegate)
|
||||
delegate_to: "{{ openqa_dbhost }}"
|
||||
become_user: postgres
|
||||
become: true
|
||||
postgresql_db: db={{ openqa_dbname }}
|
||||
when: "openqa_dbhost is defined"
|
||||
when: "openqa_dbhost is defined and openqa_dbhost != 'localhost'"
|
||||
|
||||
- name: Ensure db user has access to database
|
||||
- name: Ensure db user has access to database (delegate)
|
||||
delegate_to: "{{ openqa_dbhost }}"
|
||||
become_user: postgres
|
||||
become: true
|
||||
postgresql_user: db={{ openqa_dbname }} user={{ openqa_dbuser }} password={{ openqa_dbpassword }} role_attr_flags=NOSUPERUSER
|
||||
when: "openqa_dbhost is defined"
|
||||
when: "openqa_dbhost is defined and openqa_dbhost != 'localhost'"
|
||||
|
||||
- name: Create database (non-delegate)
|
||||
become_user: postgres
|
||||
become: true
|
||||
postgresql_db: db={{ openqa_dbname }}
|
||||
when: "openqa_dbhost is defined and openqa_dbhost == 'localhost'"
|
||||
|
||||
- name: Ensure db user has access to database (non-delegate)
|
||||
become_user: postgres
|
||||
become: true
|
||||
postgresql_user: db={{ openqa_dbname }} user={{ openqa_dbuser }} password={{ openqa_dbpassword }} role_attr_flags=NOSUPERUSER
|
||||
when: "openqa_dbhost is defined and openqa_dbhost == 'localhost'"
|
||||
|
||||
- name: Database config
|
||||
template: src=database.ini.pgsql.j2 dest=/etc/openqa/database.ini owner=geekotest group=root mode=0640
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue