Ansible をインストールする - aktnk/til GitHub Wiki

前提条件

  • インストール環境: WSL2上の ubuntu 20.04LTS

インストール手順

  • Ansible Community Documentation の Installing Ansibleの章を確認し、ubuntuへのインストール手順に従いインストールする

    $ sudo apt update
    <省略>
    $ sudo apt install software-properties-common
    <省略>
    $ sudo add-apt-repository --yes --update ppa:ansible/ansible
    <省略>
    取得:9 http://ppa.launchpad.net/ansible/ansible/ubuntu focal InRelease [18.0 kB]
    ヒット:10 http://archive.ubuntu.com/ubuntu focal-backports InRelease
    取得:11 http://ppa.launchpad.net/ansible/ansible/ubuntu focal/main amd64 Packages [1,132 B]
    取得:12 http://ppa.launchpad.net/ansible/ansible/ubuntu focal/main Translation-en [756 B]
    79.1 kB を 2秒 で取得しました (38.7 kB/s)
    パッケージリストを読み込んでいます... 完了
    $ sudo apt install ansible
    パッケージリストを読み込んでいます... 完了
    依存関係ツリーを作成しています
    状態情報を読み取っています... 完了
    以下の追加パッケージがインストールされます:
       ansible-core python3-bcrypt python3-jmespath python3-kerberos python3-ntlm-auth python3-paramiko
       python3-requests-kerberos python3-requests-ntlm python3-resolvelib python3-winrm python3-xmltodict
       sshpass
    提案パッケージ:
       python3-gssapi
    以下のパッケージが新たにインストールされます:
       ansible ansible-core python3-bcrypt python3-jmespath python3-kerberos python3-ntlm-auth python3-paramiko
       python3-requests-kerberos python3-requests-ntlm python3-resolvelib python3-winrm python3-xmltodict
       sshpass
    アップグレード: 0 個、新規インストール: 13 個、削除: 0 個、保留: 0 個。
    22.2 MB のアーカイブを取得する必要があります。
    この操作後に追加で 323 MB のディスク容量が消費されます。
    続行しますか? [Y/n] y
    <省略>
    python3-winrm (0.3.0-2) を設定しています ...
    man-db (2.9.1-1) のトリガを処理しています ...
    
  • インストール確認として、ansibleのバージョンを確認する

    $ ansible --version
    ansible [core 2.12.10]
      config file = /etc/ansible/ansible.cfg
      configured module search path = ['/home/aktnk/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
      ansible python module location = /usr/lib/python3/dist-packages/ansible
      ansible collection location = /home/aktnk/.ansible/collections:/usr/share/ansible/collections
      executable location = /usr/bin/ansible
      python version = 3.8.10 (default, Mar 18 2025, 20:04:55) [GCC 9.4.0]
      jinja version = 2.10.1
      libyaml = True
    

参照先