FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


os:linux:user:index.html



Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
os:linux:user:index.html [2018/02/21 23:46]
kurihara
os:linux:user:index.html [2019/02/11 00:39] (current)
kurihara
Line 34: Line 34:
  
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
-$ fab  -H $H auth.pro  user.check_user:user01 +$ fab  -H $H   user.check_user:user01 
-$ echo x.x.x.x | fab  auth.pro  user.check_user:user01+$ echo x.x.x.x | fab    user.check_user:user01
 </sxh> </sxh>
  
  
-==== Fabric Temporary Run Call Examples====+==== Fabric one-line Task Examples====
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
 $ H=test-server-1 $ H=test-server-1
  
-$ fab -H $H auth.pro -- hostname+$ fab -H $H  -- hostname
  
-$ fab -H $H auth.pro -- id user01 +$ fab -H $H  -- id user01 
-$ fab -H $H auth.pro -- "cat /etc/passwd |grep user01"   # check login shell +$ fab -H $H  -- "cat /etc/passwd |grep user01"   # check login shell 
-$ fab -H $H auth.pro -- grep user01 /etc/group+$ fab -H $H  -- grep user01 /etc/group
  
-$ fab -H $H auth.pro -- sudo gpasswd -a user1 sudo  # add USER to GROUP +$ fab -H $H  -- sudo gpasswd -a user1 sudo  # add USER to GROUP 
-$ fab -H $H auth.pro -- sudo gpasswd -r user1 sudo  # remove USER from GROUP+$ fab -H $H  -- sudo gpasswd -r user1 sudo  # remove USER from GROUP
 </sxh> </sxh>
  
Line 102: Line 102:
 def check_group(group): def check_group(group):
     """user.check_group:group01"""     """user.check_group:group01"""
-    res = run("grep %s /etc/group" % group, warn_only=True)+    res = run("grep ^%s /etc/group" % group, warn_only=True)
     if res.failed is True:     if res.failed is True:
         puts(red("There isn't %s in %s." % (group, env.host_string)))         puts(red("There isn't %s in %s." % (group, env.host_string)))


os/linux/user/index.html.1519224370.txt.gz · Last modified: 2018/02/21 23:46 by kurihara