Skip to content

Instantly share code, notes, and snippets.

@BjornW
Last active November 28, 2017 10:15
Show Gist options
  • Save BjornW/40f8b95a2030aba9f5ca1cf952bc88c7 to your computer and use it in GitHub Desktop.
Save BjornW/40f8b95a2030aba9f5ca1cf952bc88c7 to your computer and use it in GitHub Desktop.
One-liner to replace sudo in Ansible playbook roles with become
grep -irl 'sudo' . | xargs sed -i 's/sudo: yes/become: true/g'
@BjornW
Copy link
Author

BjornW commented Nov 28, 2017

Just run this in the directory of your Ansible Playbook & roles and it will replace all occurrences of 'sudo: yes' with 'become: true'. This assumes become's default user is root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment