0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

moleculeでのfilter pluginの利用方法

Last updated at Posted at 2021-05-21

概要

moleculeの処理でfilter pluginを利用する際にはまったことを忘れないように残す。

TL;DR

roles配下のフォルダ構成(関連個所のみ)

roles
 ├moleule
 |  └default
 |     ├molecule.yml
 |     ├playbook.yml   ※ここで使いたい
 |     ├verify.yml    ※ここで使いたい
 |     └filter_plugin
 |        └custom_filter.py ※これを使いたい
 ├tasks
 └defaults

molecule.ymlのprovisionerに以下の設定を追加する

molecule.yml
provisioner:
  env:
    ANSIBLE_FILTER_PLUGINS: ./filter_plugin

filter pluginを利用するplaybook(playbook.ymlやverify.yml、等)で「gather_facts: yes」となっていること
※ANSIBLE_FILTER_PLUGINSはgather_factsによって読み込まれるため。

playbook.yml
- hosts: target
  gather_facts: yes

参考

moleculeマニュアル
https://molecule.readthedocs.io/en/latest/configuration.html

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?