Re: [ansible-project] Ansible seems not supporting fundemental user management commands in Arch Linux

2019-11-22 Thread Bilinmek Istemiyor
Thank you for the solution. Embrassing copy and paste error ... Do not know 
what to say...Thank you again for sparing time..



On Saturday, November 23, 2019 at 1:33:43 AM UTC+3, Jean-Yves LENHOF wrote:
>
> Hi,
>
> You did a mix between the user module and the group module parameters.
>
> Please read docs and samples :
>
> https://docs.ansible.com/ansible/latest/modules/group_module.html
>
> https://docs.ansible.com/ansible/latest/modules/user_module.html
>
>
> I think you should made a loop around group module to ensure all wanted 
> groups exist,
>
> and a second loop around user module to create users you want
>
> Regards,
>
> JYL
>
>
> Le 22/11/2019 à 23:23, Bilinmek Istemiyor a écrit :
>
> Thank you for the response.
>
> I have extracted some private information but the playbook is a follows...
>
> - hosts: nas
>   remote_user: root
>   tasks: 
>   - name: create users 
> group:
>   name: "{{ item.name }}"
>   comment: "{{ item.comment }}"
>   shell: "{{ item.shell }}"
>   home: "{{ item.home }}"
>   group: "{{ item.name }}"
>   groups: "{{ item.groups }}"
>   append: yes
> loop:
> - { name: 'user1', comment: 'User1 Information', shell: 
> '/user/bin/bash',home: '/pool/home/user1', groups: 
> 'group1,group2,group3,group4,group5,group6'}
> - { name: 'user2', comment: 'User2 Information', shell: 
> '/user/bin/nologin', home: '/pool/home/user2', groups: 
> 'group1,group2,group3,group4,group5,group6'}
> - { name: 'user3', comment: 'User3 Information', shell: 
> '/user/bin/nologin', home: '/pool/home/user3', groups: 
> 'group1,group2,group3,group4,group5,group6'}
>
>
>
>
> On Saturday, November 23, 2019 at 12:49:38 AM UTC+3, alicia wrote: 
>>
>> Can you add the playbook you’re running? The error message alone only 
>> gets us so far. 
>>
>> The error message is telling you that a task using the group module 
>> cannot include all the parameters you’re passing to it. Take a look at 
>> http://docs.testing.ansible.com/ansible/devel/modules/group_module.html for 
>> detailed documentation on how to use the group module and the parameters it 
>> accepts.
>>
>> Hope this helps,
>> Alicia
>>
>> On Nov 22, 2019, at 3:41 PM, Bilinmek Istemiyor  
>> wrote:
>>
>> Hello,
>>
>> I am building a nas server with manjaro architect (arch based 
>> distribution). I try to automate tasks with ansible. However ansible user 
>> management is giving me errors stating that ""msg": "Unsupported parameters 
>> for (group) module: append, comment, group, groups, home, shell Supported 
>> parameters include: gid, local, name, non_unique, state, system"} "
>>
>> However to the best of my knowledge command set is the same with debian, 
>> ubuntu etc.  The not supported parameters are crucial for account 
>> management since I use lots of custom groups and custom home folder paths 
>> along with shell option.
>>
>> I believe ansible detect the environment as follows
>>
>> "ansible_distribution": "Archlinux",
>> "ansible_distribution_file_path": "/etc/arch-release",
>> "ansible_distribution_file_variety": "Archlinux",
>> "ansible_distribution_major_version": "18",
>> "ansible_distribution_release": "Juhraya",
>> "ansible_distribution_version": "18.1.3",
>>
>> Any help much appreciated
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ansible...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/d3c57d1d-c116-4e18-a448-38ada9ec65e6%40googlegroups.com
>>  
>> 
>> .
>>
>>
>> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/cbbbdfe8-4a10-4f93-b9e2-5326d58c513e%40googlegroups.com
>  
> 
> .
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d9049091-1cfb-4fd3-bcfe-c251b836108c%40googlegroups.com.


Re: [ansible-project] Windows ports used

2019-11-22 Thread Jordan Borean
In regards to the ports you have stated

