比如,可以单独设置become_user,而不设置become。 样例 官方提供 # 要以非root用户身份连接管理系统服务(需要root特权),可以使用默认值begin_user-name:Ensurethehttpdserviceisrunningservice:name:httpdstate:startedbecome:yes# 以apache用户身份运行命令-name:Runacommandastheapacheusercommand:somecommandbecome:yesbecome...
become: yes表示以root权限执行任务。任务中包含了三个步骤: 备份原始配置文件:使用command模块执行cp命令,将原始配置文件备份为nginx.conf.bak。 修改配置文件:使用lineinfile模块修改配置文件。path指定了要修改的文件路径,regexp指定了要匹配的正则表达式,line指定了要替换的新行内容。在这个例子中,将worker_processes...
#become_user=root #become_ask_pass=False [paramiko_connection] # uncomment this line to cause the paramiko connection plugin to not record new host # keys encountered. Increases performance on new host additions. Setting works independently of the # host key checking setting above. #record_host_...
- name: Run a command as the apache user command: somecommand become: yes become_user: apache # 要在shell程序不登录时以nobody用户身份执行操作 - name: Run a command as nobody command: somecommand become: yes become_method: su become_user: nobody become_flags: '-s /bin/sh' 1. 2. ...
become_method指令指定如何升级特权。有多个选项可用,但默认为使用sudo。类似地,become_user指令指定要升级到的用户,但默认为root。 如果所选的become_method机制要求用户输入密码才能升级特权,可以在配置文件中设置become_ask_pass = true指令。 以下示例ansible.cfg文件假设你可以通过基于SSH密钥的身份验证以someuser用户...
ansible 命令become_user ansible 命令指定ssh 端口 摘要: absible 部署安装 #一、概述 运维工具按需不需要有代理程序来划分的话分两类: agent(需要有代理工具):基于专用的agent程序完成管理功能,puppet, func, zabbix agentless(无须代理工具):基于ssh服务完成管理,ansible, fabric...
ANSIBLE_AGNOSTIC_BECOME_PROMPT Display an agnostic become prompt instead of displaying a prompt containing the command line supplied become method. See also AGNOSTIC_BECOME_PROMPT ANSIBLE_CACHE_PLUGIN Chooses which cache plugin to use, the default ‘memory’ is ephemeral. See also CACHE_PLUGIN...
-m:要执行的模块,默认为command -a:指定模块的参数 -u:ssh连接的用户名,默认用root,ansible.cfg中可以配置 -b,--become:变成那个用户身份,不提示密码 -k:提示输入ssh登录密码,当使用密码验证的时候用 -s:sudo运行 -U:sudo到哪个用户,默认为root
您可以通过从 Options 菜单中选中 Enable Privilege Escalation 来启用 become: 注解 如果在 Ansible Tower 3.1.x 中维护扫描作业模板,然后升级到 Ansible Tower 3.2,则会自动创建一个新的“Tower Fact Scan - Default”项目。此项目包含之前在 Ansible Tower 版本中使用的旧扫描 playbook。 16.9.2. scan_facts....
This will for example suggest using the git module # instead of shelling out to the git command. # command_warnings = False # set plugin path directories here, separate with colons #action_plugins = /usr/share/ansible/plugins/action #ansible action 插件路径 #become_plugins = /usr/share/ansi...