首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Agentinstallation.sh需要由user12运行。For user12 password is user12如何传递此密码以执行以下脚本

Agentinstallation.sh需要由user12运行。For user12 password is user12如何传递此密码以执行以下脚本
EN

Stack Overflow用户
提问于 2020-02-10 19:52:00
回答 1查看 24关注 0票数 0

我是新的ansible脚本,我从根用户运行ansible脚本内的ansible剧本,我想在另一个用户(User12)执行脚本。下面是我的ansibe攻略

代码语言:javascript
复制
---
- name: agent installation Script
  hosts: <hostname>
  gather_facts: False
  #Disabling gathering facts because playbook not getting executed on server
  tasks:

  - name: Copy the creating  script to Managed node
    copy:
     src: Createuser.sh
     dest: ~/
     mode: 0777
    become: true
    become_user: root

  - name: Copy the agent zip to Managed node
    copy:
     src:13.2.0.0.0.zip
     dest: ~/
     mode: 0777
    become: true
    become_user: root

  - name: Copy the agent response file to Managed node
    copy:
     src: agent.rsp
     dest: ~/
     mode: 0777
    become: true
    become_user: root

   - name: Execute the  script
    shell: sh ~/Createuser.sh
    become: true
    become_user: root

  - name: Execute the  installation script
    shell: sh ~/Agentinstallation.sh
    become: true
    become_user: user12

Agentinstallation.sh需要由user12运行。For user12 password is user12如何传递此密码以执行上述脚本。

EN

回答 1

Stack Overflow用户

发布于 2020-02-10 22:04:40

使用选项-k时,这将要求输入连接密码。

From the docs

代码语言:javascript
复制
-k, --ask-pass
ask for connection password

-K, --ask-become-pass
ask for privilege escalation password

注意不同之处。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60149822

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档