Ubuntu23.04 Ansibleをインストールする方法

環境
# cat /etc/issue
Ubuntu 23.04 \n \l

操作方法
1.下記コマンドを上から順に実行します。
パッケージをアップデートします

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

2.下記コマンドを実行してバージョンが表示されれば成功です。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# ansible --version
ansible [core 2.14.2]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.11.4 (main, Jun 9 2023, 07:59:55) [GCC 12.3.0] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
# ansible --version ansible [core 2.14.2] config file = /etc/ansible/ansible.cfg configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3/dist-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /usr/bin/ansible python version = 3.11.4 (main, Jun 9 2023, 07:59:55) [GCC 12.3.0] (/usr/bin/python3) jinja version = 3.1.2 libyaml = True
#  ansible --version
ansible [core 2.14.2]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.4 (main, Jun  9 2023, 07:59:55) [GCC 12.3.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True

3.Ansibleは/usr/bin/ ディレクトリにインストールされます

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# which ansible
/usr/bin/ansible
# which ansible /usr/bin/ansible
# which ansible
/usr/bin/ansible

 

Ubuntu 23.04

Posted by arkgame