使用sudo时的Ansible包警告

时间:2017-07-11 08:42:37

标签: r amazon-web-services shiny ansible redhat

我正在关注此doc以在RedHat 7.3中安装闪亮包。文档中提供的命令是:

$ sudo su - \
-c "R -e \"install.packages('shiny', repos='https://cran.rstudio.com/')\""

在Ansible,我这样写了:

- name: Installing Shiny Packages
    shell: sudo su - -c "R -e \"install.packages('shiny', repos='https://cran.rstudio.com/')\""
   #when: install_R|changed

我在运行我的剧本时收到警告:

TASK [Installing Shiny Packages] ***********************************************
 [WARNING]: Consider using 'become', 'become_method', and 'become_user' rather
than running sudo

changed: [test]

请让我知道如何用ansible写这个,以便我可以避免警告。

1 个答案:

答案 0 :(得分:3)

可能是因为版本<script src="//code.angularjs.org/1.6.2/angular.js"></script> <div ng-app="myApp"> <div ng-controller="MyCtrl"> <navigation1 obj="test"></navigation1> -- <navigation2 obj="test"></navigation2> </div> <script type="text/ng-template" id="navigation.tmpl.html"> <div ng-if="vm.obj"> Hello from directive's controller {{vm.obj}} </div> <div ng-if="obj"> Hello from directive's link {{obj}} </div> </script> </div>中过时sudo的使用。来自官方的Ansible文档。

  

1.9之前,Ansible主要允许使用1.9并限制使用sudo以允许登录/远程用户成为不同的用户并执行任务,使用第二个用户的权限。截至su1.9取代旧版become,同时仍向后兼容。

您可以使用become module删除它,这允许您“成为”另一个用户,与登录计算机的用户(远程用户)不同。您需要设置为sudo/su才能激活权限提升。

true