Create inventory entries for two hosts:
cat /etc/ansible/hosts
localhost1
localhost2
Make sure both localhost1 and localhost2 resolve to 127.0.0.1:
cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 localhost1 localhost2
Generate SSH key, if you don't have any:
ssh-keygen
Connect to both and accept key fingerprint and install the key:
ssh-copy-id root@localhost1
ssh-copy-id root@localhost2
Finally, run the Ansible playbook:
ansible-playbook harmless-playbook.yaml
When using Foreman with Ansible plugin, do this:
ANSIBLE_CONFIG=/etc/foreman-proxy/ansible.cfg ANSIBLE_LOAD_CALLBACK_PLUGINS=1 ansible-playbook harmless-playbook.yaml