This is a simple Ansible playbook to install Docker and Docker Compose on a remote server.
- WSL2 (Ubuntu 22.04) on Windows 11
- ansible [core 2.13.5]
- Create
hosts
file and add your server IP address.[GROUP_NAME] YOUR_SERVER_IP
- Install Ansible on your local machine.
$ pip install ansible
- ssh to your server and add your public key to
~/.ssh/authorized_keys
.
Tips: If you want to use password, addansible_ssh_user=
as shown below inhosts
file.[GROUP_NAME] YOUR_SERVER_IP ansible_ssh_user=YOUR_USER_NAME ansible_ssh_pass=YOUR_PASSWORD
- Run the playbook.
$ ansible-playbook -i hosts main.yml
- Check the installation.