简体   繁体   中英

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. 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.

Is there any way to print out the variables stored by ec2_facts with the debug module?

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.

Ie:

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 }}"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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