我制作了一部剧本,然后通过主机复制了我的版本包,但是我的主剧本中的“ delegate_to”存在一些问题。我已经尝试了一切。看到错误了吗?
- name: Install GEOPos2 Ansible on Central
hosts: central_servers
roles:
- central_servers
- name: Copy version package from central_servers to local_servers
hosts: local_servers
synchronize: src=/devops/geopos2-alkosto-{{ version }}-Package.zip dest=/devops/
delegate_to: central_servers[0]
- name: Install GEOPos2 Ansible on Local
hosts: local_servers
roles:
- local_servers
- name: Copy version package from local_servers to pos
hosts: pos
synchronize: src=/devops/geopos2-alkosto-{{ version }}-Package.zip dest=/devops/
delegate_to: local_servers[0]
- name: Install GEOPos2 Ansible on POS
hosts: pos
roles:
- pos
- name: Deleting packages from local and central servers
hosts: central_servers:local_servers
file:
state: absent
path: /devops/geopos2-alkosto-{{ version }}-Package.zip
输出:
ERROR! 'delegate_to' is not a valid attribute for a Play
The error appears to have been in '/workspace/devops/alkosto/install-alkosto/repo/playbook.yml': line 8, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Copy version package from central_servers to local_servers
^ here