Closed jimbo8098 closed 3 years ago
Yeah something about this line isn't playing with Ansible:
($sid.Translate([System.Security.Principal.NTAccount]).Value -split "{{ '\\' }}")[1]
When this is added to the command, it immediately causes the command to repeat. If I run the same with just the first line it runs as expected:
$sid = New-Object -TypeName System.Security.Principal.SecurityIdentifier -ArgumentList "S-1-5-32-544"
Ah think this may be it. If you use the following:
- win_shell: |
$sid = New-Object -TypeName System.Security.Principal.SecurityIdentifier -ArgumentList "S-1-5-32-544"
($sid.Translate([System.Security.Principal.NTAccount]).Value -split '\\')
check_mode: no
changed_when: False
You get this output:
TASK [jborean93.win_openssh : configure sshd_config file] *******************************************************************************************************************************************************************************************************************************************************************
task path: /home/jimspeir/.ansible/roles/jborean93.win_openssh/tasks/service.yml:27
redirecting (type: modules) ansible.builtin.win_lineinfile to community.windows.win_lineinfile
redirecting (type: modules) ansible.builtin.win_lineinfile to community.windows.win_lineinfile
redirecting (type: modules) ansible.builtin.win_lineinfile to community.windows.win_lineinfile
redirecting (type: modules) ansible.builtin.win_lineinfile to community.windows.win_lineinfile
fatal: [windoze]: FAILED! =>
reason: |-
failed at splitting arguments, either an unbalanced jinja2 block or quotes: $sid = New-Object -TypeName System.Security.Principal.SecurityIdentifier -ArgumentList "S-1-5-32-544"
($sid.Translate([System.Security.Principal.NTAccount]).Value -split '\\')
The error appears to be in '/home/jimspeir/.ansible/roles/jborean93.win_openssh/tasks/sshd_config.yml': line 36, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- win_shell: |
^ here
How weird!
Looks like I've fixed it, will clean up and PR
I've noted the following in the most recent version of the role:
This occurs in:
I was able to fix the issue where the command ends abruptly using the following:
But this only ends in a similar situation:
I will keep having a look into this though since I'm building a Win 2019 Core VM using your windoze repo. Given the time, likely continuing on Monday.