* 88 - I believe this is what the Kerberos TGS process uses, the traffic will 
be between the Ansible controller and the domain controller not the Windows 
host. 
* 389 - This is the standard LDAP port, LDAP can use Kerberos auth like WinRM 
but Ansible does not use this to talk to Windows hosts
* 445 - This is the standard SMB port, like LDAP and WinRM this is a separate 
protocol to Kerberos and not used by Ansible to talk to Windows host
* 3268 - I believe this is another LDAP port so same thing applies

You may be using other modules in Ansible that use some of the ports above but 
for the WinRM connection plugin it only requires port 5985/5986 if using the 
default configuration to talk to your Windows host.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ffb6fd9c-ed61-401d-9067-37a0c4b5c470%40googlegroups.com.


Re: [ansible-project] Windows ports used

2019-11-22 Thread Jordan Borean
You will still need Kerberos to talk to the domain controller in whatever 
fashion it uses but the traffic between the Ansible controller and the Windows 
host will only need the WinRM port.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a2f83d8e-9c18-46d5-9b98-0e8a6e7dd513%40googlegroups.com.


Re: [ansible-project] Windows ports used

2019-11-22 Thread Ramakrishnan M
Are you saying none of the standard kerberos ports 88,389,445, 3268 etc are
required for ansible to use kerberos as ansible_winrm_transport, if we
configure either 5985/5986 as default.

Thanks in advance

On Fri, Nov 22, 2019 at 6:06 PM Jordan Borean  wrote:

> No, port 5985 is the default port for http and 5986 is for https. The auth
> selection does not change this, and your Windows host could be configured
> with another port instead so you will have to check your configuration with
> ‘winrm e winrm/config/listener’.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/b0b4ec97-52c5-4138-997e-5b49930e09ea%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BNR4KLSO9U89uKLWgnDPYKzju3m_hHDH7BayhvPsYsDgKLF8g%40mail.gmail.com.


[ansible-project] Windows ports used

2019-11-22 Thread Jordan Borean
No, port 5985 is the default port for http and 5986 is for https. The auth 
selection does not change this, and your Windows host could be configured with 
another port instead so you will have to check your configuration with ‘winrm e 
winrm/config/listener’.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b0b4ec97-52c5-4138-997e-5b49930e09ea%40googlegroups.com.


[ansible-project] Windows ports used

2019-11-22 Thread Ramakrishnan M
hey,

Does the ansible port requirement for Windows change from 5985/5986 to 
corresponding ntml/kerberos depending on ansible_winrm_transport selection 
of ntlm/kerberos/credssp etc.

Thanks in advance


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e0c4431d-ca4d-496b-b858-ecd717b8d3b2%40googlegroups.com.


Re: [ansible-project] List of dicts => dict of lists

2019-11-22 Thread Srinivasa Jasti
Here is another way.  Although I like vladimir Botka's solution.

---

- hosts: localhost

  gather_facts: no



  vars:

instances:

  - id: 1234

type: web

  - id: 1456

type: web

  - id: 1678

type: web

  - id: 3456

type: proxy

  - id: 2567

type: proxy

  - id: 2566

type: db

  - id: 4900

type: db


  tasks:

  - name: Set Fact for proxy

set_fact:

  new_proxy: "{{ new_proxy|default([]) + [ { 'id': item.id } ] }}"

loop: "{{ instances }}"

when: item.type == 'proxy'


  - name: set Fact for db

set_fact:

  new_db: "{{ new_proxy|default([]) + [ {'id': item.id } ] }}"

loop: "{{ instances }}"

when: item.type == 'db'


  - name: set Fact for web

set_fact:

  new_web: "{{ new_proxy|default([]) + [ {'id': item.id } ] }}"

loop: "{{ instances }}"

when: item.type == 'web'


  - name: Print facts

debug:

  msg: "Web - {{ new_web }} - DB - {{ new_db }} - Proxy - {{ new_proxy
}}"



  - name: Final set fact

set_fact:

  new_instances: "{{ new_instances|default([]) + [ {'db': new_db},
{'web': new_web}, {'proxy': new_proxy} ] }}"


  - name: Print final fact

debug:

  var: new_instances

On Fri, Nov 22, 2019 at 1:12 PM Vladimir Botka  wrote:

