首页 > 其他 > 详细

Ansible - Current user is root if become is true

时间:2020-12-14 14:36:31      阅读:36      评论:0      收藏:0      [点我收藏+]
---
- hosts: zubt1

  tasks:
    - name: Get current user
      shell: whoami
      register: current_user_nobecome

    - name: Get current user with become is true
      shell: whoami
      register: current_user_become
      become: true

    - name: Print current user
      debug:
         msg: Current user is "{{ current_user_nobecome.stdout }}". Current user with become true is "{{ current_user_become.stdout }}".

TASK [Print current user] *******************************************************************************************************************************************
ok: [zubt1] => {
    "msg": "Current user is \"scnzzh\". Current user with become true is \"root\"."
}

 

Ansible - Current user is root if become is true

原文:https://www.cnblogs.com/zhangzhihui/p/14132495.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!