使用ansible安装一个或一次多个软件包的yaml,请参考
$ cat systools.yaml
---
- hosts: '{{ hosts }}'
vars:
pkgs:
- screen
- rubygems
tasks:
- name: install epel-release
yum: name=epel-release state=present
- name: install system tools
yum: name={{ pkgs }} state=present
执行命令
$ ansible-playbook systools.yaml --extra-vars "hosts=$CLUSTER_NAME"