LoginSignup
1
1

More than 5 years have passed since last update.

AnsibleでPostgreSQLの特定のデータベースに対してSELECTのみの権限のユーザを追加する

Last updated at Posted at 2017-03-10

最初はpostgresql_userモジュールのみで実現しようと思ったのですが、どうやら現状では priv オプションには、テーブルを指定しないといけないっぽいので、2つのモジュールに分けて実現しました。

---
- name: DBユーザ my_read_only を追加
  postgresql_user:
    db: my_db
    name: my_read_only
    password: xxxXXXXxxxXX
- name: DBユーザ my_read_onlyにSELECTのみの権限を付与
  postgresql_privs:
    db: my_db
    type: table
    schema: public
    privs: SELECT
    objs: ALL_IN_SCHEMA
    role: my_read_only
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1