LoginSignup
0
0

More than 1 year has passed since last update.

Ansible 2.4 から 2.5 への移行ガイド (主要部分)

Last updated at Posted at 2018-07-16

出展

Ansible 2.5 Porting Guide — Ansible Documentation より

Playbook

roles のキーワードとインライン変数の渡し方の修正

今までは role に渡す変数とキーワードがごっちゃになっていた。

roles:
    - { role: myrole, name: Justin, othervar: othervalue, become: True}

変数は vars に渡すようになった。

roles:
    - { role: myrole, vars: {name: Justin, othervar: othervalue}, become: True}

感想

「ですよね!」って感じ。

非推奨

Jinjaのフィルタ記法を利用した条件評価は非推奨に

フィルタ記法での評価は将来的に 2.9 で削除される予定。

評価記法は比較に使い、フィルタはデータ操作に使おう。

when:
    - result | failed
    - not result | success

when:
    - result is failed
    - results is not successful

余談

この変更は、Jinjaの適切な理解、コンセプトの理解のために役立つことでしょう。

Jinja tests are used for comparisons, while filters are used for data manipulation and have different applications in jinja.

「ここでいう「テスト」って何なの?」
「when はテストじゃなくて条件分岐じゃないの?」

と思うが、そもそも値の比較 ( 評価成功期待すること ) を test と呼ぶので、こちらの表現から来ているんだろう。

Linux test command information and examples

Jinja2本体のドキュメントを読んでみよう。

Template Designer Documentation — Jinja2 Documentation (2.10)

Tests

Beside filters, there are also so-called “tests” available. Tests can be used to test a variable against a common expression.

モジュール

色々削除されたが、ここではほぼ割愛。

気になったもの

docker use docker_container and docker_image instead

docker モジュールは docker コンテナ管理のためのモジュールだが、過去バージョンで既に docker_container と docker_image に分割されている。

備考

  • 何か新しく分かったら追記。

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

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