-1
因此,我正在做一个在centos 7盒子上安装apache web服务器的空运行。 这是webserver.yml文件:有人有什么想法,为什么Ansible一直给我这个错误?
--- # 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:真那也没用。请帮忙。
'--check'不会实际安装httpd包,如果它还没有。那么,如果没有安装httpd单元文件,'service:'调用将失败。 –
ahh!..在Ansible中创建yaml文件后,检查语法错误的最佳方法是什么? – Daniel
用['--syntax-check'](https://raymii.org/s/tutorials/Ansible_-_Playbook_Testing.html) –