はじめに
2020/08/15 に、YouTube Live で「つまずき Ansible 【Part13】ansible-base 2.10.0 の changelog を眺める」という配信をしました。
実際に作業しながらエラーと戦って進めるシリーズです。
今回は、デモではなく、ansible-base 2.10.0 の changelog を眺めて、どんな変更だろうなぁというのをコメントする回です。
ansible/CHANGELOG-v2.10.rst at stable-2.10 · ansible/ansible · GitHub
やったことや、わかったことをふりかえります。
動画
■ やったこと(見た changelog)
- Add --ask-vault-password and --vault-pass-file options to ansible cli commands
- Add new magic variable
ansible_collection
that contains the collection name- コレクション名のマジック変数
- Add new magic variable
ansible_role_name
that contains the FQCN of the role- ロール名のマジック変数
- Enable Ansible Collections loader to discover and import collections from
site-packages
dir andPYTHONPATH
-added locations.- 詳細不明・・
- Flatten the directory hierarchy of modules
- モジュールの1のディレクトリにフラットに配置されるようになった
- https://github.com/ansible/ansible/tree/stable-2.10/lib/ansible/modules
- 参考 2.9 の場合 https://github.com/ansible/ansible/tree/stable-2.9/lib/ansible/modules
- Remove the deprecation message for the
TRANSFORM_INVALID_GROUP_CHARS
setting. (https://github.com/ansible/ansible/issues/61889)- グループ名に不正な文字がある場合の扱いを決めるオプションに関する WARNING が表示されなくなった
- 参考[Ansible] TRANSFORM_INVALID_GROUP_CHARS を ignore に設定したときの表示が Ansible 2.8.2 から変更された - てくなべ (tekunabe)
- Templating - Add support to auto unroll generators produced by jinja2 filters, to prevent the need of explicit use of
|list
(https://github.com/ansible/ansible/pull/68014)
- Templating - Add support to auto unroll generators produced by jinja2 filters, to prevent the need of explicit use of
Ansible 2.10.0b1 の changelog 眺めてて、地味に便利そうど思ったもの。selectattr などののフィルターを使うとだいたい | list との併用が必要だったのだけれど、それが不要になった。
— よこち(yokochi) (@akira6592) 2020年6月21日
"Add support to auto unroll generators produced by jinja2 filters"https://t.co/wW983rsUw4 pic.twitter.com/W9BC8kJgCR
- conditionals - change the default of CONDITIONAL_BARE_VARS to False (https://github.com/ansible/ansible/issues/70682)
CONDITIONAL_BARE_VARS
のデフォルト値がTrue
からFalse
に変更when
に変数名を指定した場合はちょっと注意- 参考 https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_2.8.html#bare-variables-in-conditionals
- core filters - Adding
path_join
filter to the core filters list- パスの連結を便利にするやつ?
- 元ネタ PR https://github.com/ansible/ansible/pull/62713/files
- ssh - connection plugin now supports a new variable
sshpass_prompt
which gets passed tosshpass
allowing the user to set a custom substring to search for a password prompt (requires sshpass 1.06+)- 詳細不明・・
ssh connection pluginの追加#tekunabe
— z a k i (@zaki_hmkc) 2020年8月15日
…今までansible.cfgで設定してたのをここでできるようになるとかかな(想像です)
» ANSIBLE_SSH_ARGS not applied to hosts created with add_host · Issue #70437 · ansible/ansible https://t.co/nNiaDgEejP
- 詳細不明・・
hash_behaviour - Deprecate
hash_behaviour
for future removal.hash_behaviour
が Deprecate 扱いに
おおおん、hash_behaviour って Ansible 2.10 で Deprecated になるんだ。これをうまく使ってやりたいことやってる話はきいたころあるけれど。
— よこち(yokochi) (@akira6592) 2020年6月20日
combine フィルターで都度やりましょうというのが代替。https://t.co/Xbb3RFUfEdhttps://t.co/VyD9XgduOM- Using --start-at-task would fail when it attempted to skip over tasks with no name.
- ansible-playbook コマンドの
--start-at-task
オプションで、名前のないタスクの扱いが変更?
- ansible-playbook コマンドの
- combine filter -
[dict1, [dict2]] | combine
now raise an error; previouslycombine
had an undocumented behaviour where it was flattening the list before combining it (https://github.com/ansible/ansible/pull/57894#discussion_r339517518)- 詳細不明・・
- loops - Do not indiscriminately mark loop items as unsafe, only apply unsafe to
with_
style loops. The items fromloop
should not be explicitly wrapped in unsafe. The underlying templating mechanism should dictate this. (https://github.com/ansible/ansible/issues/64379)- 気になるけど詳細不明・・・
- pip - check_mode with
state: present
now returns the correct state for pre-release versioned packages- チェックモードで
state: present
したときに `re-release のバージョンも拾えるように?
- チェックモードで
- unvault - read vaulted file(s) contents
- vault で暗号化されたファイルを復号する lookup plguin ?
Part14 にむけて
以下のネタを検討中です。気が向いたものをやります。
- connection: local ななにか
- Ansible Toewr / AWX をコマンドがら操作する
- ansible.cfg
- Jinja2、フィルター
- Windows
- when、assert など