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 that
SUSE Linux Enterprise Server 15 SP6 x86_64(or later) with theSystems Management Moduleand the requiredPython 3 Moduleare selected and synchronized.SUSE Linux Enterprise 15 SP6 (またはそれ以降)のクライアントを配備します。
In the SUSE Multi-Linux Manager Web UI, navigate to the page of the client. Select and subscribe the client to the
SUSE Linux Enterprise Server 15 SP6 x86_64(or later SP),Systems Management ModuleandPython 3 Modulechannels.Select of your client. From the
Add-On System Typeslist enableAnsible Control Nodeand click Update Properties.クライアントの概要ページに移動し、を選択して、highstateの適用をクリックします。
イベントタブを選択して、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.
|
Ansibleの新しいバージョンでは、古いPythonバージョンを搭載したノードの管理はサポートされなくなりました。 管理対象ノードが依然として古いPythonバージョンをデフォルトとして設定している場合、playbookの実行中に接続エラーや障害が発生する可能性があります。 これに対処するには、可能であれば管理対象ノードのPythonをアップグレードし、Ansibleのインベントリまたは設定で正しいPythonインタープリタを設定する必要があります。 |
1. Ansibleインベントリファイルの作成
Ansible統合ツールは、playbookをインベントリファイルとして配備します。 表1に一覧表示されている個々のオペレーティングシステムごとに1つのインベントリファイルを作成します。
Create and add your hosts to an inventory file to be managed by Ansible. The default path for an Ansible inventory is
/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_public_key_file=/etc/ansible/my_ansible_private_keyIn the SUSE Multi-Linux Manager Web UI, from the
Ansibletab navigate to to add inventory files to the control node.Under the
Playbook Directoriessection add/usr/share/scap-security-guide/ansibleto theAdd a Playbook Directoriesfield and click Save.Under
Inventory Filesadd your inventory file locations to theAdd an Inventory filefield and click Save.Listing 2. 例/etc/ansible/sles15 /etc/ansible/sles12 /etc/ansible/centos7その他のplaybookの例については、https://github.com/ansible/ansible-examplesを参照してください。
-
インベントリで使用しているSSHキーを作成します。
ssh-keygen -f /etc/ansible/my_ansible_private_key
-
生成されたSSHキーをAnsible管理対象クライアントにコピーします。 例:
ssh-copy-id -i /etc/ansible/my_ansible_public_key root@client240.mgr.example.org
-
Declare the private key in
/etc/ansible/ansible.cfgas follows:private_key_file = /etc/ansible/my_ansible_private_key
Replace
my_ansible_private_keywith the name of the file containing the private key. -
制御ノードから次のコマンドを実行して、Ansibleが動作していることをテストします。
ansible all -m ping ansible mygroup1 -m ping ansible client240.mgr.example.org -m ping
これで修復を実行できます。詳細については、コードとしてのコンプライアンスを参照してください。