[英]ansible systemd start a service
I want to start a service on systemd service, but I have got an error, i don't understant how to resolved it我想在 systemd 服务上启动一个服务,但出现错误,我不明白如何解决它
- name: Start service
systemd:
name: "{{ item }}"
state: started
enabled: yes
daemon_reload: yes
with_items:
- a.service
I have got thies error :我有这个错误:
failed: [host] (item=a.service) => {"ansible_loop_var": "item", "changed": false, "item": "a.service", "msg": "Could not find the requested service a.service: host"}
失败:[host] (item=a.service) => {"ansible_loop_var": "item", "changed": false, "item": "a.service", "msg": "找不到请求的服务a.service: 主机"}
The problem here is that you don't use your variable as an jinja2.这里的问题是您不将变量用作 jinja2。
Ansible Doc - using-variables-with-jinja2 Ansible Doc - using-variables-with-jinja2
You shall use your variable as "{{ a.service }}"
你应该使用你的变量作为
"{{ a.service }}"
Ie IE
with_items:
- "{{ a.service }}"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.