我正在使用 Salt Stack 来管理我的 Linux 服务器。我有一个创建 PostgreSQL 数据库的命令,但我需要运行“CREATE EXTENSION postgis;” 在我的数据库上。
我知道我可以使用从命令行调用 psql 的 shell 脚本来做到这一点,但是有没有更明智的方法来使用 Salt 来做到这一点?
这是我当前的数据库配置脚本:
pg-deps:
pkg:
- installed
- names:
- postgresql-9.3
- postgis
dbuser:
postgres_user:
- present
- name: foo
- password: bar
- runas: postgres
dbname:
postgres_database:
- present
- encoding: UTF-8
- runas: postgres
- owner: foo
- require:
- postgres_user: dbuser