Ansible Tutorial - Service Management Modules | Service Module | Systemd Module
T
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

Check Service status

Start service

Stop service

Restart Service

Enable service

Disable service

Module Options :
arguments
enabled
pattern
runlevel
sleep
state
use
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
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

Check Service status

Start service

Stop service

Restart Service

Enable service

Disable service

Daemon Reload

Restart, enable and daemon reload

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
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
Leave a Comment