LoginSignup
0
0

molecule init roleが実行できない

Last updated at Posted at 2023-09-17

概要

Ansible Moleculeを勉強しようとして、最初からつまずいてしまった際の初心者メモ

詳細

様々な野良資料で下記の「molecule init role」を実行するといった記述を見かけるが、「role」というサブサブオプションの指定ができなかった。

$ molecule init role --driver-name docker --role-name rolehoge
Usage: molecule init [OPTIONS] COMMAND [ARGS]...
Try 'molecule init --help' for help.

Error: No such command 'role'.

自分が使っているバージョンは下記の通り

$ molecule --version
molecule 6.0.2 using python 3.10 
    ansible:2.15.2
    default:6.0.2 from molecule

最新(6系)の公式資料のGetting Started With Moleculesを見てみると、ansible-galaxyコマンドであるが、

v.5.1.0を見てみると「molecule init role」で作成する手順となっている

下記のPRで内容がアップっデートされていることがわかった。
https://github.com/ansible/molecule/pull/3959

上記PRの概要に下記の記載があり、ansible-galaxyコマンドで「molecule init role」がカバーされているとのこと

Removed 'init role' command due to already being covered by ansible-galaxy

また、Moleculeの公式ドキュメントにもそのような旨のコメントが記載されていました。

molecule init command is now only available to create a scenario using molecule init scenario. Users will no longer be able to create a role. Instead, users can make use of ansible-galaxy to create a collection or role.

ということで今後は、ansible-galaxyコマンドで作成する必要がある。

$ ansible-galaxy role init my_role
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