測試帳號

  1. 使用新增的帳號 peter 登入 kvm11 及 kvm12,輸入密碼 '123123',成功登入,查詢 id 也有附屬群組 devgrp。
    [deyu1@kvm19 ansible]$ ssh peter@kvm11
    peter@kvm11's password: 
    Last login: Thu Mar 19 10:31:48 2020 from 192.168.122.19
    [peter@kvm11 ~]$ id
    uid=1002(peter) gid=1004(peter) groups=1004(peter),1003(devgrp) 
    context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
    [peter@kvm11 ~]$ exit
    logout
    Connection to kvm11 closed.
    
    [deyu1@kvm19 ansible]$ ssh peter@kvm12
    peter@kvm12's password: 
    [peter@kvm12 ~]$ id
    uid=1001(peter) gid=1003(peter) groups=1003(peter),1002(devgrp) 
    context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
    [peter@kvm12 ~]$ exit
    logout
    Connection to kvm12 closed.
    
  2. 使用新增的帳號 rita 登入 kvm13 及 kvm14,輸入密碼 'qweqwe',成功登入,查詢 id 也有附屬群組 devgrp。
    [deyu1@kvm19 ansible]$ ssh rita@kvm13
    rita@kvm13's password: 
    [rita@kvm13 ~]$ id
    uid=1001(rita) gid=1002(rita) groups=1002(rita),1001(prodgrp) 
    context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
    [rita@kvm13 ~]$ exit
    logout
    Connection to kvm13 closed.
    
    [deyu1@kvm19 ansible]$ ssh rita@kvm14
    rita@kvm14's password: 
    [rita@kvm14 ~]$ id
    uid=1001(rita) gid=1002(rita) groups=1002(rita),1001(prodgrp) 
    context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
    [rita@kvm14 ~]$ exit
    logout
    Connection to kvm14 closed.
    
  3. 查詢 dev 及 test 主機不存在 rita 帳號。
    [deyu1@kvm19 ansible]$ ansible dev -m shell -a "id rita"
    kvm11 | FAILED | rc=1 >>
    id: ‘rita’: no such usernon-zero return code
    
    [deyu1@kvm19 ansible]$ ansible test -m shell -a "id rita"
    kvm12 | FAILED | rc=1 >>
    id: ‘rita’: no such usernon-zero return code
    
  4. 查詢 prod 主機不存在 peter 帳號。
    [deyu1@kvm19 ansible]$ ansible prod -m shell -a "id peter"
    kvm13 | FAILED | rc=1 >>
    id: ‘peter’: no such usernon-zero return code
    
    kvm14 | FAILED | rc=1 >>
    id: ‘peter’: no such usernon-zero return code