copr-fe: allow easy PostgreSQL connection to copr-fe user

This commit is contained in:
Pavel Raiskup 2021-04-01 10:30:05 +02:00
parent bc8b471253
commit 00c619b151
4 changed files with 39 additions and 0 deletions

View file

@ -28,3 +28,5 @@ copr_pagure_events:
org.fedoraproject.prod.pagure: "https://src.fedoraproject.org/"
copr_messaging_queue: "a9b74258-21c6-4e79-ba65-9e858dc84a2b"
copr_fe_homedir: /usr/share/copr/coprs_frontend

View file

@ -32,3 +32,5 @@ copr_pagure_events:
io.pagure.stg.pagure: "https://stg.pagure.io"
copr_messaging_queue: "c8e11df7-e863-4ca4-99b9-d37c6663c7f7"
copr_fe_homedir: /usr/share/copr/coprs_frontend

View file

@ -157,3 +157,10 @@
when:
- ansible_facts.packages['copr-frontend'][0].version is version('1.156', '>=')
- not services_disabled|bool
- name: install bashrc file to ease some admin tasks
copy:
content: |
export PGUSER=copr-fe
export PGDATABASE=coprdb
dest: "{{ copr_fe_homedir }}/.bashrc"

View file

@ -108,3 +108,31 @@
notify: restart postgresql
tags:
- config
- name: install psqlrc file
copy:
content: |
\pset linestyle unicode
\pset border 2
-- Switch pagers with :x and :xx commands
\set x '\\setenv PAGER less'
\set xx '\\setenv PAGER \'pspg -bX --no-mouse\''
:xx
dest: "{{ copr_fe_homedir }}/.psqlrc"
owner: copr-fe
group: copr-fe
mode: 0600
- name: install pgpass file
copy:
content: |
localhost:*:coprdb:copr-fe:{{ copr_database_password }}
dest: "{{ copr_fe_homedir }}/.pgpass"
owner: copr-fe
group: copr-fe
mode: 0400
- name: install pghistory file
file: path="{{ copr_fe_homedir }}/.psql_history" state=file
owner=copr-fe group=ćopr-fe mode=0600