> On Fri, 22 Nov 2019 18:43:31 +0100
> Dick Visser  wrote:
>
> > instances:
> >   - id: i-0fe48c061f6a323a0
> > type: web
> >   - id: i-0403e39813defda31
> > type: web
> >   - id: i-0442f13b528e5e1c6
> > type: proxy
> >   - id: i-0ebea75d008becaa6
> > type: proxy
> >   - id: i-067c5d985c194e036
> > type: db
> >   - id: i-0679e87f06d0cf9a2
> > type: db
> >
> > Which I'd like to turn into this structure:
> >
> > instances:
> >   web:
> > - id: i-0fe48c061f6a323a0
> > - id: i-0403e39813defda31
> >   proxy:
> > - id: i-0442f13b528e5e1c6
> > - id: i-0ebea75d008becaa6
> >   db:
> > - id: i-067c5d985c194e036
> > - id: i-0679e87f06d0cf9a2
>
> The task below does the job
>
> - set_fact:
> instances2: "{{ instances2|
> default({})|
> combine({item.0: item.1|
>  json_query('[].{id: id}')}) }}"
>   loop: "{{ instances|groupby('type') }}"
>
> Cheers,
>
> -vlado
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/20191122201219.5d637e3c%40gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAB2Y44aogCGKcO-iNxmj7wuBujKd13JHUY1bAW7Jf6MGFZndGw%40mail.gmail.com.


[ansible-project] ## Convert stdout_lines into json format ##

2019-11-22 Thread Jordan Borean
In your win_shell command add “| ConvertTo-Json” to the end. That will pipe the 
output into a json string which you can then use the from_json filter in 
Ansible to turn it into a dict.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3f3818c7-4621-4266-860a-d8ffb794e5da%40googlegroups.com.


Re: [ansible-project] Ansible seems not supporting fundemental user management commands in Arch Linux

2019-11-22 Thread Jean-Yves LENHOF

Hi,

You did a mix between the user module and the group module parameters.

Please read docs and samples :

https://docs.ansible.com/ansible/latest/modules/group_module.html

https://docs.ansible.com/ansible/latest/modules/user_module.html


I think you should made a loop around group module to ensure all wanted 
groups exist,


and a second loop around user module to create users you want

Regards,

JYL


Le 22/11/2019 à 23:23, Bilinmek Istemiyor a écrit :

Thank you for the response.

I have extracted some private information but the playbook is a follows...

- hosts: nas
  remote_user: root
  tasks:
  - name: create users
    group:
  name: "{{ item.name }}"
  comment: "{{ item.comment }}"
  shell: "{{ item.shell }}"
  home: "{{ item.home }}"
  group: "{{ item.name }}"
  groups: "{{ item.groups }}"
  append: yes
    loop:
    - { name: 'user1', comment: 'User1 Information', shell: 
'/user/bin/bash',    home: '/pool/home/user1', groups: 
'group1,group2,group3,group4,group5,group6'}
    - { name: 'user2', comment: 'User2 Information', shell: 
'/user/bin/nologin', home: '/pool/home/user2', groups: 
'group1,group2,group3,group4,group5,group6'}
    - { name: 'user3', comment: 'User3 Information', shell: 
'/user/bin/nologin', home: '/pool/home/user3', groups: 
'group1,group2,group3,group4,group5,group6'}





On Saturday, November 23, 2019 at 12:49:38 AM UTC+3, alicia wrote:

Can you add the playbook you’re running? The error message alone
only gets us so far.

The error message is telling you that a task using the group
module cannot include all the parameters you’re passing to it.
Take a look at
http://docs.testing.ansible.com/ansible/devel/modules/group_module.html
 
for
detailed documentation on how to use the group module and the
parameters it accepts.

Hope this helps,
Alicia


On Nov 22, 2019, at 3:41 PM, Bilinmek Istemiyor
> wrote:

Hello,

I am building a nas server with manjaro architect (arch based
distribution). I try to automate tasks with ansible. However
ansible user management is giving me errors stating that ""msg":
"Unsupported parameters for (group) module: append, comment,
group, groups, home, shell Supported parameters include: gid,
local, name, non_unique, state, system"} "

However to the best of my knowledge command set is the same with
debian, ubuntu etc.  The not supported parameters are crucial for
account management since I use lots of custom groups and custom
home folder paths along with shell option.

