我正在使用centos 7盒子安装apache web服务器。 这是webserver.yml文件:
--- # Outline to Playbook Translation
- hosts: apacheWeb
user: aleatoire
sudo: yes
gather_facts: no
tasks:
- name: date/time stamp for when the playbook starts
raw: /bin/date > /home/aleatoire/playbook_start.log
- name: install the apache web server
yum: pkg=httpd state=latest
- name: start the web service
service: name=httpd state=started
- name: install client software - telnet
yum: pkg=telnet state=latest
- name: install client software - lynx
yum: pkg=lynx state=latest
- name: log all the packages installed on the system
raw: yum list installed > /home/aleatoire/installed.log
- name: date/time stamp for when the playbook ends
raw: /bin/date > /home/aleatoire/playbook_end.log
当我用以下方式进行干运行时:
ansible-playbook webserver.yml --check
我一直收到这个错误:
fatal: [<ip_address>]: FAILED! => {"changed": false, "failed": true, "msg": "Could not find the requested service httpd: cannot check nor set state"}
to retry, use: --limit @/home/aleatoire/Outline/webserver.retry
我尝试添加ignore_issues:true,但这也无效。
答案 0 :(得分:1)
--check
实际上不会安装httpd包,如果还没有。因此,如果尚未安装httpd单元文件,则service:
调用将失败。
您可以改用--syntax-check
选项。