2017-10-16 58 views
0

我想在ansible下降倍數數據庫(MySQL的):Ansible:錯誤滴倍數數據庫MySQL的

- name: Drop databases on Ansible 
    local_action: mysql_db name= {{ item.name }} state=absent 
    with_items: 
     - { name: dba } 
     - { name: dbb } 
     - { name: dbc } 
     ... 

我有這樣的錯誤:

ERROR! Syntax Error while loading YAML. 

The error appears to have been in '/etc/ansible/roles/drop-db/tasks/main.yml': line 7, column 15, but may 
be elsewhere in the file depending on the exact syntax problem. 

The offending line appears to be: 

    local_action: mysql_db name= {{ item.name }} state=absent 
    with_items: 
      ^here 

回答

1

解決您的壓痕!

在使用Ansible的符號時,請勿在=和值之間加上空格。

- name: Drop databases on Ansible 
    local_action: mysql_db name={{ item.name }} state=absent 
    with_items: 
    - { name: dba } 
    - { name: dbb } 
    - { name: dbc } 
    ...