mirror of
https://github.com/batonogov/learn-devops.git
synced 2025-11-29 00:33:02 +00:00
Добавлена роль с установкой докера и настройкой зеркал (#10)
Co-authored-by: Fedor Batonogov <f.batonogov@yandex.ru>
This commit is contained in:
committed by
GitHub
parent
a327438868
commit
51fd58adbb
7
ansible/docker.yaml
Normal file
7
ansible/docker.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: Развертывание docker
|
||||||
|
become: true
|
||||||
|
hosts:
|
||||||
|
- test_hosts
|
||||||
|
roles:
|
||||||
|
- docker_install
|
||||||
@@ -19,3 +19,11 @@ kubeadm:
|
|||||||
vars:
|
vars:
|
||||||
ansible_user: infra
|
ansible_user: infra
|
||||||
ansible_port: 22
|
ansible_port: 22
|
||||||
|
|
||||||
|
test_hosts:
|
||||||
|
hosts:
|
||||||
|
kubeadm-cp-01:
|
||||||
|
ansible_host: 10.0.75.203
|
||||||
|
vars:
|
||||||
|
ansible_user: infra
|
||||||
|
ansible_port: 22
|
||||||
|
|||||||
7
ansible/roles/docker_install/files/daemon.json
Normal file
7
ansible/roles/docker_install/files/daemon.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"registry-mirrors": [
|
||||||
|
"https://dockerhub.timeweb.cloud",
|
||||||
|
"https://mirror.gcr.io",
|
||||||
|
"https://public.ecr.aws"
|
||||||
|
]
|
||||||
|
}
|
||||||
7
ansible/roles/docker_install/handlers/main.yml
Normal file
7
ansible/roles/docker_install/handlers/main.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: Перезапускаю docker.service
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: docker.service
|
||||||
|
state: restarted
|
||||||
|
enabled: true
|
||||||
|
daemon_reload: true
|
||||||
5
ansible/roles/docker_install/tasks/main.yml
Normal file
5
ansible/roles/docker_install/tasks/main.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
# tasks file for docker-install
|
||||||
|
- name: Install Docker on Ubuntu
|
||||||
|
ansible.builtin.import_tasks: ubuntu.yml
|
||||||
|
when: ansible_distribution == 'Ubuntu'
|
||||||
27
ansible/roles/docker_install/tasks/ubuntu.yml
Normal file
27
ansible/roles/docker_install/tasks/ubuntu.yml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
- name: Добавляю ключ Docker GPG
|
||||||
|
ansible.builtin.apt_key:
|
||||||
|
url: https://download.docker.com/linux/ubuntu/gpg
|
||||||
|
state: present
|
||||||
|
keyring: /etc/apt/trusted.gpg.d/docker.gpg
|
||||||
|
|
||||||
|
- name: Добавляю репозиторий Docker
|
||||||
|
ansible.builtin.apt_repository:
|
||||||
|
repo: deb https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable
|
||||||
|
state: present
|
||||||
|
filename: docker
|
||||||
|
|
||||||
|
- name: Устанавливаю нужные пакеты
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- docker-ce
|
||||||
|
state: present
|
||||||
|
update_cache: true
|
||||||
|
|
||||||
|
- name: Наливаю daemon.json
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: daemon.json
|
||||||
|
dest: /etc/docker/daemon.json
|
||||||
|
mode: '644'
|
||||||
|
notify:
|
||||||
|
- Перезапускаю docker.service
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
variable "vm_count" {
|
variable "vm_count" {
|
||||||
description = "Number of VMs to create"
|
description = "Number of VMs to create"
|
||||||
default = 2
|
default = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "proxmox_virtual_environment_vm" "vm" {
|
resource "proxmox_virtual_environment_vm" "vm" {
|
||||||
|
|||||||
Reference in New Issue
Block a user