Ansible制御ノードのセットアップ
Ansible制御ノードをセットアップするには、SUSE Multi-Linux Manager Web UIから次のステップを実行します。
To configure a client as the Ansible Control Node, the Ansible package must be installed on that system. Usually, the Ansible package should be obtained from the operating system vendor’s official repositories. For example, on SUSE Linux Enterprise 15 SP6 and SP7, Ansible is available through the |
-
In the SUSE Multi-Linux Manager Web UI, navigate to
, verify thatSUSE Linux Enterprise Server 15 SP6 x86_64
(or later) with theSystems Management Module
and the requiredPython 3 Module
are selected and synchronized. -
Deploy a SUSE Linux Enterprise 15 SP6 (or later) client.
-
In the SUSE Multi-Linux Manager Web UI, navigate to the
page of the client. Select and subscribe the client to theSUSE Linux Enterprise Server 15 SP6 x86_64
(or later SP),Systems Management Module
andPython 3 Module
channels. -
クライアントの
を選択します。 [付属エンタイトルメント
]リストで[Ansible制御ノード
]を有効にして、プロパティの更新をクリックします。 -
クライアントの概要ページに移動し、
を選択して、highstateの適用をクリックします。 -
イベントタブを選択して、highstateの状態を確認します。
If you want to install a newer Ansible on a SUSE Linux Enterprise 15 SP4 or SP5 client, you must enable the |
Newer versions of Ansible no longer support managing nodes with outdated Python versions. If a managed node still defaults to an older Python version, you may encounter connection errors or failures during playbook runs. To address this, user should upgrade Python on the managed node, if possible and set the correct Python interpreter in the Ansible inventory or configuration. |
1. Ansibleインベントリファイルの作成
Ansible統合ツールは、playbookをインベントリファイルとして配備します。 _Table 1_に一覧表示されている個々のオペレーティングシステムごとに1つのインベントリファイルを作成します。
-
Ansibleが管理するインベントリファイルにホストを作成して追加します。 Ansibleインベントリのデフォルトパスは、
/etc/ansible/hosts
です。Listing 1. インベントリの例client240.mgr.example.org client241.mgr.example.org client242.mgr.example.org client243.mgr.example.org ansible_ssh_private_key_file=/etc/ansible/some_ssh_key [mygroup1] client241.mgr.example.org client242.mgr.example.org [mygroup2] client243.mgr.example.org [all:vars] ansible_ssh_private_key_file=/etc/ansible/my_ansible_private_key
-
SUSE Multi-Linux Manager Web UIで、[
Ansible
]タブから に移動して、制御ノードにインベントリファイルを追加します。 -
[
playbookディレクトリ
]セクションで、[Add a Playbook Directories
](playbookディレクトリの追加)フィールドに/usr/share/scap-security-guide/ansible
を追加し、保存をクリックします。 -
[
インベントリファイル
]の下の[インベントリファイルの追加
]フィールドにインベントリファイルの場所を追加し、保存をクリックします。Listing 2. 例/etc/ansible/sles15 /etc/ansible/sles12 /etc/ansible/centos7
その他のplaybookの例については、https://github.com/ansible/ansible-examplesを参照してください。
2. Ansibleノードとの通信の確立
-
インベントリで使用しているSSHキーを作成します。
ssh-keygen -f /etc/ansible/my_ansible_private_key
-
生成されたSSHキーをAnsible管理対象クライアントにコピーします。 例:
ssh-copy-id -i /etc/ansible/my_ansible_private_key root@client240.mgr.example.org
-
次のように
/etc/ansible/ansible.cfg
で機密鍵を宣言します。private_key_file = /etc/ansible/my_ansible_private_key
my_ansible_private_key
を、機密鍵を含むファイルの名前に置き換えます。 -
制御ノードから次のコマンドを実行して、Ansibleが動作していることをテストします。
ansible all -m ping ansible mygroup1 -m ping ansible client240.mgr.example.org -m ping
これで修復を実行できます。詳細については、コードとしてのコンプライアンスを参照してください。