【发布时间】:2016-10-25 01:51:13
【问题描述】:
我正在努力为工作学习 ansible。我需要创建 RDS 实例,然后是数据库并获取环境变量。
我总是出错
致命:[本地主机]:失败! => {"changed": false, "failed": true, "msg": "unsupported parameter for module: register"}
这是我的代码
- name: Configure RDS
hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Provision RDS
rds:
command: create
instance_name: ANSIBLEDataloading
db_engine: Postgresql
size: 10
instance_type: sb.m1.small
username: xxxxx
password: xxxxx
tags:
Environment: Dataloading
Application: sims
command: facts
instance_name: ANSIBLEDataloading
register: ANSIBLEDataloading
- name: Add new instance to host group
add_host: hostname={{ item.endpoint }} groupname=launched_db
with_items: '{{ANSIBLEDataloading.instance}}'
我正在努力学习,对 ansible 非常陌生。
新代码
- name: Configure RDS
hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Provision RDS
rds:
command: create
instance_name: ANSIBLEDataloading
db_engine: postgres
region: 'us-east-1'
size: 10
instance_type: db.m3.xlarge
username: xxxxx
password: xxxx
tags:
Environment: Dataloading
Application: sims
register: ANSIBLEDataloading
- name: Add new instance to host group
add_host: hostname={{ item.endpoint }} groupname=launched_db
with_items: '{{ANSIBLEDataloading.instance}}'
新错误
fatal: [localhost]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'unicode object' has no attribute 'endpoint'\n\nThe error appears to have been in '/Users/suyesh/Desktop/ansible_conversion/conversion.yml': line 48, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n register: ANSIBLEDataloading\n - name: Add new instance to host group\n ^ here\n"}
【问题讨论】:
标签: ansible ansible-playbook amazon-rds