LoginSignup
1
0

More than 3 years have passed since last update.

[Ansible]EC2のメタデータを変数に格納する

Posted at

pre_tasksでec2のメタデータを収集する。

pre_tasks:
    - name: gather ec2_metadata
      amazon.aws.ec2_metadata_facts:

収集できるメタデータ(公式サイト)

変数に格納

例) "public_ip"にEC2のパブリックIPを格納したい場合、下記のように変数を設定しておく

public_ip: "{{ ansible_ec2_public_ipv4 }}"

使い所

AWXのワークフロー使用時、CloudFormationで新規構築したEC2のIPを後続タスクで使用する変数に格納したい時などに使えます。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0