Ubuntu ansibleをインストールする方法

環境
Ubuntu 22.10

操作方法
1.apt-get updateでパッケージリストを更新します。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ sudo apt-get update
$ sudo apt-get update
$ sudo apt-get update

2.ansible に必要な software-properties-common のパッケージをインストールします。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ sudo apt-get install software-properties-common
$ sudo apt-get install software-properties-common
$ sudo apt-get install software-properties-common

3.ansible のリポジトリを追加します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ sudo apt-add-repository --yes --update ppa:ansible/ansible
$ sudo apt-add-repository --yes --update ppa:ansible/ansible
$ sudo apt-add-repository --yes --update ppa:ansible/ansible

4.apt-get install でansible をインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ sudo apt-get install ansible
$ sudo apt-get install ansible
$ sudo apt-get install ansible

5.ansibleインストールされたことを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ which ansible
$ ansible --version
$ which ansible $ ansible --version
$ which ansible
$ ansible --version

6.ansible コマンドをテストする

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ ansible -m ping localhost
localhost | SUCCESS => {
"changed": false,
"ping": "pong"
}
$ ansible -m ping localhost localhost | SUCCESS => { "changed": false, "ping": "pong" }
$ ansible -m ping localhost
localhost | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

 

Ansible

Posted by arkgame