Re: [ansible-project] ERROR! 'retries' is not a valid attribute for a TaskInclude

2020-05-20 Thread Stefan Hornburg (Racke)
On 5/21/20 4:48 AM, Shifa Shaikh wrote:
> My requirement is to run the script stop-all as many times (5 retries) until 
> the output of ps -fu user1 |wc -l becomes
> less than 2.
> 
> I wrote the below ansible playbook for the same:
> 
> cat stop.yml
> 
> |
>   -hosts:dest_nodes
>     tasks:
>       -name:Startservice
>         include_tasks:"{{ playbook-dir }}/inner.yml"
>         retries:5
>         delay:4
>         until:stopprocesscount.stdout isversion('2','<')
> |
> 
> cat inner.yml
> 
> |
> -name:Startservice
>   shell:~/stop-all
>   register:stopprocess
> 
> 
> -name:Startservice
>   shell:ps -fu user1 |wc -l
>   register:stopprocesscount
> |
> 
> 
> However, I get the below error running the playbook.
> 
> |
> ERROR!'retries'isnota valid attribute fora TaskInclude
> 
> 
> Theerror appears to be in'/app/playbook/stop.yml':line 19,column 9,but may
> be elsewhere inthe file depending on the exact syntax problem.
> 
> 
> Theoffending line appears to be:
> 
> 
> -name:Startservice
>   ^here
> |
> 
> Can you please suggest?

The question is why you don't use one of the various mechanism on a Linux 
system to ensure
that a process is started or stopped.

Regards
  Racke

> 
> -- 
> 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/8a89923a-eebf-433a-92d7-4098c7af2b03%40googlegroups.com
> .


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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/dd2ea375-11ce-672c-7f78-c1809117bdbe%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


Re: [ansible-project] Getting the version of an Ansible Galaxy role

2020-05-20 Thread Brian Coca
nothing internal, you'll have to shell out to use `ansilbe-galaxy info
 --offline`




-- 
--
Brian Coca

-- 
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/CACVha7eyMWWfU7FEQxSv9GWq9FeL1yrKXqYM1wrZotw9oRMDJQ%40mail.gmail.com.


Re: [ansible-project] Re: Exit with_items loop after first success?

2020-05-20 Thread Brian Coca
It is something i would like to add as part of a full looping revamp
https://github.com/ansible/proposals/issues/140




-- 
--
Brian Coca

-- 
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/CACVha7cLDSK_q2o19UBW0nc6p%3D9RxMbpk0cbWU4NoOZnaXoOzQ%40mail.gmail.com.


Re: [ansible-project] how to use extends_documentation_fragment. getting error while using it

2020-05-20 Thread Brian Coca
you are missing `options:`  in your fragment, you are listing them
directly at top level which won't be understood.

```
class ModuleDocFragment(object):

