File: command-building.yml

package info (click to toggle)
ansible-core 2.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 32,752 kB
  • sloc: python: 181,000; cs: 4,929; sh: 4,611; xml: 34; makefile: 21
file content (54 lines) | stat: -rw-r--r-- 1,443 bytes parent folder | download | duplicates (3)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
- vars:
    atd: '{{ remote_tmp_dir }}/shell/t m p'
    api: '{{ remote_tmp_dir }}/shell/p y t h o n'
  block:
    - name: create test dir
      file:
        path: '{{ atd|dirname }}'
        state: directory

    - name: create tempdir with spaces
      file:
        path: '{{ atd }}'
        state: directory

    - name: create symlink for ansible_python_interpreter to file with spaces
      file:
        dest: '{{ api }}'
        src: '{{ ansible_facts.python.executable }}'
        state: link

    - name: run simple test playbook
      command: >-
        ansible-playbook -vvv -i inventory
        -e 'ansible_python_interpreter="{{ api }}"'
        -e 'ansible_pipelining=0'
        "{{ role_path }}/test-command-building-playbook.yml"
      environment:
        ANSIBLE_REMOTE_TMP: '{{ atd }}'
        ANSIBLE_NOCOLOR: "1"
        ANSIBLE_FORCE_COLOR: "0"
        TEST: "foo%D"
      register: command_building
      delegate_to: localhost

    - debug:
        var: command_building.stdout_lines

    - block:
        - debug:
            var: py_cmd

        - debug:
            var: tmp_dir

        - assert:
            that:
              - py_cmd in exec_line
              - tmp_dir in exec_line
      vars:
        exec_line: '{{ command_building.stdout_lines | select("search", "EXEC.*p y t h o n") | first }}'
        py_cmd: >-
          '"'"'{{ api }}'"'"'
        tmp_dir: >-
          '"'"'{{ atd }}/ansible-tmp-