ansible-playbook之tags標簽(四)


一、tags標簽

[root@linux-node1 ansible]# cat httpd.yaml 
---
- hosts: date
  remote_user: root
  
  tasks:
    - name: install httpd package
      yum: name=httpd
      tags: inshttpd
    - name: copy conf file
      copy: src=files/httpd.conf dest=/etc/httpd/conf backup=yes
      notify: restart service
    - name: start service
      service: name=httpd state=started enabled=yes
      tags: rshttpd

  handlers:
    - name: restart service
      service: name=httpd state=restarted

二、執行自己定義的標簽 (-t 加自定義標簽)、標簽名字可以一樣,如果調用會同時執行

ansible-playbook -t inshttpd,rshttpd httpd.yaml


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM