I have a basic playbook to restart an Apache server but I'm wondering how the following command is interpreted and converted to its equivalent -- service httpd start
.
- name: ensure apache is running
service:
name: httpd
state: started
service
module first gets the status of the service (httpd). If the service is started
or running
or reloaded
and the desired service state is started
, it will not restart the service.
self.svc_change = False
...
...
if not self.running and self.state in ["started", "running", "reloaded"]:
self.svc_change = True
If you want to restart:
state: restarted ==> service httpd restart
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.