DOCUMENTATION = r'''
options:
array_ip:
  description:
  - "The storage system IP address."
  required: True
array_password:
  description:
  - "The storage system password."
  required: True
array_username:
  description:
  - "The storage system user name."
  required: True
'''
```


-- 
--
Brian Coca

-- 
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/CACVha7eXKQHEWFewyi8E0RgVy9v7VZNw0q3d4eBkFapg9FRo5A%40mail.gmail.com.


Re: [ansible-project] How to access group variables of the same host in different groups?

2020-05-20 Thread Brian Coca
They don't exist outside inventory, all variables are either per host
or per play object, inventory always gets flattened to the host, so if
a host is part of 2 groups and both have the same variable, you will
only get 1 value

https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#group-variables
-- 
--
Brian Coca

-- 
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/CACVha7dJeyThrcaioi4SO785omnKU9hk%3DE905ziomZs7ho8m9w%40mail.gmail.com.


[ansible-project] ERROR! 'retries' is not a valid attribute for a TaskInclude

2020-05-20 Thread Shifa Shaikh
My requirement is to run the script stop-all as many times (5 retries) 
until the output of ps -fu user1 |wc -l becomes less than 2.

I wrote the below ansible playbook for the same:

cat stop.yml

  - hosts: dest_nodes
tasks:
  - name: Start service
include_tasks: "{{ playbook-dir }}/inner.yml"
retries: 5
delay: 4
until: stopprocesscount.stdout is version('2', '<')

cat inner.yml

- name: Start service
  shell: ~/stop-all
  register: stopprocess


- name: Start service
  shell: ps -fu user1 |wc -l
  register: stopprocesscount


However, I get the below error running the playbook.

ERROR! 'retries' is not a valid attribute for a TaskInclude


The error appears to be in '/app/playbook/stop.yml': line 19, column 9, but 
may
be elsewhere in the file depending on the exact syntax problem.


The offending line appears to be:


- name: Start service
  ^ here

Can you please suggest?

-- 
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/8a89923a-eebf-433a-92d7-4098c7af2b03%40googlegroups.com.


[ansible-project] Re: vmotion condition

2020-05-20 Thread Mani
Hi David,

Thank you for the info.

On Tuesday, 19 May 2020 18:38:54 UTC+5:30, David Foley wrote:
>
> Hi Mani,
>
>
> Your best bet would be to use PowerCLI, 
> https://communities.vmware.com/thread/539904?start=15&tstart=0
>

-- 
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/d9a4ac31-f343-49aa-9877-a486243ac108%40googlegroups.com.


Re: [ansible-project] CSV to JSON

2020-05-20 Thread Brian Coca
As already mentioned, Ansible is not the best tool for data conversion
... however, the csv lookup and a template with the to_json filter CAN
do the work .



-- 
--
Brian Coca

-- 
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/CACVha7d1WCmCwo4LETB2a_kg-QMkff0xJsWLF%3D02woscD3-M1w%40mail.gmail.com.


Re: [ansible-project] loop after loop conditional

2020-05-20 Thread Jerry Jerry
This almost works but I cant make it skip when the grep root
/etc/password fails.  I dont understand how to access out.rc when using a
loop.  My when statement doesnt work.  I am not as interested in this task
as I am pulling rc from a loop then using it in the next loop.

---
- hosts: all
  gather_facts: no
  become: yes
  vars:
check_users:
   - root
  - admin
  - oracle

  tasks:
  - name: check user exists
shell: grep {{ item }} /etc/passwd
failed_when: False
register: out
with_items: "{{ check_users }}"


  - name: check if existing user is in sudoers
command: grep {{ item }} /etc/sudoers
failed_when: False
#when: item.1.rc == 0
register: check_sudoers
with_items: "{{ check_users }}"

  - debug:
  var: check_sudoers

On Wed, May 20, 2020 at 6:02 PM Dick Visser  wrote:

>
>
> On Wed, 20 May 2020 at 21:58, Jerry Jerry  wrote:
>
>> My bigger question is how to run a loop with with_items then process the
>> output in the second play.
>>
>> The objective is to see if user1, user2, user3 exist locally make sure
>> they have sudo rights.
>>
>
> See
> https://docs.ansible.com/ansible/latest/modules/user_module.html
>
>
>
>
>> when my play tries to process out.results.item:
>>
>>  - name: check if existing user is in sudoers
>>command: grep {{ item }} /etc/sudoers
>>with_items: "{{ out.results.item }}"
>>register: message
>>
>> TASK [check if existing user is in sudoers]
>> 
>> fatal: [hostname]: FAILED! => {"msg": "'list object' has no attribute
>> 'item'"}
>> to retry, use: --limit @/opt/rhel-ansible/check_sudo_users.retry
>>
>> On Wednesday, May 20, 2020 at 3:49:30 PM UTC-4, Dick Visser wrote:
>>>
>>> You forgot the output.
>>> Also, what is your high level goal.
>>> Why do you need to know if a user exists and has sudo permission.
>>>
>>> On Wed, 20 May 2020 at 21:21, Jerry Jerry  wrote:
>>>
>> Trying to check if a user exists locally and if true, check to see if it
 has sudo rights.  I can't seem to process the second loop.  I tried using
 out.results.item but error:

 fatal: [hostname]: FAILED! => {"msg": "'list object' has no attribute
 'item'"}

 ---
 - hosts: all
   gather_facts: no
   become: yes
   tasks:
  - name: check user exists
command: grep {{ item }} /etc/passwd
failed_when: False
register: out
with_items:
  - user1
  - user2
  - user3

  - debug:
  var: out

  - name: check if existing user is in sudoers
command: grep {{ item }} /etc/sudoers
with_items: "{{ out.results }}"
register: message

  - debug:
  var: message

 --
 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/780471fd-cc97-4a8d-930e-147784254c80%40googlegroups.com
 
 .

>>> --
>>> Sent from a mobile device - please excuse the brevity, spelling and
>>> punctuation.
>>>
>> --
>> 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/71a7ca09-47be-4d03-92e4-8e741dc0bf94%40googlegroups.com
>> 
>> .
>>
> --
> Sent from a mobile device - please excuse the brevity, spelling and
> punctuation.
>
> --
> 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/CAL8fbwOQ0d7mGMGX_6KZYk-DGpKwCSoPS7%2BcMJ6cazKbzN1DxQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving e

Re: [ansible-project] CSV to JSON

2020-05-20 Thread Dominik Bessler
Take a Look at Miller.
https://github.com/johnkerl/miller


On Wed, May 20, 2020 at 15:06 Antony Stone <
antony.st...@ansible.open.source.it> wrote:

> On Wednesday 20 May 2020 at 20:07:50, shyam rpm wrote:
>
> > Hi,
> >
> > Is it possible to convert CSV file to JSON format using Ansible modules,
>
> Thsi really sounds like the wrong tool for the job, to me.
>
> > Or else do we need to use any scripting language to achieve this
> powershell
> > or python ?
>
> I've no idea about powershell (but I don't think it would be easy).
>
> Python could do it, perl could do it, and you might want to investigate
> telegraf.
>
>
> Regards,
>
> Antony.
>
> --
> Users don't know what they want until they see what they get.
>
>Please reply to the
> list;
>  please *don't* CC
> me.
>

-- 
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/CAKJ_SA-FVgVhCmUcu2R6GTxqEFO3D6wEtPySyG5wKOV5d_0mfg%40mail.gmail.com.


Re: [ansible-project] Provide select access to future objects

2020-05-20 Thread Dick Visser
On Wed, 20 May 2020 at 22:51, jitendra kumar singh <
jitendrakrsingh...@gmail.com> wrote:

> Hi,
> I am using ansible-playbook to create a dev user which should have only
> read access in PostgreSQL but after creating dev user, the user is able to
> perform DML commands within his user scope and also not able to read to
> future objects or tables means the dev user can't access the tables created
> from root user. How I can restrict dev user to create/insert/update/delete
> and other DML commands and allow to access future objects. This is what I
> am using:
>
>  - database: testDB
>grant_option: no
>objs: ALL_IN_SCHEMA
>state: present
>privs: select
>type: table
>role: read_only_role
>

What is this? A snippet from a playbook?
Because there is no task called 'database'.
Post your entire playbook.




> --
> 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/23d5d85e-f597-4a9e-9363-4d5d22fc49f4%40googlegroups.com
> .
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
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/CAL8fbwNWaupp2DQ08VaOrj-Z4rfaL7-L9q%3DV7qQUybbu_O%2BFig%40mail.gmail.com.


Re: [ansible-project] loop after loop conditional

2020-05-20 Thread Dick Visser
On Wed, 20 May 2020 at 21:58, Jerry Jerry  wrote:

> My bigger question is how to run a loop with with_items then process the
> output in the second play.
>
> The objective is to see if user1, user2, user3 exist locally make sure
> they have sudo rights.
>

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




> when my play tries to process out.results.item:
>
>  - name: check if existing user is in sudoers
>command: grep {{ item }} /etc/sudoers
>with_items: "{{ out.results.item }}"
>register: message
>
> TASK [check if existing user is in sudoers]
> 
> fatal: [hostname]: FAILED! => {"msg": "'list object' has no attribute
> 'item'"}
> to retry, use: --limit @/opt/rhel-ansible/check_sudo_users.retry
>
> On Wednesday, May 20, 2020 at 3:49:30 PM UTC-4, Dick Visser wrote:
>>
>> You forgot the output.
>> Also, what is your high level goal.
>> Why do you need to know if a user exists and has sudo permission.
>>
>> On Wed, 20 May 2020 at 21:21, Jerry Jerry  wrote:
>>
> Trying to check if a user exists locally and if true, check to see if it
>>> has sudo rights.  I can't seem to process the second loop.  I tried using
>>> out.results.item but error:
>>>
>>> fatal: [hostname]: FAILED! => {"msg": "'list object' has no attribute
>>> 'item'"}
>>>
>>> ---
>>> - hosts: all
>>>   gather_facts: no
>>>   become: yes
>>>   tasks:
>>>  - name: check user exists
>>>command: grep {{ item }} /etc/passwd
>>>failed_when: False
>>>register: out
>>>with_items:
>>>  - user1
>>>  - user2
>>>  - user3
>>>
>>>  - debug:
>>>  var: out
>>>
>>>  - name: check if existing user is in sudoers
>>>command: grep {{ item }} /etc/sudoers
>>>with_items: "{{ out.results }}"
>>>register: message
>>>
>>>  - debug:
>>>  var: message
>>>
>>> --
>>> 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/780471fd-cc97-4a8d-930e-147784254c80%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> Sent from a mobile device - please excuse the brevity, spelling and
>> punctuation.
>>
> --
> 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/71a7ca09-47be-4d03-92e4-8e741dc0bf94%40googlegroups.com
> 
> .
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
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/CAL8fbwOQ0d7mGMGX_6KZYk-DGpKwCSoPS7%2BcMJ6cazKbzN1DxQ%40mail.gmail.com.


Re: [ansible-project] Re: copy restricted files from server A to B

2020-05-20 Thread Laci
Thank you guys!
It worked, this is the playbook for anyone having the same issues. 
At the end I added a test to remove files from buffer

*serverA% ls -l*

*-rw---.  1 root   6 May 20 16:11 ezaz.txt*

- hosts: serverA
  gather_facts: no
  tasks:
  - name: fetch test file
fetch: src=/tmp/ezaz.txt dest=/tmp/buffer/ flat=yes fail_on_missing=yes

- hosts: serverB
  gather_facts: no
  tasks:
  - name: copy from dckr to dckr3
copy: src=/tmp/buffer/ezaz.txt dest=/tmp/final_ezaz.txt remote_src=no 
owner=root group=root mode=0400 backup=yes force=yes

- hosts: ansible
  gather_facts: no
  tasks:
   - name: Delete certificates from /tmp
 file: path=/tmp/buffer/ezaz.txt state=absent

*serverB% ls -l*
*-r. 1 root root  6 May 20 16:30 final_ezaz.txt*

On Tuesday, May 19, 2020 at 4:50:10 PM UTC-4, Jean-Yves LENHOF wrote:
>
> Use copy (to copy on the second server), fetch (to get the file on the 
> controller), and stat (to get rights) modules
>
> Regards,
>
> JYL
>
>
> Le 19/05/2020 à 22:38, Laci a écrit :
>
> Another detail is that serverA can't talk to serverB or vice versa, only 
> the Ansible server can talk to both of them
>
> On Tuesday, May 19, 2020 at 2:29:49 PM UTC-4, Laci wrote: 
>>
>> I have some files with 0400/-r permissions on server A that I 
>> need to copy to server B and preserve permissions. 
>>
>> For example:
>> serverA:/etc/ssl_cert.key -> serverB:/etc/ssl_cert.key
>>
>> How would you do it?
>>
> -- 
> 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/ef9d3a60-a5c2-4f13-97dc-0e4d41c8582a%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/e3ebb453-58dd-4d7d-8df9-486068f4473e%40googlegroups.com.


Re: [ansible-project] User authentication with LDAP

2020-05-20 Thread Michael Ströder
On 5/20/20 9:30 PM, Johnny Medlock wrote:
> I am writing to inquire some information in regards to User Permission
> management with LDAP authentication. I have searched around and have
> found conflicting answers.
> 
> I currently have an Ansible AWX 2.9.5 environment stood up on a CentOS 8
> VM and am wanting to integrate LDAP authentication with it. My question
> is, if a user logs in they get the mapped permissions in LDAP. But if
> those permissions are adjusted in LDAP, when the user logs out of AWX
> and logs back in, are their permissions updated upon log in to reflect
> the changes in LDAP?

Are you talking about POSIX groups retrieved from LDAP server? How fast
group membership is updated depends on the technical details how
NSS-LDAP integration is done.

But to me it seems there's no ansible-specific question here.

Ciao, Michael.

-- 
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/f5893caf-8461-50d9-ddc2-e7e8f88be24a%40stroeder.com.


[ansible-project] Provide select access to future objects

2020-05-20 Thread jitendra kumar singh
Hi,
I am using ansible-playbook to create a dev user which should have only read 
access in PostgreSQL but after creating dev user, the user is able to perform 
DML commands within his user scope and also not able to read to future objects 
or tables means the dev user can't access the tables created from root user. 
How I can restrict dev user to create/insert/update/delete and other DML 
commands and allow to access future objects. This is what I am using:

 - database: testDB
   grant_option: no
   objs: ALL_IN_SCHEMA
   state: present
   privs: select
   type: table
   role: read_only_role

-- 
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/23d5d85e-f597-4a9e-9363-4d5d22fc49f4%40googlegroups.com.


[ansible-project] Re: loop after loop conditional

2020-05-20 Thread Jerry Jerry
If I leave the playbook like this:

 - name: check if existing user is in sudoers
   command: grep {{ item }} /etc/sudoers
   with_items: "{{ out.results }}"
   register: message


it attempts to run a grep on all output from out.results.

On Wednesday, May 20, 2020 at 3:21:31 PM UTC-4, Jerry Jerry wrote:
>
> Trying to check if a user exists locally and if true, check to see if it 
> has sudo rights.  I can't seem to process the second loop.  I tried using 
> out.results.item but error:
>
> fatal: [hostname]: FAILED! => {"msg": "'list object' has no attribute 
> 'item'"}
>
> ---
> - hosts: all
>   gather_facts: no
>   become: yes
>   tasks:
>  - name: check user exists
>command: grep {{ item }} /etc/passwd
>failed_when: False
>register: out
>with_items:
>  - user1
>  - user2 
>  - user3
>
>  - debug:
>  var: out
>
>  - name: check if existing user is in sudoers
>command: grep {{ item }} /etc/sudoers
>with_items: "{{ out.results }}"
>register: message
>
>  - debug:
>  var: message
>

-- 
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/a538abc4-6474-4a79-ba79-55a37c2ad107%40googlegroups.com.


Re: [ansible-project] loop after loop conditional

2020-05-20 Thread Jerry Jerry
My bigger question is how to run a loop with with_items then process the 
output in the second play.

The objective is to see if user1, user2, user3 exist locally make sure they 
have sudo rights.

when my play tries to process out.results.item:

 - name: check if existing user is in sudoers
   command: grep {{ item }} /etc/sudoers
   with_items: "{{ out.results.item }}"
   register: message

TASK [check if existing user is in sudoers] 

fatal: [hostname]: FAILED! => {"msg": "'list object' has no attribute 
'item'"}
to retry, use: --limit @/opt/rhel-ansible/check_sudo_users.retry

On Wednesday, May 20, 2020 at 3:49:30 PM UTC-4, Dick Visser wrote:
>
> You forgot the output. 
> Also, what is your high level goal.
> Why do you need to know if a user exists and has sudo permission.
>
> On Wed, 20 May 2020 at 21:21, Jerry Jerry > 
> wrote:
>
>> Trying to check if a user exists locally and if true, check to see if it 
>> has sudo rights.  I can't seem to process the second loop.  I tried using 
>> out.results.item but error:
>>
>> fatal: [hostname]: FAILED! => {"msg": "'list object' has no attribute 
>> 'item'"}
>>
>> ---
>> - hosts: all
>>   gather_facts: no
>>   become: yes
>>   tasks:
>>  - name: check user exists
>>command: grep {{ item }} /etc/passwd
>>failed_when: False
>>register: out
>>with_items:
>>  - user1
>>  - user2 
>>  - user3
>>
>>  - debug:
>>  var: out
>>
>>  - name: check if existing user is in sudoers
>>command: grep {{ item }} /etc/sudoers
>>with_items: "{{ out.results }}"
>>register: message
>>
>>  - debug:
>>  var: message
>>
>> -- 
>> 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/780471fd-cc97-4a8d-930e-147784254c80%40googlegroups.com
>>  
>> 
>> .
>>
> -- 
> Sent from a mobile device - please excuse the brevity, spelling and 
> punctuation.
>

-- 
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/71a7ca09-47be-4d03-92e4-8e741dc0bf94%40googlegroups.com.


Re: [ansible-project] loop after loop conditional

2020-05-20 Thread Dick Visser
You forgot the output.
Also, what is your high level goal.
Why do you need to know if a user exists and has sudo permission.

On Wed, 20 May 2020 at 21:21, Jerry Jerry  wrote:

> Trying to check if a user exists locally and if true, check to see if it
> has sudo rights.  I can't seem to process the second loop.  I tried using
> out.results.item but error:
>
> fatal: [hostname]: FAILED! => {"msg": "'list object' has no attribute
> 'item'"}
>
> ---
> - hosts: all
>   gather_facts: no
>   become: yes
>   tasks:
>  - name: check user exists
>command: grep {{ item }} /etc/passwd
>failed_when: False
>register: out
>with_items:
>  - user1
>  - user2
>  - user3
>
>  - debug:
>  var: out
>
>  - name: check if existing user is in sudoers
>command: grep {{ item }} /etc/sudoers
>with_items: "{{ out.results }}"
>register: message
>
>  - debug:
>  var: message
>
> --
> 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/780471fd-cc97-4a8d-930e-147784254c80%40googlegroups.com
> 
> .
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
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/CAL8fbwO4zNJ9UHEcmGaDMDZfwdVZZb%3DLVWY9LfnZzCXE_coEKA%40mail.gmail.com.


[ansible-project] Re: SharePointDSC parameter PsDscRunAsCredential with Kerberos

2020-05-20 Thread Jordan Borean
Unfortunately no, the DSC engine requires explicit username and password 
and cannot be configured to run using an existing access token. It is 
probably needed because the DSC engine runs each task as the SYSTEM account 
so any network authentication will appear as it came from the AD computer 
account. By setting explicit PSDSCRunAsCredential you tell the engine to 
use those credentials instead.

-- 
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/bb05319f-37ce-456b-a7a4-9ad4528e77c5%40googlegroups.com.


[ansible-project] User authentication with LDAP

2020-05-20 Thread Johnny Medlock
 Hello,
I am writing to inquire some information in regards to User Permission 
management with LDAP authentication. I have searched around and have found 
conflicting answers.

I currently have an Ansible AWX 2.9.5 environment stood up on a CentOS 8 VM 
and am wanting to integrate LDAP authentication with it. My question is, if 
a user logs in they get the mapped permissions in LDAP. But if those 
permissions are adjusted in LDAP, when the user logs out of AWX and logs 
back in, are their permissions updated upon log in to reflect the changes 
in LDAP?

Thank you very much!

-- 
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/4b67d04f-334c-42f6-93bf-7b2ef774caff%40googlegroups.com.


[ansible-project] loop after loop conditional

2020-05-20 Thread Jerry Jerry
Trying to check if a user exists locally and if true, check to see if it 
has sudo rights.  I can't seem to process the second loop.  I tried using 
out.results.item but error:

fatal: [hostname]: FAILED! => {"msg": "'list object' has no attribute 
'item'"}

---
- hosts: all
  gather_facts: no
  become: yes
  tasks:
 - name: check user exists
   command: grep {{ item }} /etc/passwd
   failed_when: False
   register: out
   with_items:
 - user1
 - user2 
 - user3

 - debug:
 var: out

 - name: check if existing user is in sudoers
   command: grep {{ item }} /etc/sudoers
   with_items: "{{ out.results }}"
   register: message

 - debug:
 var: message

-- 
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/780471fd-cc97-4a8d-930e-147784254c80%40googlegroups.com.


Re: [ansible-project] CSV to JSON

2020-05-20 Thread Antony Stone
On Wednesday 20 May 2020 at 20:07:50, shyam rpm wrote:

> Hi,
> 
> Is it possible to convert CSV file to JSON format using Ansible modules,

Thsi really sounds like the wrong tool for the job, to me.

> Or else do we need to use any scripting language to achieve this powershell
> or python ?

I've no idea about powershell (but I don't think it would be easy).

Python could do it, perl could do it, and you might want to investigate 
telegraf.


Regards,

Antony.

-- 
Users don't know what they want until they see what they get.

   Please reply to the list;
 please *don't* CC me.


Re: [ansible-project] Is it possible to use jinja withing Ansible playbook yml file

2020-05-20 Thread Matt Martz
Not in that manner, you need to use a jinja within `service_offering`
instead:

service_offering: '{{ item.cs_instance|default(cs_template, true) }}'

That will use cs_template if cs_instance is undefined or falsy

On Wed, May 20, 2020 at 1:42 PM Aidan Wong  wrote:

> Hi
>
> Is it possible to write jinja "if" conditionals within a playbook like so?
> If not can someone suggest an alternative?
>
> - name: Deploy the VMs without an anti-affinity group.
>   cs_instance:
> zone: "{{ cs_zone }}"
> api_region: "{{ cs_api_region | upper }}"
> display_name: "{{ item.instance }}"
> name: "{{ item.instance | regex_replace('\\.','-') }}"
> project: "{{ cs_network }}"
> networks: [ "{{ cs_network }}" ]
> template: "{{ cs_template }}"
> {% if item.cs_instance is null %}
>service_offering: "{{ cs_template }}"
> {% else %}
>service_offering: "{{ item.cs_instance }}"
> {% endif %}
> state: "{{ cs_state }}
> poll_async: "yes"
> tags: "{{ final_tags }}"
> user_data: "{{ user_data  | string }}"
>   delegate_to: localhost
>   loop: "{{ myvmsfqdn }}"
>   when: cs_anti_affinity_group is not defined and cs_state == "started"
>
>
>
> Thanks
>
> --
> 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/567771c1-88fb-4f1c-b26e-5c2a3ee4eb78%40googlegroups.com
> 
> .
>


-- 
Matt Martz
@sivel
sivel.net

-- 
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/CAD8N0v-5vCMCJ%2BY8_%3DpBt1agXd3Q8MkKq2eNrYn8fnYC1Q%3DGnw%40mail.gmail.com.


[ansible-project] Is it possible to use jinja withing Ansible playbook yml file

2020-05-20 Thread Aidan Wong
Hi 

Is it possible to write jinja "if" conditionals within a playbook like so? 
If not can someone suggest an alternative?

- name: Deploy the VMs without an anti-affinity group.
  cs_instance:
zone: "{{ cs_zone }}"
api_region: "{{ cs_api_region | upper }}"
display_name: "{{ item.instance }}"
name: "{{ item.instance | regex_replace('\\.','-') }}"
project: "{{ cs_network }}"
networks: [ "{{ cs_network }}" ]
template: "{{ cs_template }}"
{% if item.cs_instance is null %}
   service_offering: "{{ cs_template }}"
{% else %}
   service_offering: "{{ item.cs_instance }}"
{% endif %}
state: "{{ cs_state }}
poll_async: "yes"
tags: "{{ final_tags }}"
user_data: "{{ user_data  | string }}"
  delegate_to: localhost
  loop: "{{ myvmsfqdn }}"
  when: cs_anti_affinity_group is not defined and cs_state == "started"



Thanks

-- 
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/567771c1-88fb-4f1c-b26e-5c2a3ee4eb78%40googlegroups.com.


Re: [ansible-project] Response' object has no attribute '__getitem__ while running the lookup plugin 'hashi_vault'

2020-05-20 Thread vinoth kumar
Have you installed pip hashi vault module . I think you have to install the
pip module for this connection. Check in hashi vault module page in
official ansible document . In first few line you can see the requirements.
Fix that it will work .

On Wed 20. May 2020 at 12:02, Asmitha j.s  wrote:

> I'm using hashi_vault to retrieve secrets from HashiCorp’s vault in
> ansible playbook.
>
>   - name: Return all secrets from a path
> set_fact:
>vault_result: "{{ lookup('hashi_vault', 'secret=secret/key:value
> token=token url=
> https://vaultaddress/ui/vault/secrets/secret/list/folder/subfolder/environment/')}
> }"
>
>
> tags:
>- vault
>
>
> command i'm using to run pl is ansible-playbook -v plybook.yml --tags
> vault
>
> I'm getting following error:
> fatal: [server_addr]: FAILED! => {
> "msg": "An unhandled exception occurred while running the lookup
> plugin 'hashi_vault'. Error was a , original
> message: 'Response' object has no attribute '__getitem__'"
> }
>
>
> My python version is Python 2.7.5
> My pip versin is pip 20.1
> My Ansible version is
>  ansible 2.9.3
>   config file = /etc/ansible/ansible.cfg
>   configured module search path = [u
> '/home/asmithas/.ansible/plugins/modules', u
> '/usr/share/ansible/plugins/modules']
>   ansible python module location = /usr/lib/python2.7/site-packages/
> ansible
>   executable location = /usr/bin/ansible
>   python version = 2.7.5 (default, Aug  7 2019, 00:51:29) [GCC 4.8.5
> 20150623 (Red Hat 4.8.5-39)]
>
>
> --
> 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/a0a2b672-80ad-4066-8be4-7218788d2611%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/CAJ%2BRxtRRGFU%2BPGLweRJyOzQej6z1PrGiReTdeDGiUW_LV485xA%40mail.gmail.com.


[ansible-project] CSV to JSON

2020-05-20 Thread shyam rpm
Hi,

Is it possible to convert CSV file to JSON format using Ansible modules, I 
have searched for the modules have't found. Or else do we need to use any 
scripting language to achieve this powershell or python ?





Thank you,
Shyam.

-- 
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/20debdcb-92be-4156-a907-2f5fb6846117%40googlegroups.com.


[ansible-project] Create list in playbook (Fortigate automation)

2020-05-20 Thread Luis Arizaga
Hi everybody,

I'm using Ansible to automate Fortigate Firewalls provisioning and I'm 
having the following problems.

   1. I have a playbook that first creates a couple of object addresses 
   using one module (task Configure one fortinet address)
   2. Then I want the playbook to pass a list with the name of the objects 
   just created to another module in order to group the addresses I've just 
   created. I tried to use Jinja2 within a playbook but I realized it doesn't 
   work (I'm a newbie don't judge me lol)
   3. I'm using the with_item loop but this does not work as the module 
   expects a list with all the objects included as one argument. With_items 
   command calls the module twice which does not work to group the objects :'(

Is there a way to do that with Jinja2 or by using some other strategy? Any 
help or orientation would help me.

Thanks for you time, playbook is below =)

---
- name: Configure Address objects FORTINET
  hosts: localhost
  vars:
host: "192.168.122.25"
username: "admin"
password: "admin"
vdom: "root"
partner: "PARTNER_1"
addresses:
  - comment: "Administration IP for CPE 1"
subnet: "10.10.10.10/32"
name: "H-{{ partner }}_Cpe.Lo1-1"
  - comment: "Administration IP for CPE 2"
subnet: "20.20.20.20/32"
name: "H-{{ partner }}_Cpe.Lo1-2"
  tasks:
- name: Configure one partner address
  fortios_firewall_address:
host: "{{ host }}"
username: "{{ username }}"
password: "{{ password }}"
vdom: "{{ vdom }}"
https: "False"
state: "present"
firewall_address:
  comment: "{{ item.comment }}"
  subnet: "{{ item.subnet }}"
  name: "{{ item.name }}"
  type: "ipmask"
  with_items: "{{ addresses }}"

- name: Configure address group for the partner
  fortios_firewall_addrgrp:
host: "{{ host }}"
username: "{{ username }}"
password: "{{ password }}"
vdom: "{{ vdom }}"
https: "False"
state: "present"
firewall_addrgrp:
  name: "G-{{ partner }}_Cpe.Lo"
  member:
- name: "{{ item.name }}"
  comment: "IP Groupe of partner {{ partner }}"
  visibility: "enable"
  with_items: "{{ addresses }}"
  register: print_output

-  debug: var=print_output


-- 
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/db664138-be79-4307-a2d5-78564320e93e%40googlegroups.com.


Re: [ansible-project] Passing data from ansible to service now table

2020-05-20 Thread Stefan Hornburg (Racke)
On 5/20/20 3:52 PM, Diyawary wrote:
> Please find the complete tasks out put-
> {
>     "status": -1,
>     "_ansible_no_log": false,
>     "url": 
> "https://test.service-now.com/api/eplc/table_update_integration/create";,
>     "changed": false,
>     "elapsed": 10,
>     "content": "",
>     "invocation": {
>         "module_args": {
>             "directory_mode": null,
>             "force": false,
>             "remote_src": null,
>             "status_code": [
>                 "200"
>             ],
>             "follow": false,
>             "owner": null,
>             "body_format": "json",
>             "client_key": null,
>             "group": null,
>             "use_proxy": true,
>             "unix_socket": null,
>             "unsafe_writes": null,
>             "serole": null,
>             "content": null,
>             "setype": null,
>             "follow_redirects": "safe",
>             "return_content": false,
>             "method": "POST",
>             "body": {
>                 "Region": "NA - Prod",
>                 "List": [
>                    data
>             },
>             "url_username": "",
>             "src": null,
>             "dest": null,
>             "selevel": null,
>             "force_basic_auth": true,
>             "removes": null,
>             "http_agent": "ansible-httpget",
>             "user": "",
>             "regexp": null,
>             "password": "***",
>             "url_password": "***",
>             "url": 
> "https://test.service-now.com/api/eplc/table_update_integration/create";,
>             "backup": null,
>             "seuser": null,
>             "client_cert": null,
>             "creates": null,
>             "headers": {
>                 "Content-Type": "application/json"
>             },
>             "delimiter": null,
>             "mode": null,
>             "timeout": 100,
>             "attributes": null,
>             "validate_certs": true
>         }
>     },
>     "redirected": false,
>     "msg": "Status code was -1 and not [200]: 'The read operation timed out'"
> }
> 

I would increase the timeout to a ridiculous value like 20 minutes and test if 
it:

* succeeds
* stops before the timeout exceeded
* stops after the timeout exceeded

Regards
 Racke

> On Wednesday, 20 May 2020 08:43:46 UTC-5, Diyawary wrote:
> 
> Hi Racke,
> 
> I have already increase the timeout but  still getting the same error.
> "Status code was -1 and not [200]: 'The read operation timed out'"
> 
> On Wednesday, 20 May 2020 07:35:52 UTC-5, Stefan Hornburg (Racke) wrote:
> 
> On 5/20/20 9:57 AM, Diyawary wrote:
> > Hi Team,
> >
> > I am sending data from ansible to service now using uri, data is 
> passing to snow table but job status is not
> showing
> > successful.
> > I am getting "The read operation timed out" error ,Please suggest 
> me how this can be resolved
> > - name: Passing Data to Snow
> >       uri:
> >         url: 
> "https://test.service-now.com/api/eplc/table_update_integration/create
> 
> "
> >         method: POST
> >         Headers: "application/json"
> >         body: '{"List":{{EPG_all}}, "Region":"NA " }'
> >         body_format: json
> >         user: "{{ snow_username }}"
> >         password: "{{ snow_password }}"
> >         force_basic_auth: yes
> >         status_code: 200
> >         timeout: 10
> >
> 
> It certainly doesn't help that you reduce the timeout to 10 seconds. 
> Also please post complete error message
> (without
> the credentials).
> 
> Regards
>         Racke
> 
> > --
> > 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/eca3e85e-fbd2-4375-8a80-0649e4aa7103%40googlegroups.com
> 
> 
> >
> 
>  
> >.
> 
> 
> 
> -- 
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
> 
> -- 
> You received this messag

Re: [ansible-project] Passing data from ansible to service now table

2020-05-20 Thread Diyawary
Please find the complete tasks out put-
{
"status": -1,
"_ansible_no_log": false,
"url": 
"https://test.service-now.com/api/eplc/table_update_integration/create";,
"changed": false,
"elapsed": 10,
"content": "",
"invocation": {
"module_args": {
"directory_mode": null,
"force": false,
"remote_src": null,
"status_code": [
"200"
],
"follow": false,
"owner": null,
"body_format": "json",
"client_key": null,
"group": null,
"use_proxy": true,
"unix_socket": null,
"unsafe_writes": null,
"serole": null,
"content": null,
"setype": null,
"follow_redirects": "safe",
"return_content": false,
"method": "POST",
"body": {
"Region": "NA - Prod",
"List": [
   data
},
"url_username": "",
"src": null,
"dest": null,
"selevel": null,
"force_basic_auth": true,
"removes": null,
"http_agent": "ansible-httpget",
"user": "",
"regexp": null,
"password": "***",
"url_password": "***",
"url": 
"https://test.service-now.com/api/eplc/table_update_integration/create";,
"backup": null,
"seuser": null,
"client_cert": null,
"creates": null,
"headers": {
"Content-Type": "application/json"
},
"delimiter": null,
"mode": null,
"timeout": 100,
"attributes": null,
"validate_certs": true
}
},
"redirected": false,
"msg": "Status code was -1 and not [200]: 'The read operation timed 
out'"
}

On Wednesday, 20 May 2020 08:43:46 UTC-5, Diyawary wrote:
>
> Hi Racke,
>
> I have already increase the timeout but  still getting the same error.
> "Status code was -1 and not [200]: 'The read operation timed out'"
>
> On Wednesday, 20 May 2020 07:35:52 UTC-5, Stefan Hornburg (Racke) wrote:
>>
>> On 5/20/20 9:57 AM, Diyawary wrote: 
>> > Hi Team, 
>> > 
>> > I am sending data from ansible to service now using uri, data is 
>> passing to snow table but job status is not showing 
>> > successful. 
>> > I am getting "The read operation timed out" error ,Please suggest me 
>> how this can be resolved 
>> > - name: Passing Data to Snow 
>> >   uri: 
>> > url: "
>> https://test.service-now.com/api/eplc/table_update_integration/create"; 
>> > method: POST 
>> > Headers: "application/json" 
>> > body: '{"List":{{EPG_all}}, "Region":"NA " }' 
>> > body_format: json 
>> > user: "{{ snow_username }}" 
>> > password: "{{ snow_password }}" 
>> > force_basic_auth: yes 
>> > status_code: 200 
>> > timeout: 10 
>> > 
>>
>> It certainly doesn't help that you reduce the timeout to 10 seconds. Also 
>> please post complete error message (without 
>> the credentials). 
>>
>> Regards 
>> Racke 
>>
>> > -- 
>> > 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 > ansible-project+unsubscr...@googlegroups.com>. 
>> > To view this discussion on the web visit 
>> > 
>> https://groups.google.com/d/msgid/ansible-project/eca3e85e-fbd2-4375-8a80-0649e4aa7103%40googlegroups.com
>>  
>> > <
>> https://groups.google.com/d/msgid/ansible-project/eca3e85e-fbd2-4375-8a80-0649e4aa7103%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>  
>>
>>
>>
>> -- 
>> Ecommerce and Linux consulting + Perl and web application programming. 
>> Debian and Sympa administration. Provisioning with Ansible. 
>>
>>

-- 
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/4944655c-f631-419e-a778-7980e4e3020e%40googlegroups.com.


[ansible-project] Re: Passing data from ansible to service now table

2020-05-20 Thread Diyawary


On Wednesday, 20 May 2020 02:57:43 UTC-5, Diyawary wrote:
>
> Hi Team,
>
> I am sending data from ansible to service now using uri, data is passing 
> to snow table but job status is not showing successful.
> I am getting "The read operation timed out" error ,Please suggest me how 
> this can be resolved
> - name: Passing Data to Snow
>   uri:
> url: "
> https://test.service-now.com/api/eplc/table_update_integration/create";
> method: POST
> Headers: "application/json"
> body: '{"List":{{EPG_all}}, "Region":"NA " }'
> body_format: json
> user: "{{ snow_username }}"
> password: "{{ snow_password }}"
> force_basic_auth: yes
> status_code: 200
> timeout: 10
>

-- 
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/5013984f-432b-4eae-b42a-063fc9790fd6%40googlegroups.com.


Re: [ansible-project] Passing data from ansible to service now table

2020-05-20 Thread Diyawary
Hi Racke,

I have already increase the timeout but  still getting the same error.
"Status code was -1 and not [200]: 'The read operation timed out'"

On Wednesday, 20 May 2020 07:35:52 UTC-5, Stefan Hornburg (Racke) wrote:
>
> On 5/20/20 9:57 AM, Diyawary wrote: 
> > Hi Team, 
> > 
> > I am sending data from ansible to service now using uri, data is passing 
> to snow table but job status is not showing 
> > successful. 
> > I am getting "The read operation timed out" error ,Please suggest me how 
> this can be resolved 
> > - name: Passing Data to Snow 
> >   uri: 
> > url: "
> https://test.service-now.com/api/eplc/table_update_integration/create"; 
> > method: POST 
> > Headers: "application/json" 
> > body: '{"List":{{EPG_all}}, "Region":"NA " }' 
> > body_format: json 
> > user: "{{ snow_username }}" 
> > password: "{{ snow_password }}" 
> > force_basic_auth: yes 
> > status_code: 200 
> > timeout: 10 
> > 
>
> It certainly doesn't help that you reduce the timeout to 10 seconds. Also 
> please post complete error message (without 
> the credentials). 
>
> Regards 
> Racke 
>
> > -- 
> > 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   ansible-project+unsubscr...@googlegroups.com >. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/ansible-project/eca3e85e-fbd2-4375-8a80-0649e4aa7103%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/ansible-project/eca3e85e-fbd2-4375-8a80-0649e4aa7103%40googlegroups.com?utm_medium=email&utm_source=footer>.
>  
>
>
>
> -- 
> Ecommerce and Linux consulting + Perl and web application programming. 
> Debian and Sympa administration. Provisioning with Ansible. 
>
>

-- 
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/aff8cde3-cbd2-4cfb-b838-28fc713fda58%40googlegroups.com.


Re: [ansible-project] Passing data from ansible to service now table

2020-05-20 Thread Stefan Hornburg (Racke)
On 5/20/20 9:57 AM, Diyawary wrote:
> Hi Team,
> 
> I am sending data from ansible to service now using uri, data is passing to 
> snow table but job status is not showing
> successful.
> I am getting "The read operation timed out" error ,Please suggest me how this 
> can be resolved
> - name: Passing Data to Snow
>       uri:
>         url: 
> "https://test.service-now.com/api/eplc/table_update_integration/create";
>         method: POST
>         Headers: "application/json"
>         body: '{"List":{{EPG_all}}, "Region":"NA " }'
>         body_format: json
>         user: "{{ snow_username }}"
>         password: "{{ snow_password }}"
>         force_basic_auth: yes
>         status_code: 200
>         timeout: 10
> 

It certainly doesn't help that you reduce the timeout to 10 seconds. Also 
please post complete error message (without
the credentials).

Regards
Racke

> -- 
> 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/eca3e85e-fbd2-4375-8a80-0649e4aa7103%40googlegroups.com
> .


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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/0703406e-5f8f-8ab2-8dd9-37e0cc0635e1%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


[ansible-project] OpenBSD network_cli

2020-05-20 Thread John D
I've installed the ansible pkg via pkg_add. I cannot get the ansible 
network_cli module to work in OpenBSD. Tried in version 6.6 and also 6.7 
and both hang at "using connection plugin network_cli". It never times out, 
hangs here forever.

I copied my ansible configuration files over to a fedora OS and the 
ansible-playbook works successfully. Has anyone used OpenBSD as an ansible 
control node to manage network devices via SSH? Below is the output I 
receive, and below that my test.yml file. If I purposely type my 
username/password wrong, and it still hangs here. In a tcpdump I see it 
connect to the router via SSH, but it just hangs.


openbsd#  ansible-playbook - -u username -k -e ansible_network_os=ios 
test.yml

ansible-playbook 2.8.5
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', 
'/usr/share/ansible/plugins/modules']
  ansible python module location = 
/usr/local/lib/python3.7/site-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.7.4 (default, Oct 11 2019, 11:15:58) [Clang 8.0.1 
(tags/RELEASE_801/final)]
Using /etc/ansible/ansible.cfg as config file
SSH password: 
setting up inventory plugins
host_list declined parsing /etc/ansible/hosts as it did not pass it's 
verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass it's 
verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's 
verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from 
/usr/local/lib/python3.7/site-packages/ansible/plugins/callback/default.py

PLAYBOOK: test.yml 
*
Positional arguments: test.yml
verbosity: 4
ask_pass: True
remote_user: username
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/etc/ansible/hosts',)
extra_vars: ('ansible_network_os=ios',)
forks: 5
1 plays in test.yml

PLAY [ROUTER] 
**
META: ran handlers

TASK [ios_config] 
**
task path: /etc/ansible/test.yml:6
<192.168.255.1> attempting to start connection
<192.168.255.1> using connection plugin network_cli


This is my test.yml file, pretty simple:

---


- hosts: 192.168.255.1

  connection: network_cli

  gather_facts: false

  tasks:

- ios_config:

  lines:

- hostname iwasupdated

-- 
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/4df7ad56-735c-452f-8d25-0e79b8d481a8%40googlegroups.com.


Re: [ansible-project] Re: how to run an if/else test in a task

2020-05-20 Thread Stefan Hornburg (Racke)
On 5/20/20 12:23 PM, Jerome Meyer wrote:
> Thanks for your reply and tips.
> So, has requested I've checked out the stdout message:
> 
> I've received only message when the domain already joined, like:
> 
> |
> ok:[localhost]=>{
>     "ad_join_status.stdout_lines":[
>         "   3 server_name@domain",
>         "   3 server_name@domain",
>         "   3 server_name@domain",
>         "   3 host/server_name@domain",
>         "   3 host/server_name@domain",
> [...]
> |
> 
> Otherwise, the klist cannot start because it doesn't found the file : 
> /etc/krb5.keytab :
> |
> # /usr/bin/klist -k|grep -i server_name
> klist:Keytable file '/etc/krb5.keytab'notfound whilestarting keytab
> |
> 
> And in this case nothing appears in stdout:
> |
> ok:[localhost]=>
>  
>     ad_join_status.stdout:''
> |
> 
> 
> That's means, I should use an another test for checking domain joining... :(

Right, so far this isn't really Ansible related. Determine a command which 
reliably tells you
whether the domain is already joined *before* you are trying to automate it.

Regards
  Racke

> 
> 
> On Tuesday, May 19, 2020 at 4:23:27 PM UTC+2, Jerome Meyer wrote:
> 
> Hi Teams,
> 
> I'm looking for to do a test before to execute a task. I need to checkup 
> if my computer has already joined the domain
> before to join it. otherwise, the adcli will failed.
> When computer isn't in domain, the klist will return a "not found" 
> message and at this time the "join active
> directory" must be running...
> Something goes wrong because this task will not be runned.
> Here're the portion of task:
> 
> |
> [...]
> -name:checking ifdomain already joined
>    shell:/bin/bash -c "/usr/bin/klist -k|grep -i {{ ansible_hostname }}"
>    register:ad_join_status
>    ignore_errors:true
> 
>  -name:join active directory
>    shell:/bin/bash -c "/usr/sbin/realm join --one-time-password={{ 
> ad_server_onetime }} {{ ad_server_domain }}"
>    register:ad_active
>    args:
>      executable:/usr/bin/bash
>    when:ad_join_status =="not found"
> [...]
> |
> 
> 
> Do you have any Idea?
> Is my test ok or should be another one?
> Thanks and best regards, J.
> 
> -- 
> 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/2b03d0ae-482f-46e8-a7e7-afb7286f1adc%40googlegroups.com
> .


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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/e93b20a3-392f-2839-adf1-a7ab3154a39d%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


[ansible-project] Re: how to run an if/else test in a task

2020-05-20 Thread Jerome Meyer
Thanks for your reply and tips.
So, has requested I've checked out the stdout message:

I've received only message when the domain already joined, like:

ok: [localhost] => {
"ad_join_status.stdout_lines": [
"   3 server_name@domain",
"   3 server_name@domain",
"   3 server_name@domain",
"   3 host/server_name@domain",
"   3 host/server_name@domain",
[...]

Otherwise, the klist cannot start because it doesn't found the file : 
/etc/krb5.keytab :
# /usr/bin/klist -k|grep -i server_name
klist: Key table file '/etc/krb5.keytab' not found while starting keytab 

And in this case nothing appears in stdout:
ok: [localhost] => 
 
ad_join_status.stdout: ''


That's means, I should use an another test for checking domain joining... :(


On Tuesday, May 19, 2020 at 4:23:27 PM UTC+2, Jerome Meyer wrote:
>
> Hi Teams,
>
> I'm looking for to do a test before to execute a task. I need to checkup 
> if my computer has already joined the domain 
> before to join it. otherwise, the adcli will failed.
> When computer isn't in domain, the klist will return a "not found" message 
> and at this time the "join active directory" must be running...
> Something goes wrong because this task will not be runned.
> Here're the portion of task:
>
> [...]
> - name: checking if domain already joined
>shell: /bin/bash -c "/usr/bin/klist -k|grep -i {{ ansible_hostname }}"
>register: ad_join_status
>ignore_errors: true
>
>  - name: join active directory
>shell: /bin/bash -c "/usr/sbin/realm join --one-time-password={{ 
> ad_server_onetime }} {{ ad_server_domain }}"
>register: ad_active
>args:
>  executable: /usr/bin/bash
>when: ad_join_status == "not found"
> [...]
>
>
> Do you have any Idea?
> Is my test ok or should be another one?
> Thanks and best regards, J.
>

-- 
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/2b03d0ae-482f-46e8-a7e7-afb7286f1adc%40googlegroups.com.


[ansible-project] Response' object has no attribute '__getitem__ while running the lookup plugin 'hashi_vault'

2020-05-20 Thread Asmitha j.s
I'm using hashi_vault to retrieve secrets from HashiCorp’s vault in ansible 
playbook.

  - name: Return all secrets from a path
set_fact:
   vault_result: "{{ lookup('hashi_vault', 'secret=secret/key:value 
token=token 
url=https://vaultaddress/ui/vault/secrets/secret/list/folder/subfolder/environment/')}}"


tags:
   - vault

 
command i'm using to run pl is ansible-playbook -v plybook.yml --tags vault 

I'm getting following error:
fatal: [server_addr]: FAILED! => {
"msg": "An unhandled exception occurred while running the lookup plugin 
'hashi_vault'. Error was a , original message: 
'Response' object has no attribute '__getitem__'"
}


My python version is Python 2.7.5
My pip versin is pip 20.1 
My Ansible version is 
 ansible 2.9.3
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u
'/home/asmithas/.ansible/plugins/modules', u
'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Aug  7 2019, 00:51:29) [GCC 4.8.5 
20150623 (Red Hat 4.8.5-39)]


-- 
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/a0a2b672-80ad-4066-8be4-7218788d2611%40googlegroups.com.


[ansible-project] SharePointDSC parameter PsDscRunAsCredential with Kerberos

2020-05-20 Thread jn bedag
Hi

According to the documentation, for SharePointDCS modules to work, we have 
to specify PsDscRunAsCredentials in win_dcs module:
- name: set shell admin for farmaccount
  win_dsc:
resource_name: SPShellAdmins
IsSingleInstance: "Yes"
MembersToInclude: "farmadmin_user"
AllDatabases: true
PsDscRunAsCredential_username: '{{ ansible_user }}'
PsDscRunAsCredential_password: '{{ ansible_password }}'


But we're running ansible with a kerberos configuration with our personal 
serveradmin user:
ansible_user="@domain.local"
ansible_connection=winrm
ansible_winrm_transport=kerberos
ansible_winrm_kerberos_delegation=true

Therefore ansible_password does not work.


And we can't specify a seperate user, because this user would have to be 
member of the SPShellAdmins, which is not possible because we can't specify 
a seperate user ;-)
Omitting these parameters does not work either.
So we must be able to run the module with the personal serveradmin account, 
only this account is member of the SPShellAdmins at this moment.

Is there a way to tell PsDscRunAsCredentials somehow to take the kerberos 
credentials?
Or is there another approach for this?

Thank you very much

-- 
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/f3b61acf-adb6-4884-9d58-f00b9826d35a%40googlegroups.com.


Re: [ansible-project] How to check process running time

2020-05-20 Thread Vladimir Botka
On Wed, 20 May 2020 00:29:19 -0700 (PDT)
Jenisha T  wrote:

> I need to kill a process if its older than 1 hour.  I have process id how 
> to check if its older than 1 hour

There is no such Ansible module. It'll be necessary to use 'command'. For
example, in Linux or *BSD, get elapsed time of the process in seconds

- command: 'ps -o etimes -p {{ my_pid }}'
  register: result
- debug:
var: result.stdout_lines

and kill the process if it's older than 1 hour

- command: 'kill {{ my_pid }}'
  when: result.stdout_lines.1|int > 3600

HTH,

-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/20200520102612.55dee4ca%40gmail.com.


pgpKn_CIk1Jzm.pgp
Description: OpenPGP digital signature


[ansible-project] Passing data from ansible to service now table

2020-05-20 Thread Diyawary
Hi Team,

I am sending data from ansible to service now using uri, data is passing to 
snow table but job status is not showing successful.
I am getting "The read operation timed out" error ,Please suggest me how 
this can be resolved
- name: Passing Data to Snow
  uri:
url: 
"https://test.service-now.com/api/eplc/table_update_integration/create";
method: POST
Headers: "application/json"
body: '{"List":{{EPG_all}}, "Region":"NA " }'
body_format: json
user: "{{ snow_username }}"
password: "{{ snow_password }}"
force_basic_auth: yes
status_code: 200
timeout: 10

-- 
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/eca3e85e-fbd2-4375-8a80-0649e4aa7103%40googlegroups.com.


Re: [ansible-project] How to check process running time

2020-05-20 Thread Dick Visser
Hi

How is this related to ansible?


On Wed, 20 May 2020 at 09:29, Jenisha T  wrote:

> I need to kill a process if its older than 1 hour.  I have process id how
> to check if its older than 1 hour
>
> --
> 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/6042ef03-2a2c-48ab-b338-55aac3c9bc46%40googlegroups.com
> 
> .
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
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/CAL8fbwNC1Yv5uxaq%3Dkutw1XA6JLOGeGc7FU7h-18r0O%3DYUAUpA%40mail.gmail.com.


[ansible-project] How to check process running time

2020-05-20 Thread Jenisha T
I need to kill a process if its older than 1 hour.  I have process id how 
to check if its older than 1 hour

-- 
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/6042ef03-2a2c-48ab-b338-55aac3c9bc46%40googlegroups.com.


[ansible-project] How to access group variables of the same host in different groups?

2020-05-20 Thread Durai Arasan


This is my ansible inventory file:

[slurm_master]
slurm-gpu-0 ansible_host=192.168.0.24 ansible_connection=local

[slurm_compute]
slurm-gpu-1 ansible_host=192.168.0.200 cpus=16 gpus=2
slurm-gpu-2 ansible_host=192.168.0.124 cpus=1 gpus=0


[slurm_partition_gpu]   

slurm-gpu-1

[slurm_partition_gpu:vars]
allow_accounts=['whitelist','gpu_users']
default_partition=no

[slurm_partition_debug]
slurm-gpu-1
slurm-gpu-2

[slurm_partition_debug:vars]
allow_accounts=['whitelist']
default_partition='yes'

[allnodes:children]
slurm_master
slurm_compute

[allnodes:vars]
slurm_partitions=['slurm_partition_gpu','slurm_partition_debug']

I have 2 partitions - "slurm_partition_gpu" and "slurm_partition_debug". 
All partitions have the properties *"allow_accounts"* and 
*"default_partition"*. So obviously these variables have the same name 
across partitions. Also a host is common to both partitions (groups). When 
I try to access these using variables using hostvars the variable evaluates 
(incorrectly) to the first occurrence in the host file. For example, inside 
jinja2 templating:

{{ hostvars[groups['slurm_partition_debug'][0]].allow_accounts }}

results in:

['whitelist','gpu_users']

instead of expected:

['whitelist']

This is obviously because it is looking for "slurm-gpu-1.allow_accounts" 
and because slurm-gpu-1 is present in both partitions (groups) it is going 
for the first occurrence instead of discriminating between partitions.


How do I get ansible to recognize that the variable is in a *different 
group* even though it is associated with the *same host name*? I would like 
to take advantage of the fact that even though the variables and host are 
same, the group name is unique and hence would like to use the group name 
to access the variables.


-- 
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/14f0a25f-f0d3-4f95-8ffd-fd143348529d%40googlegroups.com.


[ansible-project] how to use extends_documentation_fragment. getting error while using it

2020-05-20 Thread alok ranjan
Hi ,

I am new to ansible and this is my first ansible project. I am writing my 
own ansible modules which shares the same document acroos multiple modules 
which i need to develop.
As per the ansible website 
https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_documenting.html
 we 
can use *extends_documentation_fragment*.

After going through the web link this is what i did on my centos (ansible 
controller)

*i create a new doc file (alokdoc.py) with below content*.


class ModuleDocFragment(object):

DOCUMENTATION = r'''
array_ip:
  description:
  - "The storage system IP address."
  required: True
array_password:
  description:
  - "The storage system password."
  required: True
array_username:
  description:
  - "The storage system user name."
  required: True
'''

I saved this under the following directory 
"/usr/lib/python3.6/site-packages/ansible/plugins/doc_fragments" 
as "alokdoc.py"

Now in my ansible module ,namely, alok_module1.py, located under 
/etc/ansible/library/modules , i wrote the below 

DOCUMENTATION = r'''
---
author: "alok.ranjan@.com"
description: "my first module"
module: alok_module1
*extends_documentation_fragment*:
- *alokdoc*

.
.
.


Also, in my ansible.cfg file i have these two variables enabled .. 
# by alok
library
= 
/etc/ansible/library/modules:/usr/lib/python3.6/site-packages/ansible/plugins/doc_fragments
module_utils = /usr/lib/python3.6/site-packages/ansible/module_utils


When i run the below command i get error 
ansible-doc -t module "alok_module1.py" ERROR! module alok_module1 missing 
documentation (or could not parse documentation): unknown doc_fragment(s) 
in file /etc/ansible/library/modules/alok_module1.py: alokdoc


*Why am i getting this error. what am i missing??*

Thanks,
Alok



-- 
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/ea52f138-a49b-472c-826f-b6d1bd7c3607%40googlegroups.com.