Делегирование — различия между версиями
Root (обсуждение | вклад) |
Root (обсуждение | вклад) |
||
| Строка 24: | Строка 24: | ||
name: lsyncd | name: lsyncd | ||
state: restarted | state: restarted | ||
| − | delegate_to: "{{ | + | delegate_to: "{{ host }}" |
run_once: true | run_once: true | ||
Версия 12:44, 18 сентября 2025
delegate_to - перенаправление выполнения таски на определённый сервер
таска выполнится на test02
tasks:
- name: создаём директории
file:
path: "Шаблон:Item"
state: directory
mode: '0755'
loop:
- /root/111
- /root/222
delegate_to: test02
---cut---
changed: [test02 -> test02] => (item=/root/111)
ok: [test01 -> test02] => (item=/root/111)
changed: [test01 -> test02] => (item=/root/222)
ok: [test02 -> test02] => (item=/root/222)
---cut---
- name: restart lsync on balancer
service:
name: lsyncd
state: restarted
delegate_to: "Шаблон:Host"
run_once: true