ansible-builderとansible-navigatorをちょっとだけ触る。
はじめに
取り合えずlocalhostでdebug
モジュールを動かすだけのPlaybookを流すまで。なるべくシンプルに。
WSL2 Ubuntu-20.04上で実施。podman
導入済み。EEのバージョンは下記。
$ podman --version podman version 3.3.1 $ ansible-builder --version 1.0.1 $ ansible-navigator --version ansible-navigator 1.1.0 $ ansible-runner --version 2.0.3
ansible-builder
主に下記を参考。
↓でも可。正直、↑の方が取っつきやすかった。
https://ansible-builder.readthedocs.io/en/stable/index.html
pip install ansible-builder cat << EOF > execution-environment.yml --- version: 1 dependencies: galaxy: requirements.yml EOF cat << EOF > requirements.yml --- collections: - name: awx.awx EOF ansible-builder build --tag=general -v 3
collections
は形だけ指定。- 数分かかるので、進捗気になる人は
-v
推奨。 ansible-builder build
実行に伴って、dangling image(<none>:<none>
)が作成される。- 不要であれば
podman image prune
等で削除しても良いが、イメージの微調整が想定される場合は、残しておいた方が良いかも?
- 不要であれば
ansible-navigator
pip install ansible-navigator
ansible-runner
も一緒にインストールされる。
sudo mkdir /dev/mqueue cat << EOF > ~/.ansible-navigator.yml --- ansible-navigator: execution-environment: image: general pull-policy: never EOF ansible-navigator -m stdout run playbook.yml -i inventory.ini
下記、実行結果。
$ ansible-navigator -m stdout run playbook.yml -i inventory.ini PLAY [localhost] *************************************************************** TASK [debug] ******************************************************************* ok: [localhost] => { "msg": "Hello world!" } PLAY RECAP ********************************************************************* localhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- 下記が出力される場合は、WSL Ubuntuで
/dev/mqueue
の作成漏れ。
Error: statfs /dev/mqueue: no such file or directory
以上。