我创建了一个剧本,其中我需要使用sesu来执行任务成为方法,但是遇到一个错误,ansible声称当sesu达到我使用sesu的第二项任务时,sesu升级特权不存在。
任务:添加自定义属性结束,并且没有任何错误。
添加共享库任务添加生成错误,错误是未对'sesu'升级特权进行验证:
- name: Add custom properties
become_user: was_user
become: true
become_method: sesu
become_flags: '-'
shell: "addCustomProperties.py {{item.path}}"
with_items: "{{ customProperties_find.files |sort(attribute='path') }}"
loop_control:
label: '{{ item.path }}'
- name: Find addSharedLibrary config files
find:
paths: "addSharedLibrary"
patterns: "*.properties"
register: addSharedLibrary_find
- name: Add shared libraries
become_user: was_user
become: true
become_method: sesu
become_flags: '-'
shell: "addSharedLibrary.py {{item.path}}"
#with_items: "{{ addSharedLibrary_find.files }}"
with_items: "{{ addSharedLibrary_find.files |sort(attribute='path') }}"
loop_control:
label: '{{ item.path }}'
有什么想法吗?