Server Facts¶
See also: Server Operations.
server.Crontab
¶
host.get_fact(Crontab, user=None)
Returns a dictionary of cron command -> execution time.
{
"/path/to/command": {
"minute": "*",
"hour": "*",
"month": "*",
"day_of_month": "*",
"day_of_week": "*",
},
"echo another command": {
"special_time": "@daily",
},
}
server.HasGui
¶
host.get_fact(HasGui)
Returns a boolean indicating the remote side has GUI capabilities. Linux only.
server.Home
¶
host.get_fact(Home, user='')
Returns the home directory of the given user, or the current user if no user is given.
server.KernelModules
¶
host.get_fact(KernelModules, )
Returns a dictionary of kernel module name -> info.
{
"module_name": {
"size": 0,
"instances": 0,
"state": "Live",
},
}
server.LinuxDistribution
¶
host.get_fact(LinuxDistribution, )
Returns a dict of the Linux distribution version. Ubuntu, Debian, CentOS, Fedora & Gentoo currently. Also contains any key/value items located in release files.
{
"name": "Ubuntu",
"major": 20,
"minor": 04,
"release_meta": {
"CODENAME": "focal",
"ID_LIKE": "debian",
...
}
}
server.LinuxName
¶
host.get_fact(LinuxName)
Returns the name of the Linux distribution. Shortcut for
host.get_fact(LinuxDistribution)['name']
.
server.Locales
¶
host.get_fact(Locales, )
Returns installed locales on the target host.
["C.UTF-8", "en_US.UTF-8"]
server.LsbRelease
¶
host.get_fact(LsbRelease, )
Returns a dictionary of release information using lsb_release
.
{
"id": "Ubuntu",
"description": "Ubuntu 18.04.2 LTS",
"release": "18.04",
"codename": "bionic",
...
}
server.Mounts
¶
host.get_fact(Mounts, )
Returns a dictionary of mounted filesystems and information.
{
"/": {
"device": "/dev/mv2",
"type": "ext4",
"options": [
"rw",
"relatime"
]
},
}
server.Os
¶
host.get_fact(Os, )
Returns the OS name according to uname
.
Warning
This fact is deprecated/renamed, please use the server.Kernel
fact.
server.OsVersion
¶
host.get_fact(OsVersion, )
Returns the OS version according to uname
.
Warning
This fact is deprecated/renamed, please use the server.KernelVersion
fact.
server.SecurityLimits
¶
host.get_fact(SecurityLimits, )
Returns a list of security limits on the target host.
[
{
"domain": "*",
"limit_type": "soft",
"item": "nofile",
"value": "1048576"
},
{
"domain": "*",
"limit_type": "hard",
"item": "nofile",
"value": "1048576"
},
{
"domain": "root",
"limit_type": "soft",
"item": "nofile",
"value": "1048576"
},
{
"domain": "root",
"limit_type": "hard",
"item": "nofile",
"value": "1048576"
},
{
"domain": "*",
"limit_type": "soft",
"item": "memlock",
"value": "unlimited"
},
{
"domain": "*",
"limit_type": "hard",
"item": "memlock",
"value": "unlimited"
},
{
"domain": "root",
"limit_type": "soft",
"item": "memlock",
"value": "unlimited"
},
{
"domain": "root",
"limit_type": "hard",
"item": "memlock",
"value": "unlimited"
}
]
server.Selinux
¶
host.get_fact(Selinux, )
Discovers the SELinux related facts on the target host.
{
"mode": "enabled",
}
server.Sysctl
¶
host.get_fact(Sysctl, keys=None)
Returns a dictionary of sysctl settings and values.
{
"fs.inotify.max_queued_events": 16384,
"fs.inode-state": [
44565,
360,
],
}
server.TmpDir
¶
host.get_fact(TmpDir, )
Returns the temporary directory of the current server, if configured.
server.Users
¶
host.get_fact(Users, )
Returns a dictionary of users -> details.
{
"user_name": {
"comment": "Full Name",
"home": "/home/user_name",
"shell": "/bin/bash,
"group": "main_user_group",
"groups": [
"other",
"groups"
],
"uid": user_id,
"gid": main_user_group_id,
"lastlog": last_login_time,
"password": encrypted_password,
},
}
server.Which
¶
host.get_fact(Which, command)
Returns the path of a given command according to command -v, if available.