with_items (2) 썸네일형 리스트형 8.3 ansible | [playbook] centos6 yum repository 변경 centos6의 공식 repository가 만료되어 아래와 같이 주소 변경. --- - name: "Modify CentOS6 Base Repo" hosts: all become: true tasks: - name: "Modify CentOS6 Base Repo" replace: path: /etc/yum.repos.d/CentOS-Base.repo regexp: "{{ item.origin }}" replace: "{{ item.replace }}" with_items: - { origin: "mirrorlist=http://mirrorlist.centos.org", replace: "#mirrorlist=http://mirrorlist.centos.org" } - { origin: "#baseurl=.. 1.6 ansible | [test][playbook] multi command [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 로 여러 명령을 내릴수 있음. 이전 1 다음