0
如何將劇本包含在主劇本中?孩子劇本包含多個主機組將劇本集成到主劇本中
例如:兒童sample.yml
- hosts: webservers
remote_user: root
- tasks:
name: ensure apache is at the latest version
yum: name=httpd state=latest
name: write the apache config file
template: src=/srv/httpd.j2 dest=/etc/httpd.conf
- hosts: databases
remote_user: root
- tasks:
name: ensure postgresql is at the latest version
yum: name=postgresql state=latest
name: ensure that postgresql is started
service: name=postgresql state=started
應如何主sample.yml像包括這樣子的劇本?
什麼,如果孩子-sample1.yml有不同的任務,不同的主機組如圖所示的問題嗎? –
沒關係。包括手冊本質上與將其內容複製粘貼到一個大文件中相同。 Ansible隨後通過播放來處理它,檢查對照當前庫存播放「主機模式」並在匹配的服務器上執行任務。 –