Spec-Zone.ru › Ansible 2.10

community.general.filetree – рекурсивное сопоставление всех файлов в дереве каталогов

Примечание

Этот плагин входит в коллекцию community.general (версия 1.3.2).

Для его установки используйте: ansible-galaxy collection install community.general.

Для использования в книге задач укажите: community.general.filetree.

  • Обзор
  • Параметры
  • Примеры

Обзор

  • Этот поиск позволяет шаблонизировать полное дерево файлов на целевой системе, сохраняя права и владение.
  • Поддерживает каталоги, файлы и символические ссылки, включая SELinux и другие свойства файлов.
  • Если вы предоставите более одного пути, будет реализована логика first_found, и записи, которые уже обрабатывались в предыдущих путях, не будут обрабатываться. Это позволяет объединять различные деревья в порядке важности или добавлять role_vars к определенным путям, чтобы повлиять на различные экземпляры одного и того же роли.

Параметры

Параметр Варианты/Значения по умолчанию Настройка Комментарии
_terms
строка / обязательно
путь(и) к файлам для чтения

Примеры

- name: Create directories
  ansible.builtin.file:
    path: /web/{{ item.path }}
    state: directory
    mode: '{{ item.mode }}'
  with_community.general.filetree: web/
  when: item.state == 'directory'

- name: Template files (explicitly skip directories in order to use the 'src' attribute)
  ansible.builtin.template:
    src: '{{ item.src }}'
    dest: /web/{{ item.path }}
    mode: '{{ item.mode }}'
  with_community.general.filetree: web/
  when: item.state == 'file'

- name: Recreate symlinks
  ansible.builtin.file:
    src: '{{ item.src }}'
    dest: /web/{{ item.path }}
    state: link
    force: yes
    mode: '{{ item.mode }}'
  with_community.general.filetree: web/
  when: item.state == 'link'

- name: list all files under web/
  ansible.builtin.debug:
    msg: "{{ lookup('community.general.filetree', 'web/') }}"

Авторы

  • Dag Wieers (@dagwieers) <dag@wieers.com>

При парсинге документации для этого плагина были обнаружены ошибки. Пожалуйста, сообщите об ошибке в коллекции.

Ошибки:

  • Unable to normalize filetree: return due to: 9 validation errors for PluginReturnSchema
    return -> _raw -> contains -> group -> type
      string does not match regex "^(bool|complex|dict|float|int|list|str)$" (type=value_error.str.regex; pattern=^(bool|complex|dict|float|int|list|str)$)
    return -> _raw -> contains -> owner -> type
      string does not match regex "^(bool|complex|dict|float|int|list|str)$" (type=value_error.str.regex; pattern=^(bool|complex|dict|float|int|list|str)$)
    return -> _raw -> contains -> path -> type
      string does not match regex "^(bool|complex|dict|float|int|list|str)$" (type=value_error.str.regex; pattern=^(bool|complex|dict|float|int|list|str)$)
    return -> _raw -> contains -> root -> type
      string does not match regex "^(bool|complex|dict|float|int|list|str)$" (type=value_error.str.regex; pattern=^(bool|complex|dict|float|int|list|str)$)
    return -> _raw -> contains -> selevel -> type
      string does not match regex "^(bool|complex|dict|float|int|list|str)$" (type=value_error.str.regex; pattern=^(bool|complex|dict|float|int|list|str)$)
    return -> _raw -> contains -> serole -> type
      string does not match regex "^(bool|complex|dict|float|int|list|str)$" (type=value_error.str.regex; pattern=^(bool|complex|dict|float|int|list|str)$)
    return -> _raw -> contains -> setype -> type
      string does not match regex "^(bool|complex|dict|float|int|list|str)$" (type=value_error.str.regex; pattern=^(bool|complex|dict|float|int|list|str)$)
    return -> _raw -> contains -> seuser -> type
      string does not match regex "^(bool|complex|dict|float|int|list|str)$" (type=value_error.str.regex; pattern=^(bool|complex|dict|float|int|list|str)$)
    return -> _raw -> contains -> src -> type
      string does not match regex "^(bool|complex|dict|float|int|list|str)$" (type=value_error.str.regex; pattern=^(bool|complex|dict|float|int|list|str)$)
    

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/general/filetree_lookup.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API