5
以下任務總是觸發通知爲什麼這個ansible lineinfile任務總是觸發一個通知?
第一次運行時,應用預期的更改, 和行被更改。 如果我再次運行它,ansible認爲它是「改變」,儘管 正則表達式不可能匹配,因爲行成了 「綁定地址= 0.0.0.0」
爲什麼呢?
- name: Ensure MySQL will listen on all ip interfaces (bind to 0.0.0.0)
lineinfile: dest=/etc/mysql/my.cnf
regexp='bind-address\s*=\s*127\.0\.0\.1\s*'
line='bind-address = 0.0.0.0'
state=present
insertafter=EOF
notify: restart mysql