2016-09-16 6 views
0

私のDbインスタンスのARNを見つける必要があるので、http://docs.ansible.com/ansible/rds_module.htmlで提供されたfactsキーワードを使用しました。以下は、単純な遊びです:不可能なrds 'facts'は私にARNを返しません

- name: Get The RDS Facts from AWS 
    rds: 
    command: facts 
    region: '{{ aws_region }}' 
    instance_name: '{{ source_rds_instance_name }}' 
    register: db_facts 

これは私が返されます。

TASK: [read_replica_rds | Get The RDS Facts from AWS] ************************* 
ok: [127.0.0.1] => {"changed": false, "instance": {"availability_zone": "ap-southeast-2a", "backup_retention": 7, "create_time": 1473670897.052, "endpoint": "test-for-cross-region.oe451o1vbl45.ap-southeast-2.rds.amazonaws.com", "id": "test-for-cross-region", "instance_type": "db.m3.medium", "iops": null, "maintenance_window": "wed:14:00-wed:14:30", "multi_zone": false, "port": 3306, "replication_source": null, "status": "available", "username": "root", "vpc_security_groups": "sg-d3b9e7b7"}} 

をしかし、私は私のRDSのために返されるARNを参照することができません。それを行う方法?

答えて

2

DBInstanceオブジェクトのARNプロパティはbotoにはありません。

construct ARNがインスタンス名を知っているのはなぜですか?

arn:aws:rds:<region>:<account-id>:db:<db-instance-name> 
+0

を取得するにはどうすればよいですか? – Kittystone

+0

@Kittystone一度だけAWSコンソールでそれを見ることも、AWS CLIのaws sts get-caller-identity --output text --query Account経由で取得することもできます。あなたが動的にそれをAnabilitiesから取得したいのであれば、いくつかのモジュールチェーンを構築する必要があります(簡単な方法はありません)。 –

+0

ありがとうございます。私はあなたの選択肢を持ってそれを行うつもりです – Kittystone