13
我在一個角色中擁有多個任務,如下所示。我不想創建另一個yml
文件來處理此任務。我已經爲Web服務器提供了一個包含,但是我們的幾個Perl服務器需要安裝一些Web包。僅當主機名包含字符串時才運行Ansible任務
- name: Install Perl Modules
command: <command>
with_dict: perl_modules
- name: Install PHP Modules
command: <command>
with_dict: php_modules
when: <Install php modules only if hostname contains the word "batch">
主機清單文件
[webs]
web01
web02
web03
[perl]
perl01
perl02
perl03
perl-batch01
perl-batch02