- name: Include task list in play only if the condition is true
include_tasks: "{{ hostvar }}.yaml"
when: hostvar is defined
Можешь тогда подсказать...что-то я не пойму тогда структуру..
Если делаю по ней, то в моем втором ямле который я импортирую там такая была структура
---
- hosts: "{{ a_host }}"
become: yes
vars:
pv_ntp_timezone: "Asia/Almaty"
pv_ntp_servers: "['0.pool.ntp.org', '1.pool.ntp.org']"
pre_tasks:
- name: Time setup | Run the equivalent of "apt-get update" as a separate step
apt:
update_cache: yes
when: ansible_distribution == "Ubuntu"
- name: Time setup | Restart service systemd-timesyncd
systemd:
name: systemd-timesyncd
state: restarted
when: ansible_distribution == "Ubuntu"
- name: Time setup | Disable systemd-timesyncd
systemd:
name: systemd-timesyncd
enabled: false
when: ansible_distribution == "Ubuntu"
- name: Time setup | Run the equivalent of "yum update" as a separate step
yum:
update_cache: yes
when: ansible_distribution == "CentOS"
roles:
- {
role: geerlingguy.ntp,
ntp_enabled: true,
ntp_timezone: "{{ pv_ntp_timezone }}",
ntp_manage_config: true,
ntp_servers: "{{ pv_ntp_servers }}"
}
И она теперь не подходит...