start nginx service报错
来源:3-7 Ansible playbooks常用模块案例操作

慕码人4277038
2022-07-10
[deploy@MiWiFi-RA72-srv test_playbooks]$ ansible-playbook -i inventory/testenv ./deploy.yml
PLAY [testservers] ********************************************************************************************************************
TASK [Gathering Facts] ****************************************************************************************************************
ok: [test.example.com]
TASK [print server name and user to remmove testbox] **********************************************************************************
changed: [test.example.com]
TASK [testbox : create a file] ********************************************************************************************************
changed: [test.example.com]
TASK [testbox : copy a file] **********************************************************************************************************
ok: [test.example.com]
TASK [testbox : check if foo.sh exists] ***********************************************************************************************
ok: [test.example.com]
TASK [testbox : debug] ****************************************************************************************************************
ok: [test.example.com] => {
“msg”: “foo.sh exists”
}
TASK [testbox : run the script] *******************************************************************************************************
changed: [test.example.com]
TASK [testbox : write the nginx config file] ******************************************************************************************
ok: [test.example.com]
TASK [testbox : ensure nginx is at the latest version] ********************************************************************************
changed: [test.example.com]
TASK [testbox : start nginx service] **************************************************************************************************
fatal: [test.example.com]: FAILED! => {“changed”: false, “msg”: “Unable to start service nginx: Job for nginx.service failed because the control process exited with error code. See “systemctl status nginx.service” and “journalctl -xe” for details.\n”}
PLAY RECAP ****************************************************************************************************************************
test.example.com : ok=9 changed=4 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
[deploy@MiWiFi-RA72-srv test_playbooks]$ vi inventory/testenv
[deploy@MiWiFi-RA72-srv test_playbooks]$ vi roles/testbox/tasks/main.yml
[deploy@MiWiFi-RA72-srv test_playbooks]$ vi roles/testbox/tasks/main.yml
[deploy@MiWiFi-RA72-srv test_playbooks]$ su
密码:
[root@MiWiFi-RA72-srv test_playbooks]# yum install nginx
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
- base: mirrors.tuna.tsinghua.edu.cn
- epel: mirrors.tuna.tsinghua.edu.cn
- extras: mirrors.tuna.tsinghua.edu.cn
- updates: mirrors.bfsu.edu.cn
软件包 1:nginx-1.22.0-1.el7.ngx.x86_64 已安装并且是最新版本
无须任何处理
[deploy@MiWiFi-RA72-srv test_playbooks]$ systemctl status nginx
● nginx.service - nginx - high performance web server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 日 2022-07-10 13:42:34 CST; 6min ago
Docs: http://nginx.org/en/docs/
Process: 37456 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)
老师,这里看起来是没有nginx.service文件
1回答
-
一路向北
2022-07-12
检查一下这台机器的nginx日志,看有什么错误输出00
相似问题