I believe ansible detect the environment as follows

    "ansible_distribution": "Archlinux",
    "ansible_distribution_file_path": "/etc/arch-release",
    "ansible_distribution_file_variety": "Archlinux",
    "ansible_distribution_major_version": "18",
    "ansible_distribution_release": "Juhraya",
    "ansible_distribution_version": "18.1.3",

Any help much appreciated



-- 
You received this message because you are subscribed to the

Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to ansible...@googlegroups.com .
To view this discussion on the web visit

https://groups.google.com/d/msgid/ansible-project/d3c57d1d-c116-4e18-a448-38ada9ec65e6%40googlegroups.com

.


--
You received this message because you are subscribed to the Google 
Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to ansible-project+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/cbbbdfe8-4a10-4f93-b9e2-5326d58c513e%40googlegroups.com 
.


--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c8a26db6-0d7c-c0a8-8639-7acb17ec3392%40lenhof.eu.org.


Re: [ansible-project] Ansible seems not supporting fundemental user management commands in Arch Linux

2019-11-22 Thread Bilinmek Istemiyor
Thank you for the response.

I have extracted some private information but the playbook is a follows...

- hosts: nas
  remote_user: root
  tasks: 
  - name: create users 
group:
  name: "{{ item.name }}"
  comment: "{{ item.comment }}"
  shell: "{{ item.shell }}"
  home: "{{ item.home }}"
  group: "{{ item.name }}"
  groups: "{{ item.groups }}"
  append: yes
loop:
- { name: 'user1', comment: 'User1 Information', shell: 
'/user/bin/bash',home: '/pool/home/user1', groups: 
'group1,group2,group3,group4,group5,group6'}
- { name: 'user2', comment: 'User2 Information', shell: 
'/user/bin/nologin', home: '/pool/home/user2', groups: 
'group1,group2,group3,group4,group5,group6'}
- { name: 'user3', comment: 'User3 Information', shell: 
'/user/bin/nologin', home: '/pool/home/user3', groups: 
'group1,group2,group3,group4,group5,group6'}




On Saturday, November 23, 2019 at 12:49:38 AM UTC+3, alicia wrote:
>
> Can you add the playbook you’re running? The error message alone only gets 
> us so far.
>
> The error message is telling you that a task using the group module cannot 
> include all the parameters you’re passing to it. Take a look at 
> http://docs.testing.ansible.com/ansible/devel/modules/group_module.html for 
> detailed documentation on how to use the group module and the parameters it 
> accepts.
>
> Hope this helps,
> Alicia
>
> On Nov 22, 2019, at 3:41 PM, Bilinmek Istemiyor  > wrote:
>
> Hello,
>
> I am building a nas server with manjaro architect (arch based 
> distribution). I try to automate tasks with ansible. However ansible user 
> management is giving me errors stating that ""msg": "Unsupported parameters 
> for (group) module: append, comment, group, groups, home, shell Supported 
> parameters include: gid, local, name, non_unique, state, system"} "
>
> However to the best of my knowledge command set is the same with debian, 
> ubuntu etc.  The not supported parameters are crucial for account 
> management since I use lots of custom groups and custom home folder paths 
> along with shell option.
>
> I believe ansible detect the environment as follows
>
> "ansible_distribution": "Archlinux",
> "ansible_distribution_file_path": "/etc/arch-release",
> "ansible_distribution_file_variety": "Archlinux",
> "ansible_distribution_major_version": "18",
> "ansible_distribution_release": "Juhraya",
> "ansible_distribution_version": "18.1.3",
>
> Any help much appreciated
>
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/d3c57d1d-c116-4e18-a448-38ada9ec65e6%40googlegroups.com
>  
> 
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/cbbbdfe8-4a10-4f93-b9e2-5326d58c513e%40googlegroups.com.


Re: [ansible-project] Ansible seems not supporting fundemental user management commands in Arch Linux

2019-11-22 Thread alicia
Can you add the playbook you’re running? The error message alone only gets us 
so far.

The error message is telling you that a task using the group module cannot 
include all the parameters you’re passing to it. Take a look at 
http://docs.testing.ansible.com/ansible/devel/modules/group_module.html 
 for 
detailed documentation on how to use the group module and the parameters it 
accepts.

Hope this helps,
Alicia

