I've started getting
ERROR! 'become_user' is not a valid attribute for a TaskInclude
while using my playbooks with ansible 2.8.
It works fine with ansible 2.7 and earlier.
Error message says that the problem is in this file on the 'become_user' line:
- name: Install API software
become: true
become_user: "{{ namespace }}"
include_tasks: utils/install_service.yml
vars:
service_name: api
nodejs_service: true
I have not found anything obviously related to this in ansible docs or changelog.
Found a solution in some old issue.
It seems like using 'become' with 'include_tasks' was an undocumented feature that was removed accidentally.
It can be solved by packing include_tasks into a block:
- block:
- name: Install API software
include_tasks: utils/install_service.yml
vars:
service_name: api
nodejs_service: true
become: true
become_user: "{{ namespace }}"
You should be able to simply add these to the variables list that you pass in (with the ansible_
prefix). So that would be:
- name: Install API software
include_tasks: utils/install_service.yml
vars:
service_name: api
nodejs_service: true
ansible_become: true
ansible_become_user: "{{ namespace }}"
For reference, see the upstream issue comment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With