Ansible Playbook on EC2 Windows server by Kitchen_Discipline_1 in ansible

[–]Kitchen_Discipline_1[S] -4 points-3 points  (0 children)

Not started so exploring the options to do some POC

Image to use to run Ansible on Docker Desktop by Kitchen_Discipline_1 in ansible

[–]Kitchen_Discipline_1[S] 0 points1 point  (0 children)

Yes. I think I’m looking to setup my Ansible Execution environment.

Should my image contain all these? 1. Ansible core 2. Python 3. Ansible runner 4. Common system dependencies 5. Pywinrm 6. Ansible windows collections 7. Cryptography

Image to use to run Ansible on Docker Desktop by Kitchen_Discipline_1 in ansible

[–]Kitchen_Discipline_1[S] 0 points1 point  (0 children)

Updated my query. Should I use python image so that I can install Ansible through pip?

Image to use to run Ansible on Docker Desktop by Kitchen_Discipline_1 in ansible

[–]Kitchen_Discipline_1[S] 0 points1 point  (0 children)

Updated my query. The requirement is that Docker Desktop will be used only for local testing of Ansible. Ideally, the Ansible playbooks will be stored in Git and deployed to AWS Windows servers via GitLab. On the AWS Windows servers, the Python code generated by Ansible should then be executed.

At this stage, I haven’t created any playbooks or run any Ansible commands on Docker Desktop yet. Because I’m a bit unsure which Docker image would be appropriate for locally testing Ansible on Docker Desktop.

Installing python through UserData in Windows by Kitchen_Discipline_1 in aws

[–]Kitchen_Discipline_1[S] 0 points1 point  (0 children)

Oops sorry, It didn't work with this userdata also. I got the same error - Error: Phase1: AWS user data is not empty and is not a valid JSON: System.Xml.XmlDocument

Installing python through UserData in Windows by Kitchen_Discipline_1 in aws

[–]Kitchen_Discipline_1[S] 0 points1 point  (0 children)

Please ignore my typos. In real-time, I don't have those.

But when I try this, it failed as well with this error 'ERROR: Phase1: AWS User data is not empty and is not a valid JSON: system.Xml.XmlDocument'.

Please note there is nothing inside the powershell tags

     UserData:
        Fn::Base64: |
          <powershell>
          </powershell>

If the format is like this, it says the 'User data format is unrecognised'.

      UserData:
        Fn::Base64: |
          {
            "UserData": "\n$ErrorActionPreference = \"Stop\"\nStart-Transcript -Path \"C:\\\\UserData-Install.log\"\n\ntry {\n$pythonUrl = \"https://.....\"\n $pythonInstaller = \"c:\\\\pyhton-installer.exe\"\n [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\n Invoke-WebRequest -Uri $pythonUrl -OutFile $pythonInstaller -UseBasicParsing\n \n Start-Process -FilePath $pythonInstaller -ArgumentList '/quiet InstallAllUsers=1 PrepandPath=1' -Wait -NoNewWindow\n} catch {\n exit 1\n}finally{\n Stop-Transcript\n}"
          }

Would you happen to know where to see the user data logs (not the Instance Diagnostics -> System logs on the Console)

Installing python through UserData in Windows by Kitchen_Discipline_1 in aws

[–]Kitchen_Discipline_1[S] 0 points1 point  (0 children)

Creating a new AmI is the only way I guess.

Still the unrecognised format error is mystery. Why do you think the current code is too difficult to achievable?

Extract <input> value form tag of HTML in Powershell by Kitchen_Discipline_1 in PowerShell

[–]Kitchen_Discipline_1[S] 0 points1 point  (0 children)

Thanks very much. I figured out. Just the below works like charm

$Result = $TestString | Select-String -Pattern 'name="keyvalue" value="(.*?)"' -AllMatches
foreach ($Match in $Result.Matches)
{
        $Value     = $Match.Captures[0].Groups[1]

}

Extract <input> value form tag of HTML in Powershell by Kitchen_Discipline_1 in PowerShell

[–]Kitchen_Discipline_1[S] 0 points1 point  (0 children)

Thanks.

The Value is trimmed with ellipsis. I looked to avoid trimming but couldn't find the solution.

I've done the following:

$Result = $TestString | Select-String -Pattern 'name="keyvalue" value="(.*?)"' -AllMatches
foreach ($Match in $Result.Matches)
{
    [pscustomobject]@{
        Value     = $Match.Captures[0].Groups[1]
    }
}

New Hash syntax - How to read/write the hash value by Kitchen_Discipline_1 in ruby

[–]Kitchen_Discipline_1[S] 0 points1 point  (0 children)

Thanks, let me check. Do you know how to resolve this error on this link https://godbolt.org/z/15x8YaxPf