> On Nov 22, 2019, at 3:41 PM, Bilinmek Istemiyor  wrote:
> 
> Hello,
> 
> I am building a nas server with manjaro architect (arch based distribution). 
> I try to automate tasks with ansible. However ansible user management is 
> giving me errors stating that ""msg": "Unsupported parameters for (group) 
> module: append, comment, group, groups, home, shell Supported parameters 
> include: gid, local, name, non_unique, state, system"} "
> 
> However to the best of my knowledge command set is the same with debian, 
> ubuntu etc.  The not supported parameters are crucial for account management 
> since I use lots of custom groups and custom home folder paths along with 
> shell option.
> 
> I believe ansible detect the environment as follows
> 
> "ansible_distribution": "Archlinux",
> "ansible_distribution_file_path": "/etc/arch-release",
> "ansible_distribution_file_variety": "Archlinux",
> "ansible_distribution_major_version": "18",
> "ansible_distribution_release": "Juhraya",
> "ansible_distribution_version": "18.1.3",
> 
> Any help much appreciated
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/d3c57d1d-c116-4e18-a448-38ada9ec65e6%40googlegroups.com
>  
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/04123454-C020-4235-B9AD-5864218C92B8%40redhat.com.


[ansible-project] Ansible seems not supporting fundemental user management commands in Arch Linux

2019-11-22 Thread Bilinmek Istemiyor
Hello,

I am building a nas server with manjaro architect (arch based 
distribution). I try to automate tasks with ansible. However ansible user 
management is giving me errors stating that ""msg": "Unsupported parameters 
for (group) module: append, comment, group, groups, home, shell Supported 
parameters include: gid, local, name, non_unique, state, system"} "

However to the best of my knowledge command set is the same with debian, 
ubuntu etc.  The not supported parameters are crucial for account 
management since I use lots of custom groups and custom home folder paths 
along with shell option.

I believe ansible detect the environment as follows

"ansible_distribution": "Archlinux",
"ansible_distribution_file_path": "/etc/arch-release",
"ansible_distribution_file_variety": "Archlinux",
"ansible_distribution_major_version": "18",
"ansible_distribution_release": "Juhraya",
"ansible_distribution_version": "18.1.3",

Any help much appreciated


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d3c57d1d-c116-4e18-a448-38ada9ec65e6%40googlegroups.com.


Re: [ansible-project] List of dicts => dict of lists

2019-11-22 Thread Vladimir Botka
On Fri, 22 Nov 2019 18:43:31 +0100
Dick Visser  wrote:

> instances:
>   - id: i-0fe48c061f6a323a0
> type: web
>   - id: i-0403e39813defda31
> type: web
>   - id: i-0442f13b528e5e1c6
> type: proxy
>   - id: i-0ebea75d008becaa6
> type: proxy
>   - id: i-067c5d985c194e036
> type: db
>   - id: i-0679e87f06d0cf9a2
> type: db
> 
> Which I'd like to turn into this structure:
> 
> instances:
>   web:
> - id: i-0fe48c061f6a323a0
> - id: i-0403e39813defda31
>   proxy:
> - id: i-0442f13b528e5e1c6
> - id: i-0ebea75d008becaa6
>   db:
> - id: i-067c5d985c194e036
> - id: i-0679e87f06d0cf9a2

The task below does the job

- set_fact:
instances2: "{{ instances2|
default({})|
combine({item.0: item.1|
 json_query('[].{id: id}')}) }}"
  loop: "{{ instances|groupby('type') }}"

Cheers,

-vlado

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20191122201219.5d637e3c%40gmail.com.


pgplpewgiwX8e.pgp
Description: OpenPGP digital signature


Re: [ansible-project] List of dicts => dict of lists

2019-11-22 Thread Kai Stian Olstad

On 22.11.2019 18:43, Dick Visser wrote:

I'm struggling with something seemingly simple.
I have this list:

instances:
  - id: i-0fe48c061f6a323a0
type: web
  - id: i-0403e39813defda31
type: web
  - id: i-0442f13b528e5e1c6
type: proxy
  - id: i-0ebea75d008becaa6
type: proxy
  - id: i-067c5d985c194e036
type: db
  - id: i-0679e87f06d0cf9a2
type: db


Which I'd like to turn into this structure:


