--- #必須字段,類同於#/bin/bash - hosts: test #遠程操做主機 remote_user: cedar #遠程操做用戶 become: yes #是否sudo tasks: - name: "安裝zookeeper" #任務命名 command: yum -y install mesosphere-zookeeper #遠程執行命令安裝zook - name: "啓動zookeeper" #任務命名 service: #service模塊 name: zookeeper #服務名zookeeper state: started #動做started - name: "設置開機啓動" #任務命名 service: #service模塊 name: zookeeper #服務名zookeeper enabled: yes #enabled參數爲YES開機啓動