可以通过在Ansible命令中使用sudo或ansible_become来以超级用户身份执行命令。
示例代码:
在Ansible命令中使用sudo:
- name: Run command as super user
command: your_command_here
become: true
become_method: sudo
在Ansible命令中使用ansible_become:
- name: Run command as super user
command: your_command_here
become: true
become_method: ansible_become