0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WindowsのWSL上にAnsible実行環境を構築する

Last updated at Posted at 2024-07-25

Windows上でAnsibleは実行できないので、WSLから実行するため
WSL構築からAnsibleインストール、実行までの手順をまとめます。

WSL用OSインストール

WSLとして動かすOSをインストールします。

  1. Microsoft Storeを開く
  2. 「almalinux」で検索する ※他のOSでも良いです。Ubuntuとか
  3. 出てきたものをインストールする
    (今回はAlmaLinux 9)
    image.png
  4. インストール後、AlmaLinux9を実行
    image.png
  5. ユーザー名とパスワードが聞かれるので入力
    image.png

Ansibleインストール

以下コマンドを順番に実行

> sudo dnf install -y epel-release
> sudo dnf install -y ansible
> ansible --version
# -> ansible [core 2.14.14]
#      config file = /etc/ansible/ansible.cfg
#      configured module search path = ['/home/xxx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
#      ansible python module location = /usr/lib/python3.9/site-packages/ansible
#      ansible collection location = /home/xxx/.ansible/collections:/usr/share/ansible/collections
#      executable location = /usr/bin/ansible
#      python version = 3.9.18 (main, Jan  4 2024, 00:00:00) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] (/usr/bin/python3)
#      jinja version = 3.1.2
#      libyaml = True

以下コマンドで動作確認
(自分自身に対してcat /etc/redhat-releaseを実行した結果を出力する)

> ansible localhost -m shell -a "cat /etc/redhat-release"
# -> localhost | CHANGED | rc=0 >>
#    AlmaLinux release 9.3 (Shamrock Pampas Cat)
0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?