LoginSignup
0
1

More than 5 years have passed since last update.

ec2_group_factsモジュールをAnsible2.2で使えるようにする

Posted at

AnsibleでAWSリソースの情報を取得する*_factモジュールは何かと便利なのですが、セキュリティグループの情報を取得するためのモジュールであるec2_group_factsは、Ansible2.2xでは使えません。

公式ドキュメントによると

New in version 2.3.

とのこと。

他のfact系モジュールは使えるのになんでこれだけ。。。と思ってたらansible-modules-extrasにありました。

早速使えるようにしてみましょう。

まず、モジュールを格納するディレクトリを決めます。
今回はカレントディレクトリにlibraryというディレクトリを作成します。

$ mkdir ./library
$ cd library

モジュールをダウンロードします。

$ curl -O https://raw.githubusercontent.com/ansible/ansible-modules-extras/devel/cloud/amazon/ec2_group_facts.py

ansible.cfgでモジュールのディレクトリを指定します。
[defaults]に下記を追記します。

ansible.cfg
[defaults]
library = ./library

このモジュールにはboto3が必要なので、インストールします。
OSX El Capitanの場合

$ sudo -H pip install boto3 --ignore-installed six

これでec2_group_factsモジュールが使えるようになりました。

0
1
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
0
1