0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ansible-base 2.10 (オフラインインストール)

Posted at

0. はじめに

Ansible2.10から従来のAnsible2.9とは異なり、モジュールの大半がansible-galaxyに集約され最低限のモジュールが利用できるansible-baseの提供が開始される。
ただし、Ansible2.10のインストール形式には以下の2種類がある。
①Ansible-base
Ansible-baseのみの提供。最低限のモジュールとpluginのみ包含されるため、必要なモジュールはansible-galaxyから取得する。
②Ansible
従来の配布形態と同様、Ansible-baseにモジュールやpluginがバインドされた形式。

今回の記事では、②Ansibleのオフラインインストールを実施。
※②Ansible 2.10については別の記事をご参照

1. ansible-baseインストール用ファイルのダウンロード

pipコマンドでansibl-baseインストール用ファイルをダウンロード。
実行結果は以下の通り。

# pip3.9 download -d ansible ansible-base
# ls -ltr
合計 9288
-rw-r--r--. 1 root root 5836841 12月 5 16:23 ansible-base-2.10.3.tar.gz
-rw-r--r--. 1 root root  125774 12月 5 16:23 Jinja2-2.11.2-py2.py3-none-any.whl
-rw-r--r--. 1 root root  269377 12月 5 16:23 PyYAML-5.3.1.tar.gz
-rw-r--r--. 1 root root 2606314 12月 5 16:23 cryptography-3.2.1-cp35-abi3-manylinux2010_x86_64.whl
-rw-r--r--. 1 root root   35858 12月 5 16:23 packaging-20.7-py2.py3-none-any.whl
-rw-r--r--. 1 root root   19151 12月 5 16:23 MarkupSafe-1.1.1.tar.gz
-rw-r--r--. 1 root root  405977 12月 5 16:23 cffi-1.14.4-cp39-cp39-manylinux1_x86_64.whl
-rw-r--r--. 1 root root   10963 12月 5 16:23 six-1.15.0-py2.py3-none-any.whl
-rw-r--r--. 1 root root   67842 12月 5 16:23 pyparsing-2.4.7-py2.py3-none-any.whl
-rw-r--r--. 1 root root  112041 12月 5 16:23 pycparser-2.20-py2.py3-none-any.whl

2. インストール

1.の手順でダウンロードした資源をオフラインの環境に配置。
以下コマンドを実行し、ansible-baseをインストール。

# pip3.9 install <パッケージ名>

インストールされたことを確認する。

# ansible --version
ansible 2.10.3
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/python390/lib/python3.9/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.9.0 (default, Dec 5 2020, 16:14:32) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]

※以下、必要に応じで実施
"ansible"で実行できるようシンボリックリンクを作成

# ln -s /usr/local/python390/bin/ansible /usr/bin/ansible

3. テスト用playbook実行

以下テスト用のplaybookを作成し、稼働確認

---
  - hosts: localhost

    tasks:
      - file:
          path: /tmp
          state: directory

実行結果は以下の通り。ansible-baseが正常に動いていることが確認できた。

# ansible-playbook test.yml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'

PLAY [localhost] ***************************************************************

TASK [Gathering Facts] *********************************************************
ok: [localhost]

TASK [file] ********************************************************************
ok: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?