summaryrefslogtreecommitdiffstats
path: root/lib/ansible/plugins/filter/split.yml
blob: 3e7b59ec3d5f1f3d65940979352380f2f4989711 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
DOCUMENTATION:
  name: split
  version_added: "historical"
  short_description: split a string into a list
  description:
    - Using Python's text object method C(split) we turn strings into lists via a 'spliting character'.
  notes:
    - This is a passthrough to Python's C(str.split).
  positional: _input, _split_string
  options:
    _input:
      description: A string to split.
      type: str
      required: true
    _split_string:
      description: A string on which to split the original.
      type: str
      default: ' '

EXAMPLES: |

    # listjojo => [ "jojo", "is", "a" ]
    listjojo: "{{ 'jojo is a' | split }}"

    # listjojocomma => [ "jojo is", "a" ]
    listjojocomma: "{{ 'jojo is, a' | split(',' }}"

RETURN:
  _value:
    description: List of substrings split from the original.
    type: list
    elements: str