repo
project tree
# cd ~/terra/doc/
# tree
.
├── README.md
├── ansible.cfg -> template/ansible/ansible.cfg
├── inventories
│ └── hosts
├── roles
│ └── docker
│ └── tasks
│ └── main.yml
├── site.yml
└── template
...
template/terraform/terraform.tfvarsservers_config = {
doc = {
name = "doc"
flavor_id = "xxx"
image_id = "xxx"
key_pair = "teityura"
volume_size = 10
security_groups = ["xxx"]
net_int = "xxx"
net_ext = "ext_net"
ssh_user = "ubuntu"
ssh_key_path = "/path/to/my/key"
},
}
volumes_config = {
doc = {
volume_size = 50,
volume_mount_path = "/var/lib/docker"
}
}
docker role
roles/docker/tasks/main.yml---
- name: Install dependencies packages
apt:
name:
- ca-certificates
state: present
update_cache: yes
- name: Add gpg key
get_url:
url: https://download.docker.com/linux/ubuntu/gpg
dest: /etc/apt/keyrings/docker.asc
mode: '0644'
force: true
- name: Add repository
apt_repository:
repo: >-
deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc]
https://download.docker.com/linux/ubuntu
{{ ansible_distribution_release }}
stable
state: present
filename: docker
- name: Install required packages
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
state: present
update_cache: yes
- name: Start docker service
systemd:
name: docker
state: started
enabled: yes
docs
- Install Docker Engine on Ubuntu