instances:
  web:
- id: i-0fe48c061f6a323a0
- id: i-0403e39813defda31
  proxy:
- id: i-0442f13b528e5e1c6
- id: i-0ebea75d008becaa6
  db:
- id: i-067c5d985c194e036
- id: i-0679e87f06d0cf9a2


But I can't figure out how to do this...


Are you sure you need the id in the list as it's redundant and without 
it is very simple with selectattr and map.


--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e598f5d71fa93ea102e3f0e7e5178a00%40olstad.com.


[ansible-project] List of dicts => dict of lists

2019-11-22 Thread Dick Visser
Hi

I'm struggling with something seemingly simple.
I have this list:

instances:
  - id: i-0fe48c061f6a323a0
type: web
  - id: i-0403e39813defda31
type: web
  - id: i-0442f13b528e5e1c6
type: proxy
  - id: i-0ebea75d008becaa6
type: proxy
  - id: i-067c5d985c194e036
type: db
  - id: i-0679e87f06d0cf9a2
type: db


Which I'd like to turn into this structure:


instances:
  web:
- id: i-0fe48c061f6a323a0
- id: i-0403e39813defda31
  proxy:
- id: i-0442f13b528e5e1c6
- id: i-0ebea75d008becaa6
  db:
- id: i-067c5d985c194e036
- id: i-0679e87f06d0cf9a2


But I can't figure out how to do this...





-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwMY8Txx-OVkie-yxvxPNLigO8R5-W8etNM37ySE00U-Hw%40mail.gmail.com.


Re: [ansible-project] Ansible Version Migration

2019-11-22 Thread alicia
Hi Devaraju,

It’s best to upgrade to a maintained version. We maintain 3 versions at all 
times - currently those versions are 2.9, 2.8, and 2.7 - see 
https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html
 
.
 

We do not fix bugs in unmaintained versions, so if security vulnerabilities 
exist in version 2.4 or 2.5, they will not be fixed.

Best wishes,
Alicia

> On Nov 21, 2019, at 8:11 AM, Jean-Yves LENHOF  wrote:
> 
> Le 2019-11-21 15:02, Vladimir Botka a écrit :
>> On Thu, 21 Nov 2019 05:01:31 -0800 (PST)
>> deva raju  wrote:
>>> Now, we would like to move to either ansible-2.4 or ansible-2.5 So, what is
>>> the way to migrate my code to latest version ? Or do i need write the
>>> complete code from scratch ?
>> The answers are in the Porting guides.
>> https://docs.ansible.com/ansible/latest/porting_guides/
>> Cheers,
>>  -vlado
> 
> 
> Usualy compatibility is quite good...
> When going from 1.9 to 2.1, I had quite some porting code to do
> From now, change between version is generally deprecated before being 
> obsoleted.
> 
> So expect some work for your very old scripts using version 1.5...
> 
> Regards,
> 
> 
> -- 
> --
> Jean-Yves LENHOF
> jean-y...@lenhof.eu.org
> Tel: 06 50 95 41 26
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/5929578ef56022131fd91074b4a5735e%40lenhof.eu.org.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/E9751976-FAD4-4957-934D-127CCBBF1914%40redhat.com.


[ansible-project] ## Convert stdout_lines into json format ##

2019-11-22 Thread Monohar Krushna Behera
Hi Team,
Greetings of the day!!!

Is there any *module *or *plugin *available through which we can convert 
the *stdout_lines *of a *win_shell *output into *json *data.
if it is available can you help me how to use it.

Below is my powershell command output coming in ansible result.

*"stdout_lines": [*
*"",*
*" Id ProcessName   CPU",*
*" -- ---   ---",*
*"564 lsass83.46875",*
*"876 svchost 82.484375",*
*"",*
*""*
*]*

Expecting output like below format:

 *"stdout_lines": *
*{*
*"Id":  **564**,*
*"ProcessName":  "**lsass**",*
*"CPU":  **83.46875*
*},*
*{*
*"Id":  **876**,*
*"ProcessName":  "**svchost**",*
*"CPU":  **82.484375*
*}*

so that I can fetch the id or process names like *stdout_lines.ProcessName*




-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/01b5d210-e717-4db2-a2c7-09dc919d3dfd%40googlegroups.com.