--- - name: Create directory structure ansible.windows.win_file: path: "{{ storage_api_root }}" state: directory - name: Stop service if running ansible.windows.win_service: name: "{{ disk_service_name }}" state: paused - name: Copy disk_service.py ansible.windows.win_copy: src: disk_service.py dest: "{{ storage_api_root }}\\disk_service.py" - name: install pyinstaller win_shell: "{{ python_venv_bin }} -m pip install pyinstaller" - name: compile binary become: no win_shell: "{{ python_venv }}\\Scripts\\pyinstaller.exe -F {{ storage_api_root }}\\disk_service.py" args: chdir: "{{ storage_api_root }}" - name: Open up port 5000 community.windows.win_firewall_rule: name: _ansible_python_disk_service description: "Firewall rule to allow traffic for Disk info API" localport: 5000 action: allow direction: in protocol: tcp state: present enabled: true ...