From 51fd58adbbdb42c68e5779c0c27501307da136d1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 31 May 2024 08:54:22 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=80=D0=BE=D0=BB=D1=8C=20=D1=81=20=D1=83=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=BE=D0=B9=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=BA=D0=B5=D1=80=D0=B0=20=D0=B8=20=D0=BD=D0=B0=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=B9=D0=BA=D0=BE=D0=B9=20=D0=B7=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B0=D0=BB=20(#10)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fedor Batonogov --- ansible/docker.yaml | 7 +++++ ansible/inventory.yml | 8 ++++++ .../roles/docker_install/files/daemon.json | 7 +++++ .../roles/docker_install/handlers/main.yml | 7 +++++ ansible/roles/docker_install/tasks/main.yml | 5 ++++ ansible/roles/docker_install/tasks/ubuntu.yml | 27 +++++++++++++++++++ opentofu/test_vm/vm.tf | 2 +- 7 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 ansible/docker.yaml create mode 100644 ansible/roles/docker_install/files/daemon.json create mode 100644 ansible/roles/docker_install/handlers/main.yml create mode 100644 ansible/roles/docker_install/tasks/main.yml create mode 100644 ansible/roles/docker_install/tasks/ubuntu.yml diff --git a/ansible/docker.yaml b/ansible/docker.yaml new file mode 100644 index 0000000..3691673 --- /dev/null +++ b/ansible/docker.yaml @@ -0,0 +1,7 @@ +--- +- name: Развертывание docker + become: true + hosts: + - test_hosts + roles: + - docker_install diff --git a/ansible/inventory.yml b/ansible/inventory.yml index d9bdbd2..10e4166 100644 --- a/ansible/inventory.yml +++ b/ansible/inventory.yml @@ -19,3 +19,11 @@ kubeadm: vars: ansible_user: infra ansible_port: 22 + +test_hosts: + hosts: + kubeadm-cp-01: + ansible_host: 10.0.75.203 + vars: + ansible_user: infra + ansible_port: 22 diff --git a/ansible/roles/docker_install/files/daemon.json b/ansible/roles/docker_install/files/daemon.json new file mode 100644 index 0000000..aa6d6cb --- /dev/null +++ b/ansible/roles/docker_install/files/daemon.json @@ -0,0 +1,7 @@ +{ + "registry-mirrors": [ + "https://dockerhub.timeweb.cloud", + "https://mirror.gcr.io", + "https://public.ecr.aws" + ] +} diff --git a/ansible/roles/docker_install/handlers/main.yml b/ansible/roles/docker_install/handlers/main.yml new file mode 100644 index 0000000..9eb71cc --- /dev/null +++ b/ansible/roles/docker_install/handlers/main.yml @@ -0,0 +1,7 @@ +--- +- name: Перезапускаю docker.service + ansible.builtin.systemd: + name: docker.service + state: restarted + enabled: true + daemon_reload: true diff --git a/ansible/roles/docker_install/tasks/main.yml b/ansible/roles/docker_install/tasks/main.yml new file mode 100644 index 0000000..a15b1e8 --- /dev/null +++ b/ansible/roles/docker_install/tasks/main.yml @@ -0,0 +1,5 @@ +--- +# tasks file for docker-install +- name: Install Docker on Ubuntu + ansible.builtin.import_tasks: ubuntu.yml + when: ansible_distribution == 'Ubuntu' diff --git a/ansible/roles/docker_install/tasks/ubuntu.yml b/ansible/roles/docker_install/tasks/ubuntu.yml new file mode 100644 index 0000000..fea48c0 --- /dev/null +++ b/ansible/roles/docker_install/tasks/ubuntu.yml @@ -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 diff --git a/opentofu/test_vm/vm.tf b/opentofu/test_vm/vm.tf index a6345ee..3d4f64c 100644 --- a/opentofu/test_vm/vm.tf +++ b/opentofu/test_vm/vm.tf @@ -1,6 +1,6 @@ variable "vm_count" { description = "Number of VMs to create" - default = 2 + default = 1 } resource "proxmox_virtual_environment_vm" "vm" {