简体   繁体   English

Ansible ec2_fact 文档

[英]Ansible ec2_fact documentation

I have searched far and wide to try and find some decent documentation relating to Ansible's ec2_facts module, specifically related to the variables which are created by this module.我进行了广泛的搜索,试图找到一些与 Ansible 的ec2_facts模块相关的不错的文档,特别是与该模块创建的变量相关的文档。 However, I can't seem to find anything.但是,我似乎找不到任何东西。 It looks like there is are variables called ansible_ec2_instance_id and ansible_ec2_instance_type which are created but I'm looking for a comprehensive list of all of the variables which are generated by this module.看起来有名为ansible_ec2_instance_idansible_ec2_instance_type变量被创建,但我正在寻找由该模块生成的所有变量的完整列表。

Is there any way to print out the variables stored by ec2_facts with the debug module?有没有办法用调试模块打印出ec2_facts存储的变量?

I have tried this:我试过这个:

- name: Get the ec2 facts of this instance
  debug:
      ec2_facts:

but that throws a syntax exception.但这会引发语法异常。

Have a look at this documentaion and bear in mind that all variables will be created with the ansible_ec2_ prefix.查看此文档并记住所有变量都将使用ansible_ec2_前缀创建。

Ie: IE:

instance_id --> ansible_ec2_instance_id instance_id --> ansible_ec2_instance_id

That might help you.那可能对你有帮助。

- hosts: ec2
  gather_facts: yes
  connection: local
  vars: 
    - region: 'us-west-2'
  tasks:
    - name: Gather EC2 facts
      local_action: ec2_facts
      register: ec2facts

    - debug:
        msg: "{{ ec2facts }}"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM