def set_sys(layout):
 if salt.utils.which('localectl'):
  __salt__['cmd.run']('localectl set-keymap {0}'.format(layout))
 elif ('RedHat' in __grains__['os_family']):
  __salt__['file.sed']('/etc/sysconfig/keyboard', '^LAYOUT=.*', 'LAYOUT={0}'.format(layout))
 elif ('Debian' in __grains__['os_family']):
  __salt__['file.sed']('/etc/default/keyboard', '^XKBLAYOUT=.*', 'XKBLAYOUT={0}'.format(layout))
 elif ('Gentoo' in __grains__['os_family']):
  __salt__['file.sed']('/etc/conf.d/keymaps', '^keymap=.*', 'keymap={0}'.format(layout))
 return layout

def set_sys ( layout ) : if salt . utils . which ( 'localectl' ) : __salt__ [ 'cmd.run' ] ( 'localectl set-keymap {0}' . format ( layout ) ) elif ( 'RedHat' in __grains__ [ 'os_family' ] ) : __salt__ [ 'file.sed' ] ( '/etc/sysconfig/keyboard' , '^LAYOUT=.*' , 'LAYOUT={0}' . format ( layout ) ) elif ( 'Debian' in __grains__ [ 'os_family' ] ) : __salt__ [ 'file.sed' ] ( '/etc/default/keyboard' , '^XKBLAYOUT=.*' , 'XKBLAYOUT={0}' . format ( layout ) ) elif ( 'Gentoo' in __grains__ [ 'os_family' ] ) : __salt__ [ 'file.sed' ] ( '/etc/conf.d/keymaps' , '^keymap=.*' , 'keymap={0}' . format ( layout ) ) return layout
set current system keyboard setting cli example: .