-
Notifications
You must be signed in to change notification settings - Fork 185
How to setup Ansible control note
Pablo Suárez Hernández edited this page Jul 15, 2022
·
2 revisions
This guide describe how to setup an Ansible control node in a SLE15SP1 system.
- Deploy a SLE15SP1 instance for the Ansible control node
- Add this repo to the system: https://download.opensuse.org/repositories/systemsmanagement/SLE_15_SP1/
- Refresh Zypper and install
ansible
package on this instance.
- Create your inventory adding your hosts to be managed by Ansible. Default path for the Ansible inventory is
/etc/ansible/hosts
. This is an example:
my-ansible-managed-client-1.tf.local
my-ansible-managed-client-2.tf.local
my-ansible-managed-client-3.tf.local
my-ansible-managed-client-4.tf.local ansible_ssh_private_key_file=/etc/ansible/some_ssh_key
[mygroup1]
my-ansible-managed-client-1.tf.local
my-ansible-managed-client-2.tf.local
[mygroup2]
my-ansible-managed-client-3.tf.local
[all:vars]
ansible_ssh_private_key_file=/etc/ansible/my_ansible_private_key
- Create the SSH keys that you're using in your inventory. Example:
# ssh-keygen -f /etc/ansible/my_ansible_private_key
- Copy the generated SSH keys to the Ansible managed clients. Example:
# ssh-copy-id -i /etc/ansible/my_ansible_private_key [email protected]
- Some examples:
# ansible all -m ping
# ansible mygroup1 -m ping
# ansible my-ansible-managed-client-1.tf.local -m ping
(already integrated in Salt)
In order to have the expected functionality in Salt available in your SLE15SP1 system to be used as "Ansible control node", you need to:
- Add this repo to your SLE15SP1 Ansible control node instance: https://download.opensuse.org/repositories/home:/PSuarezHernandez:/branches:/systemsmanagement:/saltstack:/products:/next/SLE_15_SP1/
- Do
zypper refresh
and install Salt from this repository. - Check if you can get the Ansible inventory with:
salt-call --local ansible.targets
There are a bunch of playbooks examples at https://github.com/ansible/ansible-examples
- Install
git-core
and clone the above repo in your Ansible control node.