首页 > 解决方案 > 两个ansible sesu成为任务生成错误

问题描述

我创建了一个剧本,我需要使用 sesu become 方法执行任务,但是得到一个错误,ansible 声称当他到达我使用 sesu 的第二个任务时 sesu escalate previleges 不存在。

任务:添加自定义属性结束并完成,没有任何错误。

任务添加共享库生成错误,错误是'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 }}'

有什么想法吗?

标签: ansible

解决方案


推荐阅读