[ansible-project] Re: Parsing var list of dictionaries in json to Powershell - the term convert-fromjson is not recognized.....

2019-02-15 Thread java_cat33
Thank you so much for your assistance - this did the trick! Why won't $args[0] be the whole JSON string? And how do you know when to encode? I've hit some issues on the PS side now I'll work through that's not related to Ansible (script works fine when running through the loop in debug mode -

[ansible-project] Re: Parsing var list of dictionaries in json to Powershell - the term convert-fromjson is not recognized.....

2019-02-14 Thread java_cat33
Argh! I'd been staring at the code way too long! I had correct syntax commented out. Thanks Jordan getting a bit further now. Now troubleshooting this "stderr_lines": [ 64 "ConvertFrom-Json : Invalid JSON primitive: .", 65 "At

[ansible-project] Parsing var list of dictionaries in json to Powershell - the term convert-fromjson is not recognized.....

2019-02-14 Thread java_cat33
I'm not too sure if this is an issue with how I'm parsing to the PS script.. or the PS script accepting the arg in json hence posting here sorry I have a var that consists of a list of dictionaries. In my play I have a task that runs a Powershell script and the var is parsed in json as

Re: [ansible-project] How to sort a loop based upon a key value - weird behaviour using win_dsc

2019-01-21 Thread java_cat33
u would need to use > something like `selectattr` and concatenate results. > > On Mon, Jan 21, 2019 at 2:49 PM java_cat33 > > wrote: > >> Hi - I've got a few questionsI have a variable (dictionary with lists >> I think is what it is? Is this the correct name/term?

[ansible-project] How to sort a loop based upon a key value - weird behaviour using win_dsc

2019-01-21 Thread java_cat33
Hi - I've got a few questionsI have a variable (dictionary with lists I think is what it is? Is this the correct name/term?) dns_nat_dc1_records: - { zone: 'test.com', name: 'server1', target: '192.168.1.10', type: 'ARecord', state: 'present' } - { zone: 'test.com', name: 'server2',

[ansible-project] Re: Issuing creating domain users with module win_dsc and resource xADuser parsing pscredentials

2019-01-17 Thread java_cat33
Please ignore formatting in the last pasted bit of code - upn and groups are in a line indented from loop. On Thursday, January 17, 2019 at 10:42:29 PM UTC+13, java_cat33 wrote: > > I got the play working user dsc by removing the duplicate password entry, > but I also had to add

[ansible-project] Re: Issuing creating domain users with module win_dsc and resource xADuser parsing pscredentials

2019-01-17 Thread java_cat33
I got the play working user dsc by removing the duplicate password entry, but I also had to add the field of "PasswordAuthentication" and set this to "Negotiate" for it to work! Thanks for your help. In regards to your last question I get the error of "your username or password is incorrect,

[ansible-project] Re: Issuing creating domain users with module win_dsc and resource xADuser parsing pscredentials

2019-01-14 Thread java_cat33
Thanks, Jordan - I tried your suggestion for the username and password parameter Password_username: "{{ item.user }}" Password_password: "{{ testuser_pwd }}" # This is stored in secrets.yml - encrypted via Vault New error is: "module_stderr": "Exception calling \"Add\" with \"2\"

[ansible-project] Issuing creating domain users with module win_dsc and resource xADuser parsing pscredentials

2019-01-13 Thread java_cat33
I'm trying to create a bunch of domain application test accounts with the same password using DSC Resource xADUser. I have a file called secrets.yml that contains the password for these accounts - secrets.yml is encrypted via Vault. This also includes ansible_admin_user and

[ansible-project] Re: Powershell script failing when run in playbook - works on other servers and runs ok manually on target host - cannot find path

2018-05-17 Thread java_cat33
OK - issue resolved was targeting wrong server in inventory file! On Friday, May 18, 2018 at 12:05:15 PM UTC+12, java_cat33 wrote: > > The play copies a powershell script and runs it on the target - the script > looks up files in C:\Temp. This path definitely exists. > > I ca

[ansible-project] Powershell script failing when run in playbook - works on other servers and runs ok manually on target host - cannot find path

2018-05-17 Thread java_cat33
The play copies a powershell script and runs it on the target - the script looks up files in C:\Temp. This path definitely exists. I can run this play without issues against other test servers - now that I want to run this play on the actual server I want to configure I get the below

[ansible-project] Re: File copy/Create folder on Windows server based upon json output from Powershell

2018-05-16 Thread java_cat33
Updated - changed script to now add the two variables into a hashtable that is converted to json - assume this is the correct approach. This can be returned to the script_output registered in the play. On Thursday, May 17, 2018 at 4:49:07 PM UTC+12, java_cat33 wrote: > > Sorry - I'

[ansible-project] Re: File copy/Create folder on Windows server based upon json output from Powershell

2018-05-16 Thread java_cat33
this to json? Assuming the hashtable is the recommended approach - the returns json could then be searched for the relevant key name? On Tuesday, May 15, 2018 at 4:20:44 PM UTC+12, java_cat33 wrote: > > Nice - thanks Jordan. That's easier than what I've just done > > win_file: >

[ansible-project] Re: File copy/Create folder on Windows server based upon json output from Powershell

2018-05-14 Thread java_cat33
Nice - thanks Jordan. That's easier than what I've just done win_file: path: C:\inetpub\{{ script_filename.Name | regex_replace('.zip$','') }} Thanks again! On Tuesday, May 15, 2018 at 3:56:20 PM UTC+12, Jordan Borean wrote: > > Hey > > There are a few ways to do this, they usually

[ansible-project] Re: File copy/Create folder on Windows server based upon json output from Powershell

2018-05-14 Thread java_cat33
Jordan do you know how to strip the ".zip" off the file name? I've been looking at http://jinja.pocoo.org/docs/2.10/templates/#truncate but haven't cracked it yet. On Tuesday, May 15, 2018 at 2:17:32 PM UTC+12, java_cat33 wrote: > > Thanks Jordan! That code worked a treat - r

[ansible-project] Re: File copy/Create folder on Windows server based upon json output from Powershell

2018-05-14 Thread java_cat33
Thanks Jordan! That code worked a treat - really appreciate your assistance and detailed explanations below. On Tuesday, May 15, 2018 at 12:58:42 PM UTC+12, java_cat33 wrote: > > Firstly - sorry for the noob question. > > I've written a Powershell script that is run from a play

[ansible-project] File copy/Create folder on Windows server based upon json output from Powershell

2018-05-14 Thread java_cat33
Firstly - sorry for the noob question. I've written a Powershell script that is run from a play that returns in json the name of a zip file. Output from Powershell { "Name": "latest-ansible v0.1.zip" } ***playbook*** --- - hosts: all vars: filename: none tasks: - name:

[ansible-project] Re: Noob question - inventory and group_vars

2018-05-09 Thread java_cat33
Thanks Edward - this sounds almost the same as doing what I performed? On Wednesday, May 9, 2018 at 9:07:30 PM UTC+12, java_cat33 wrote: > > So far I've found out that if I have an inventory file (E.G inventory.yml) > within a playbook folder, and a file named web.yml in group_vars

[ansible-project] Noob question - inventory and group_vars

2018-05-09 Thread java_cat33
So far I've found out that if I have an inventory file (E.G inventory.yml) within a playbook folder, and a file named web.yml in group_vars I can do a win_ping without issues when the inventory file contains a group named [web] and a server resides within this group - cool. I expanded the

[ansible-project] Re: What is recommended version???

2018-05-08 Thread java_cat33
Thanks Jordan - nice one. I went off the first Google hit which happened to be 2.4 :-) Cheers for your help. On Tuesday, May 8, 2018 at 8:34:45 PM UTC+12, java_cat33 wrote: > > Hi - I'm completely new to Ansible (and not too familiar with Linux). What > is the recommended Ansibl

Re: [ansible-project] What is recommended version???

2018-05-08 Thread java_cat33
I was just going off the following link. https://docs.ansible.com/ansible/2.4/release_and_maintenance.html On Wednesday, May 9, 2018 at 2:19:57 AM UTC+12, Smooge wrote: > > On 8 May 2018 at 04:34, java_cat33 <ltd...@gmail.com > > wrote: > > Hi - I'm completely new to

[ansible-project] What is recommended version???

2018-05-08 Thread java_cat33
Hi - I'm completely new to Ansible (and not too familiar with Linux). What is the recommended Ansible version? If I download via apt-get or pip by default it is downloading the latest version (2.5.2) - isn't this a dev version? Is it recommended to specify and download 2.4? Thanks! -- You