Refactor deployment workflows and enhance Docker configuration management
This commit is contained in:
@@ -18,6 +18,31 @@
|
||||
loop: "{{ bootstrap_ssh_public_keys }}"
|
||||
when: bootstrap_ssh_public_keys | length > 0
|
||||
|
||||
- name: Gather service facts
|
||||
ansible.builtin.service_facts:
|
||||
|
||||
- name: Ensure Docker config directory exists
|
||||
ansible.builtin.file:
|
||||
path: /etc/docker
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: Configure Docker registry mirrors
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/docker/daemon.json
|
||||
content: "{{ {'registry-mirrors': docker_registry_mirrors} | to_nice_json }}\n"
|
||||
mode: "0644"
|
||||
register: docker_daemon_config
|
||||
when: docker_registry_mirrors | length > 0
|
||||
|
||||
- name: Restart Docker after daemon config change
|
||||
ansible.builtin.service:
|
||||
name: docker
|
||||
state: restarted
|
||||
when:
|
||||
- docker_daemon_config is changed
|
||||
- "'docker.service' in ansible_facts.services"
|
||||
|
||||
# Команды, которые реально нужны без пароля:
|
||||
# apt / apt-get — обновление пакетов
|
||||
# systemctl — управление сервисами
|
||||
|
||||
Reference in New Issue
Block a user