We can provision remote systems with Ansible. You should have an SSH key-pair and you should take your SSH public key to the machine ~/.ssh/authorized_keys file. The porpuse is you can login without any authorization.
Prerequisites:
You need an Inventory file (for ex.: development.ini) where you determine the host what you want to use:
[MACHINE_NAME]
MACHINE_NAME hostname=MACHINE_NAME ansible_ssh_host=IP_ADDRESS ansible_port=SSH_PORT ansible_connection=ssh ansible_user=USER ansible_ssh_extra_args="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
Required extra args for ssh:
If you have this inventory file you can write a test playbook.yml:
---
- hosts: MACHINE_NAME
tasks:
- name: Say hello
debug:
msg: 'Hello, World'
then you can start the provision:
ansible-playbook -i development.ini playbook.yml