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" {