f Ansible 出現這個錯誤 Could not find the requested service apache2: host ~ 迪貝之家

Ansible 出現這個錯誤 Could not find the requested service apache2: host

 

這是check syntac 的執行記錄
我昨天測了一下午
ansible-playbook playbook.yml -C
這個劇本就是測不過
去找了Internet
怪了~~ 文不對題
這是output
$ ansible-playbook playbook.yml -C

PLAY [drupal] ************************************************************************************************************************
TASK [Gathering Facts] ***************************************************************************************************************
The authenticity of host '192.168.88.7 (192.168.88.7)' can't be established.
ECDSA key fingerprint is SHA256:cWVg1Hfzq9h5YHIKUWwhE+jz1d+f8IltzWWvB9jbr5Y.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
ok: [192.168.88.7]
TASK [Update apt cache if needed.] ***************************************************************************************************
changed: [192.168.88.7]
TASK [Get software for apt repository management.] ***********************************************************************************
changed: [192.168.88.7]
TASK [Add ondrej repository for later versions of PHP.] ******************************************************************************
changed: [192.168.88.7]
TASK [Install Apache, MySQL, PHP, and other dependencies.] ***************************************************************************
changed: [192.168.88.7]
TASK [Disable the firewall (since this is for local dev only).] **********************************************************************
changed: [192.168.88.7]
TASK [Start Apache, MySQL, and PHP.] *************************************************************************************************
failed: [192.168.88.7] (item=apache2) => {"ansible_loop_var": "item", "changed": false, "item": "apache2", "msg": "Could not find the requested service apache2: host"}
failed: [192.168.88.7] (item=mysql) => {"ansible_loop_var": "item", "changed": false, "item": "mysql", "msg": "Could not find the requested service mysql: host"}
PLAY RECAP ***************************************************************************************************************************
192.168.88.7 : ok=6 changed=5 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
今天我腦袋瓜應該是清楚了點
我突然想到了
-C 是syntax check
根本不會真的進行安裝的TASK
playbook裏頭有一段是要啟動服務
在沒安裝套件的狀況下
是要怎麼啟動該服務阿...
豬頭.....
這是最簡單的邏輯阿
因此我把-C拿掉後執行
哈哈...一切正常了
PLAY [drupal] ************************************************************************************************************************
TASK [Gathering Facts] ***************************************************************************************************************
ok: [192.168.88.7]
TASK [Update apt cache if needed.] ***************************************************************************************************
ok: [192.168.88.7]
TASK [Get software for apt repository management.] ***********************************************************************************
changed: [192.168.88.7]
TASK [Add ondrej repository for later versions of PHP.] ******************************************************************************
changed: [192.168.88.7]
TASK [Install Apache, MySQL, PHP, and other dependencies.] ***************************************************************************
TASK [Disable the firewall (since this is for local dev only).] **********************************************************************
changed: [192.168.88.7]
TASK [Start Apache, MySQL, and PHP.] *************************************************************************************************
ok: [192.168.88.7] => (item=apache2)
ok: [192.168.88.7] => (item=mysql)
TASK [Enable Apache rewrite module (required for Drupal).] ***************************************************************************
changed: [192.168.88.7]
TASK [Add Apache virtualhost for Drupal.] ********************************************************************************************
changed: [192.168.88.7]
TASK [Enable the Drupal site.] *******************************************************************************************************
changed: [192.168.88.7]
TASK [Disable the default site.] *****************************************************************************************************
changed: [192.168.88.7]
TASK [Adjust OpCache memory setting.] ************************************************************************************************
changed: [192.168.88.7]
TASK [Create a MySQL database for Drupal.] *******************************************************************************************
changed: [192.168.88.7]
TASK [Create a MySQL user for Drupal.] ***********************************************************************************************
TASK [Create a MySQL user for Drupal.] ***********************************************************************************************
ok: [192.168.88.7]
TASK [Download Composer installer.] **************************************************************************************************
changed: [192.168.88.7]
TASK [Run Composer installer.] *******************************************************************************************************
changed: [192.168.88.7]
TASK [Move Composer into globally-accessible location.] ******************************************************************************
changed: [192.168.88.7]
TASK [Ensure Drupal directory exists.] ***********************************************************************************************
changed: [192.168.88.7]
TASK [Check if Drupal project already exists.] ***************************************************************************************
ok: [192.168.88.7]
TASK [Create Drupal project.] ********************************************************************************************************
changed: [192.168.88.7]
TASK [Add drush to the Drupal site with Composer.] ***********************************************************************************
changed: [192.168.88.7]
TASK [Install Drupal.] ***************************************************************************************************************
RUNNING HANDLER [restart apache] *****************************************************************************************************
changed: [192.168.88.7]
PLAY RECAP ***************************************************************************************************************************
192.168.88.7 : ok=24 changed=19 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0