Documentation survey

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 Systems Management Module.

Procedure: Setting up Ansible Control Node on a SUSE Linux Enterprise 15 SP6 or SP7 system
  1. In the SUSE Multi-Linux Manager Web UI, navigate to Admin  Setup Wizard  Products, verify that SUSE Linux Enterprise Server 15 SP6 x86_64 (or later) with the Systems Management Module and the required Python 3 Module are selected and synchronized.

  2. Deploy a SUSE Linux Enterprise 15 SP6 (or later) client.

  3. In the SUSE Multi-Linux Manager Web UI, navigate to the Systems  Overview page of the client. Select Software  Software Channels and subscribe the client to the SUSE Linux Enterprise Server 15 SP6 x86_64 (or later SP), Systems Management Module and Python 3 Module channels.

  4. クライアントの詳細  プロパティを選択します。 [ 付属エンタイトルメント ]リストで[Ansible制御ノード]を有効にして、プロパティの更新をクリックします。

  5. クライアントの概要ページに移動し、状態  highstateを選択して、highstateの適用をクリックします。

  6. イベントタブを選択して、highstateの状態を確認します。

If you want to install a newer Ansible on a SUSE Linux Enterprise 15 SP4 or SP5 client, you must enable the Python 3 Module.

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インベントリファイルの作成
  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
  2. SUSE Multi-Linux Manager Web UIで、[ Ansible]タブからAnsible  制御ノードに移動して、制御ノードにインベントリファイルを追加します。

  3. playbookディレクトリ]セクションで、[Add a Playbook Directories](playbookディレクトリの追加)フィールドに/usr/share/scap-security-guide/ansibleを追加し、保存をクリックします。

  4. インベントリファイル]の下の[インベントリファイルの追加]フィールドにインベントリファイルの場所を追加し、保存をクリックします。

    Listing 2. 例
    /etc/ansible/sles15
    /etc/ansible/sles12
    /etc/ansible/centos7

    その他のplaybookの例については、https://github.com/ansible/ansible-examplesを参照してください。

2. Ansibleノードとの通信の確立

プロシージャ: Ansibleノードとの通信の確立
  1. インベントリで使用しているSSHキーを作成します。

    ssh-keygen -f /etc/ansible/my_ansible_private_key
  2. 生成されたSSHキーをAnsible管理対象クライアントにコピーします。 例:

    ssh-copy-id -i /etc/ansible/my_ansible_private_key root@client240.mgr.example.org
  3. 次のように/etc/ansible/ansible.cfgで機密鍵を宣言します。

    private_key_file = /etc/ansible/my_ansible_private_key

    my_ansible_private_keyを、機密鍵を含むファイルの名前に置き換えます。

  4. 制御ノードから次のコマンドを実行して、Ansibleが動作していることをテストします。

    ansible all -m ping
    ansible mygroup1 -m ping
    ansible client240.mgr.example.org -m ping

これで修復を実行できます。詳細については、コードとしてのコンプライアンスを参照してください。