dimmaryanto93.docker
dimmaryanto93.docker
This repository is used for installing Docker on Linux.
Supported Platforms
- Debian
- Ubuntu
- CentOS
Ansible - User Guide
Here are the steps to prepare:
Create a new user on your server. It's recommended to use a very strong password or a password generator.
adduser <username>
Grant sudo access without a password by using
visudo
:username ALL=(ALL) NOPASSWD:ALL
Use a private key for SSH login. Generate an SSH key on your local machine and then use
ssh-copy-id user@your-ip-server
to copy the public key to your server.
Requirements
To use this role, you need the following packages/collections:
You can install them by running:
ansible-galaxy collection install ansible.posix community.docker
Alternatively, you can create a requirement.yaml
file and install using:
ansible-galaxy collection install -r requirement.yaml
Your requirement.yaml
should look like this:
---
collections:
- ansible.posix
- community.docker
Role Variables
Here are some variables you can use to configure the Docker daemon:
Variable Name | Example Value | Description |
---|---|---|
docker_storage_driver |
overlay2 |
Default storage driver. Change it as per the documentation. |
docker_insecure_registries_enabled |
false |
Enable insecure registry in /etc/docker/daemon.json . Default is false . Set to true to enable. |
If docker_insecure_registries_enabled
is set to true
, configure the variables as follows:
docker_insecure_registries_conf:
- url: "example.registry.com:8087"
auth:
docker_login: true
user: example
password: secret
- url: "other.registry.com"
auth:
docker_login: true
user: example2
password: secret2
Details of the object:
Variable Name | Example Value | Description |
---|---|---|
url |
example.registry.com:8087 |
Address of the insecure registry. |
auth.docker_login |
true |
Used to login to the insecure registry with username and password . |
auth.user |
- |
Username for logging into the insecure registry. |
auth.password |
- |
Password for logging into the insecure registry. |
Dependencies
None
Example Playbook
Here's an example of how to use this role (you can pass variables as parameters):
- hosts: servers
become: true
roles:
- { role: dimmaryanto93.docker }
License
MIT
ansible-galaxy install dimmaryanto93.docker