I have below code to call the puppet-agent
install role, this works for Linux, but, when I use a Windows machine it is giving error for the become
line.
How can I update below code for both Linux and Windows. include become for Linux and exclude become
for Windows?
---
- hosts: all
become: yes
roles:
- puppet-agent
Error message
fatal: [winhost]: FAILED! => {"msg": "The powershell shell family is
incompatible with the sudo become plugin"}
What would be worth trying, although I do not have a Windows box at disposal to test it, is to fully omit
the become
directive if you are on Windows:
- hosts: all
gather_facts: yes
roles:
- role: puppet-agent
become: "{{ true if ansible_system == 'Linux' else omit }}"