Ansible Tutorial - Service Management Modules | Service Module | Systemd Module

Linuxtopic
0

T


 ansible service  module, ansible systemd module with example and start service, stop service and restart service using ansible ad-hoc command.  ansible module, ansible ad-hoc command, ansible service module, ansible systemd module, andible, ansible command,

ags: ansible module, ansible ad-hoc command, ansible service module, ansible systemd module, andible, ansible command, 
[A] Ansible Module : Service




Controls services on remote hosts. Supported init systems include BSD, init, OpenRC, SysV, Solaris SMF, systemd, upstart. For Windows targets, use the [win_service] module instead.



To help service module


ansible-doc service

 ansible service  module, ansible systemd module with example and start service, stop service and restart service using ansible ad-hoc command.  ansible module, ansible ad-hoc command, ansible service module, ansible systemd module, andible, ansible command,





Check Service status


ansible 172.17.20.98 -m service -a "name=vsftpd" | grep ActiveState





Start service


ansible 172.17.20.98 -m service -a "name=vsftpd state=started"





Stop service


ansible 172.17.20.98 -m service -a "name=vsftpd state=stopped"





Restart Service


ansible 172.17.20.98 -m service -a "name=vsftpd state=restarted"





Enable service


ansible 172.17.20.98 -m service -a "name=vsftpd enabled=yes"





Disable service


ansible 172.17.20.98 -m service -a "name=vsftpd enabled=no"







Module Options :



arguments

enabled

pattern

runlevel

sleep

state

use









[B] Ansible Module :  systemd



Controls systemd services on remote hosts.



To help of systemd module


ansible-doc systemd





Check Service status


ansible 172.17.20.98 -m systemd -a "name=vsftpd" | grep ActiveState





Start service


ansible 172.17.20.98 -m systemd -a "name=vsftpd state=started"





Stop service


ansible 172.17.20.98 -m systemd -a "name=vsftpd state=stopped"





Restart Service


ansible 172.17.20.98 -m systemd -a "name=vsftpd state=restarted"





Enable service


ansible 172.17.20.98 -m systemd -a "name=vsftpd enabled=yes"





Disable service


ansible 172.17.20.98 -m systemd -a "name=vsftpd enabled=no"





Daemon Reload


ansible 172.17.20.98 -m systemd -a "daemon_reload=yes"





Restart, enable and daemon reload


ansible 172.17.20.98 -m systemd -a "name=vsftpd state=restarted daemon_reload=yes"








Module Options:




daemon_reload

enabled

force

masked

name

no_block

scope

state

user






Thanks

End of this ansible installation part in CentOS 7, we need your support so i request you to please comment, share and like this post


www.linuxtopic.com



Post a Comment

0Comments

Post a Comment (0)

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Check Now
Ok, Go it!