Prepare a managed node
Managed nodes are the systems listed in the inventory and which are configured by the control node according to the playbook. You do not have to install Ansible on managed hosts.
Before you begin
- You prepared the control node. For more information, see Preparing a control node on RHEL 10.
- You have SSH access from the control node.
Important Direct SSH access as the
rootuser is a security risk. To reduce this risk, create a local user on this node and configure asudopolicy when preparing a managed node. Ansible on the control node can then use the local user account to log in to the managed node and run playbooks as different users, such asroot.
Procedure
Results
- Verify that you can run commands from the control node on an all managed nodes:
[ansible@control-node]$ ansible all -m pingBECOME password: <password> managed-node-01.example.com | SUCCESS => { ... "ping": "pong" } ...The hard-coded all group dynamically contains all hosts listed in the inventory file.
- Verify that privilege escalation works correctly by running the
whoamiutility on a managed host by using the Ansiblecommandmodule:[ansible@control-node]$ ansible managed-node-01.example.com -m command -a whoamiBECOME password: <password> managed-node-01.example.com | CHANGED | rc=0 >> rootIf the command returns root, you configured
sudoon the managed nodes correctly.