2017-12-18 9 views
-2

私は、Apacheをインストール脚本を記述しようとしていますが、私は以下のエラーが表示されます。ここではYAML構文エラー(Ansibleのplayboook)

The offending line appears to be: 

tasks: 
    - name: command to install apache 
    ^here 

は私のYAMLコードは次のとおりです。

--- 
- hosts: all 
    tasks: 
    - name: command to install apache 
     sudo: yes 
     yum: name=httpd state=latest 
     service: name=httpd state=running 

何でしここで間違っている?

答えて

4

Ansibleで1つのタスクに2つのアクション(モジュール)を追加することはできません。

yumserviceを2つのタスクに分割する必要があります。

またsudo宣言は長い時間前に廃止されましたし、今becomeを使用する必要があります。

--- 
- hosts: all 
    tasks: 
    - name: Ensure apache is installed 
     become: yes 
     yum: name=httpd state=latest 

    - name: Ensure httpd service is running 
     become: yes 
     service: name=httpd state=running 
関連する問題