ansible中mysql模块的使用_ansible PostgreSQL的模块来创建角色并添加数据库

# su - postgres

$ psql

postgres=# create role user_name with login encrypted password 'password';

postgres=# create database database_name owner user_name template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';

到目前为止,我已经试过这

- name: create the "{{ ovirt_engine_dwh_db_name }}" db from the command line

command: |

psql -c "create role {{ ovirt_engine_dwh_db_user }} with login encrypted password '{{ ovirt_engine_dwh_db_password }}';"

psql -c "create database {{ ovirt_engine_dwh_db_name }} owner {{ ovirt_engine_dwh_db_user }} template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';"

become_user: postgres

但如果我尝试这里面谈到的错误是Jinja2的模板不能代替我在defaults/main.yml

+2

你问你如何将你的问题中的命令转换为postgresql ansible模块或为什么你当前的任务失败?如果是后者,是否可以包含错误输出? –

+0

@kfreezy我很好奇如何将命令转换为postgresql ansible模块。我很想看看我如何使用它们来做到这一点。现在,我通过创建sql模板并在主机上单独运行它们来实现它。这个错误是由于这样一个事实:任务是在一个非默认的目录结构中,因此无法读取'defaults/main.yml' –

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值