Automation Tools/Ansible
1.6 ansible | [test][playbook] multi command
ploz
2021. 3. 16. 14:51
반응형
[root@OPENLDAP-TEST ansible]# cat multi_command.yml
---
- name: "command test"
hosts: all
become: true
tasks:
- name: "iptables insert"
command: "{{ item }}"
with_items:
- iptables -D INPUT -s 2.2.2.2
- iptables -D INPUT -s 3.3.3.3
- iptables -D INPUT -s 4.4.4.4
- iptables -D INPUT -s 1.1.1.1 -j ACCEPT
## command, shell 모두 유효
## with_items 로 여러 명령을 내릴수 있음.
반응형