Re: [ansible-project] Ansible Python API 2.0 - capture warnings

2018-04-12 Thread Suren Baskaran
Hey Brain
Appreciate some pointers here

Thanks,
Suren VB

From: Suren Baskaran 
Sent: Thursday, April 12, 2018 11:52:23 AM
To: ansible-project@googlegroups.com; Ansible Project
Subject: Re: [ansible-project] Ansible Python API 2.0 - capture warnings

Thanks for the prompt response Brian

Any examples or references on how to integrate the display with playbook 
executor callbacks ?

Appreciate your response

Thanks,
Suren VB

From: ansible-project@googlegroups.com  on 
behalf of Brian Coca 
Sent: Wednesday, April 11, 2018 7:18:50 PM
To: Ansible Project
Subject: Re: [ansible-project] Ansible Python API 2.0 - capture warnings

Warnings are not currently handled by callbacks, the Display class handles them.


--
--
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7eFcKLzY5_doDDmQ17UTpsXkLCHkUwM6j2MgyLfFKJY6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/DM5PR14MB1563C07A3F63C6EB44FFA37CAABC0%40DM5PR14MB1563.namprd14.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Facts

2018-04-12 Thread Tcpip
Hi all,

I have the following playbook 

---


   
- hosts: r2
  gather_facts: true
  connection: local
  vars:
creds:
  host: "{{ ansible_host }}"
  username: cisco
  password: cisco
 
  tasks:
- name: ios_facts
  ios_facts:
 provider: "{{ creds }}"
 
- debug:
var: ansible_net_interfaces


If I do a debut I get this output

"ansible_net_interfaces": {
"Ethernet0/0": {
"bandwidth": 1, 
"description": null, 
"duplex": null, 
"ipv4": [
{
"address": "10.10.10.12", 
"subnet": "24"
}
], 
"lineprotocol": "up ", 
"macaddress": "aabb.cc00.2000", 
"mediatype": null, 
"mtu": 1500, 
"operstatus": "up", 
"type": "AmdP2"
}, 
"Ethernet0/1": {
"bandwidth": 1, 
"description": null, 
"duplex": null, 
"ipv4": [], 
"lineprotocol": "down ", 
"macaddress": "aabb.cc00.2010", 
"mediatype": null, 
"mtu": 1500, 
"operstatus": "administratively down", 
"type": "AmdP2"



What im trying to do is to check if the fact "lineprotocol" is up or down, 
but when I put the fact in my var is not working, how should I do this?

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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fbae18f9-7744-4a5b-bb96-366813cd52f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] I am trying to disable a user and give no login access to the user.

2018-04-12 Thread POOJA VENKATESH
Thanks. It works :)

On Thu, Apr 12, 2018 at 2:16 PM, Brian Coca  wrote:

> Or you can just expire the user :
>
>
> - user:
>  name: thatguy
>  expires: "{{lookup('pipe', 'date +%s')}}"
>
>
>
>
>
> --
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/CACVha7dEG4i3WLrbEY_YkLJbnHvARXBAJNmUHrQw0q1P8uHrx
> Q%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAAGG3SArJ0ksETMNpwZjszzwmp96A%3DPvgeNJGKVJXJ-gibXyUQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] I am trying to disable a user and give no login access to the user.

2018-04-12 Thread POOJA VENKATESH
Thanks :) It works!

On Thu, Apr 12, 2018 at 2:12 PM, Matt Martz  wrote:

> I typically do something like:
>
> - name: Disable the ubuntu user
>   user:
> name: ubuntu
> password: "!"
> shell: /usr/sbin/nologin
>
> - name: Remove the ubuntu users ssh key
>   file:
> path: /home/ubuntu/.ssh/authorized_keys
> force: yes
> state: absent
>
> On Thu, Apr 12, 2018 at 4:11 PM, POOJA VENKATESH <
> poojavenkateshre...@gmail.com> wrote:
>
>>
>> I am trying to disable a user and not remove it completely
>>
>> ---
>> - hosts: target1
>>   tasks:
>> - name: disable the user
>>   become: yes
>>   user:
>> name: random
>> group: sudo
>> state: absent
>>
>>
>> When I run this playbook I see that the user is removed. Is there a way I
>> can disable the user other than using expire parameter? I just want the
>> user to stay but not have any login capabilities.
>>
>> --
>> 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 post to this group, send email to ansible-project@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/ansible-project/CAAGG3SAX-Anb95ODx10xL21WoyzRN3VwWcogZwv
>> rxweUowd5Qg%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/CAD8N0v8re6zFFnDo5kQcv2zdUXzbS
> C-p%2ByXvTM2Q5CBvjZth9w%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAAGG3SC9Qt6PfL%2BXWCeDor334%2BUTNpFQ%2B8yB8TX%2BWbR62jJgsw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Tacacs validation

2018-04-12 Thread 'Juraj Papic' via Ansible Project
muchas gracias, seguire buscando alguna forma.

saludos y gracias.

[image: cid:D5DA6341-AA78-4808-9639-F19B8AB3CBE8]

*Juraj A. Papic*

Arquitecto de Soluciones

juraj.pa...@bghtechpartner.com

Arias 1639/41. C1429DWA.
Bs. As., Argentina.

T. +54 11 5080-7400

M. +54 911 3445-6944

Skype juraj.papic

www.bghtechpartner.com



2018-04-12 18:32 GMT-03:00 Brian Coca :

> Es lo mismo, simplemente son servidores mas especializados, en cuanto la
> autentificación, no hay diferencia
>
>
> --
> --
> Brian Coca
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/5tvnUXSZ7bE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/CACVha7cEFGqqbqBBy8aYH530XYv-
> 8VcPG5Y%3DexX1hFm4%2BykuWg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
 
*BGH* 
informa que todos los actos o hechos que se interpreten como contrarios a 
los principios establecidos por el Código de Ética y Conducta de la 
empresa, podrán ser denunciados en forma anónima, a través de nuestra Línea 
Ética. *Teléfono*: 0800-122-0459 | *Fax*: +54-11-4316-5800 | *Email*: 
lineaetica...@kpmg.com.ar  | *Correo* 
*Postal*: Bouchard 710, 6to piso (1001), Buenos Aires, Argentina - Ref: 
Línea Ética BGH.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALr__wbWoE%3Dwo-Mm1F%3DS_GJtmJm-x2%3D1u0s7PDMeNU8CDj%2B7Gw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Tacacs validation

2018-04-12 Thread Brian Coca
Es lo mismo, simplemente son servidores mas especializados, en cuanto la
autentificación, no hay diferencia


-- 
--
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7cEFGqqbqBBy8aYH530XYv-8VcPG5Y%3DexX1hFm4%2BykuWg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Tacacs validation

2018-04-12 Thread 'Juraj Papic' via Ansible Project
El tema que yo no estoy usando Ansible para conectar a Servidores lo estoy
usando para networking.

saludos y gracias.

[image: cid:D5DA6341-AA78-4808-9639-F19B8AB3CBE8]

*Juraj A. Papic*

Arquitecto de Soluciones

juraj.pa...@bghtechpartner.com

Arias 1639/41. C1429DWA.
Bs. As., Argentina.

T. +54 11 5080-7400

M. +54 911 3445-6944

Skype juraj.papic

www.bghtechpartner.com



2018-04-12 18:22 GMT-03:00 Brian Coca :

> Como dije inicialmente, Ansible no hace la validación, pasa la información
> al conector y este  as su vez lo pasa al sistema operativo, el cual valida
> el usuario y contraseña contra lo que esta configurado en la computadora.
>
> Si puedes entrar con usuario y contraseña o certificado, Ansible lo usará
> del mismo modo que un usuario.
>
> --
> --
> Brian Coca
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/5tvnUXSZ7bE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/CACVha7cqpeirDudgD%3DN8gKzhwDNfctZNRR7u3eMvfpy6%
> 3D5Si%3DQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
 
*BGH* 
informa que todos los actos o hechos que se interpreten como contrarios a 
los principios establecidos por el Código de Ética y Conducta de la 
empresa, podrán ser denunciados en forma anónima, a través de nuestra Línea 
Ética. *Teléfono*: 0800-122-0459 | *Fax*: +54-11-4316-5800 | *Email*: 
lineaetica...@kpmg.com.ar  | *Correo* 
*Postal*: Bouchard 710, 6to piso (1001), Buenos Aires, Argentina - Ref: 
Línea Ética BGH.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALr__wYYFXT79x92UajkNfjprwqswQV-ZobdZ7MaoFEaWLUKhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Tacacs validation

2018-04-12 Thread Brian Coca
Como dije inicialmente, Ansible no hace la validación, pasa la información
al conector y este  as su vez lo pasa al sistema operativo, el cual valida
el usuario y contraseña contra lo que esta configurado en la computadora.

Si puedes entrar con usuario y contraseña o certificado, Ansible lo usará
del mismo modo que un usuario.

-- 
--
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7cqpeirDudgD%3DN8gKzhwDNfctZNRR7u3eMvfpy6%3D5Si%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Is it possible to pass 'vars_prompt' variables from one playbook to another that would normally resemble passing arguments in functions?

2018-04-12 Thread EspressoBeanies
I'm wondering whether or not its possible to pass variables defined by 
'vars_prompt' from one playbook to another when that other playbook is 
properly referenced in the first playbook. In other programming languages, 
this would be the equivalent of passing function arguments when the 
functions themselves are being called.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/25ab0289-bd7f-4d40-9969-2681ef9f063a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] I am trying to disable a user and give no login access to the user.

2018-04-12 Thread Matt Martz
I typically do something like:

- name: Disable the ubuntu user
  user:
name: ubuntu
password: "!"
shell: /usr/sbin/nologin

- name: Remove the ubuntu users ssh key
  file:
path: /home/ubuntu/.ssh/authorized_keys
force: yes
state: absent

On Thu, Apr 12, 2018 at 4:11 PM, POOJA VENKATESH <
poojavenkateshre...@gmail.com> wrote:

>
> I am trying to disable a user and not remove it completely
>
> ---
> - hosts: target1
>   tasks:
> - name: disable the user
>   become: yes
>   user:
> name: random
> group: sudo
> state: absent
>
>
> When I run this playbook I see that the user is removed. Is there a way I
> can disable the user other than using expire parameter? I just want the
> user to stay but not have any login capabilities.
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/CAAGG3SAX-Anb95ODx10xL21WoyzRN3VwWcogZwv
> rxweUowd5Qg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v8re6zFFnDo5kQcv2zdUXzbSC-p%2ByXvTM2Q5CBvjZth9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Tacacs validation

2018-04-12 Thread 'Juraj Papic' via Ansible Project
Genial,

Si puedo configura para que el sshd valide via tacacas,  entonces Ansible
podria hacer la validacion que necesito, ya que actualmente para un
proyecto estoy buscando esta opcion .

http://sen-wiki.blogspot.com.ar/2014/03/authenticate-linux-sshd-with-tacacs.html

saludos y gracias.

[image: cid:D5DA6341-AA78-4808-9639-F19B8AB3CBE8]

*Juraj A. Papic*

Arquitecto de Soluciones

juraj.pa...@bghtechpartner.com

Arias 1639/41. C1429DWA.
Bs. As., Argentina.

T. +54 11 5080-7400

M. +54 911 3445-6944

Skype juraj.papic

www.bghtechpartner.com



2018-04-12 17:40 GMT-03:00 Brian Coca :

> No entiendo la pregunta, pero si quieres, podemos usar Español para
> entendernos mejor.
>
> --
> --
> Brian Coca
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/5tvnUXSZ7bE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/CACVha7dbKGTBP2NLSzrWd9bOGPEAU
> ZubuR1V9avDoem8SjKC8Q%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
 
*BGH* 
informa que todos los actos o hechos que se interpreten como contrarios a 
los principios establecidos por el Código de Ética y Conducta de la 
empresa, podrán ser denunciados en forma anónima, a través de nuestra Línea 
Ética. *Teléfono*: 0800-122-0459 | *Fax*: +54-11-4316-5800 | *Email*: 
lineaetica...@kpmg.com.ar  | *Correo* 
*Postal*: Bouchard 710, 6to piso (1001), Buenos Aires, Argentina - Ref: 
Línea Ética BGH.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALr__wb2svo%2BC2TOxvKdWoiJSzY07XytXQxcB02VC7c0_GJRcA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] I am trying to disable a user and give no login access to the user.

2018-04-12 Thread POOJA VENKATESH
I am trying to disable a user and not remove it completely

---
- hosts: target1
  tasks:
- name: disable the user
  become: yes
  user:
name: random
group: sudo
state: absent


When I run this playbook I see that the user is removed. Is there a way I
can disable the user other than using expire parameter? I just want the
user to stay but not have any login capabilities.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAAGG3SAX-Anb95ODx10xL21WoyzRN3VwWcogZwvrxweUowd5Qg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Trying to create a new user and password for server login . SSH permission denied error.

2018-04-12 Thread POOJA VENKATESH
Hi,


I am trying to create a new user and password for the server login. The
user is created in /etc/passwd and also I can see the password entry in
/etc/shadow however when I try to ssh through the new user I cannot login
into the server. What steps are missing in the following code?



---
- hosts: local host
  vars:
username: random
  vars_prompt:
- name: "user_passwd"
  prompt: "Enter a password for the user"
  private: yes
  tasks:
- name: Add a new user
  become: yes
  user:
name: '{{ username }}'
shell: /bin/bash
group: sudo
state: present
createhome: yes

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAAGG3SAALojkjpgNW%3DcEUt7_wi%2Bdd40CGc_-3LiYJTtYUKaTPA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Tacacs validation

2018-04-12 Thread Brian Coca
No entiendo la pregunta, pero si quieres, podemos usar Español para
entendernos mejor.

-- 
--
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7dbKGTBP2NLSzrWd9bOGPEAUZubuR1V9avDoem8SjKC8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ternary filter vs conditional expressions

2018-04-12 Thread Brian Coca
Other people found it confusing and wanted something they could easily
lookup up, like a filter.

Once I added it, I stopped hearing complaints, so not sure how much
that is worth other than anecdotal evidence.

Use whichever way suits you best.





-- 
--
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7cA6WoFgc7jOBcvwzr6nhpyA_uhBO3GoVfw%3Df0ys9%2BvGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to sort ansible output

2018-04-12 Thread The Wanderer
Hi all,

I have a couple of servers that are managed via ansible. On all of them, I 
have got a script - free.sh - that when run, outputs just the free memory, 
like - 5GB. This is not the free system RAM, but a value that's obtained by 
complex calculations done via the script. I can call the script via ansible 
in this manner:

ansible -bK -a "/usr/bin/free.sh" apache-servers

(where apache-servers is the host-group on which I want to run the script)

And here's the limitation that I'm facing - Ansible just returns results in 
the order the job completes. But, I want the result to be sorted according 
to the script's output. Is this possible?

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2090253c-01a4-4db7-abe4-6275615ad826%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Trying to create a new user and password for server login . SSH permission denied error.

2018-04-12 Thread poojavenkateshreddy
Hi, 


I am trying to create a new user and password for the server login. The 
user is created in /etc/passwd and also I can see the password entry in 
/etc/shadow however when I try to ssh through the new user I cannot login 
into the sever. What steps are missing in the following code.



---
- hosts: local host
  vars:
username: random
  vars_prompt:
- name: "user_passwd"
  prompt: "Enter a password for the user"
  private: yes
  tasks:
- name: Add a new user
  become: yes
  user:
name: '{{ username }}'
shell: /bin/bash
group: sudo
state: present
createhome: yes
   









-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e7fb364f-93b6-4407-9865-f9fe6ca972af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ternary filter vs conditional expressions

2018-04-12 Thread rbarlik


On Wednesday, April 11, 2018 at 3:10:34 PM UTC+1, Brian Coca wrote:
>
>
> The `ternary` filter is easier for people that are not familiar with 
> Python, but non programmers and those used to ternary structures in 
> other languages. 
>
>
I'm used to the different ternary structures from different programming 
languages and I find it hard to believe that the ternary filter is easier 
for non programmers. Is there any evidence of it being the case?

The python style syntax reads more like English and you can immediately see 
the control flow.

On the other hand, the first time I've seen the ternary filter I had to 
look up how it works. Is the first argument for the false or for the true 
condition.
You don't have this problem with the other syntax.


-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0d31cef3-a3a7-4c31-8018-6cc5f0c3d7c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Tacacs validation

2018-04-12 Thread 'Juraj Papic' via Ansible Project
Hello Brian,

Thanks for that info, if I manage to configure the sshd to validate
directly to the tacacas, do you this will fix the issue?

Thanks.

[image: cid:D5DA6341-AA78-4808-9639-F19B8AB3CBE8]

*Juraj A. Papic*

Arquitecto de Soluciones

juraj.pa...@bghtechpartner.com

Arias 1639/41. C1429DWA.
Bs. As., Argentina.

T. +54 11 5080-7400

M. +54 911 3445-6944

Skype juraj.papic

www.bghtechpartner.com



2018-04-12 12:35 GMT-03:00 Brian Coca :

> Ansible does not really validate user/pass, the connection system is
> responsible for it, normally delegating it to the login system.
>
> i.e ansible passes the info to ssh, sshd can delegate validation to
> login/pam.
>
>
> --
> Brian Coca
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/5tvnUXSZ7bE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/CACVha7coO7wsdYfPn_fu2RE1oZo4RmEMikv06yYzeUyoxJAb
> QQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
 
*BGH* 
informa que todos los actos o hechos que se interpreten como contrarios a 
los principios establecidos por el Código de Ética y Conducta de la 
empresa, podrán ser denunciados en forma anónima, a través de nuestra Línea 
Ética. *Teléfono*: 0800-122-0459 | *Fax*: +54-11-4316-5800 | *Email*: 
lineaetica...@kpmg.com.ar  | *Correo* 
*Postal*: Bouchard 710, 6to piso (1001), Buenos Aires, Argentina - Ref: 
Línea Ética BGH.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALr__wbLoWLYUFW2OaXdFs8vqbioJOrwGZbFcbOe4XS5UenynA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re:

2018-04-12 Thread Bishwajit Samanta
Check whether these configurations are there in your host file..

ansible_user: admin
ansible_password: XXX
ansible_winrm_scheme: https
ansible_winrm_transport: credssp
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore
validate_certs: false

On Thu 12 Apr, 2018, 17:33 Bishwajit Samanta, <
bishwajitsamanta1...@gmail.com> wrote:

> Share me your host file which you have configured in ansible, where you
> have decalared your connection type as winrm etc. May be i can look into it
> and help you.
>
> On Thursday, April 12, 2018 at 5:13:54 PM UTC+5:30, ishita pandey wrote:
>>
>> Hi team,
>>
>>
>> I am trying to setup winrm connection to windows 12 but getting below
>> error:
>>
>> <10.47.11.89> WINRM CONNECTION ERROR: the specified credentials were
>> rejected by the server Traceback (most recent call last): File
>> "/usr/lib/python2.6/site-packages/ansible/plugins/connection/winrm.py",
>> line 154, in _winrm_connect self.shell_id =
>> protocol.open_shell(codepage=65001) # UTF-8 File
>> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/protocol.py",
>> line 132, in open_shell res = self.send_message(xmltodict.unparse(req))
>> File
>> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/protocol.py",
>> line 207, in send_message return self.transport.send_message(message) File
>> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/transport.py",
>> line 179, in send_message raise InvalidCredentialsError("the specified
>> credentials were rejected by the server") InvalidCredentialsError: the
>> specified credentials were rejected by the server fatal: [10.47.11.89]:
>> UNREACHABLE! => { "changed": false, "msg": "basic: the specified
>> credentials were rejected by the server", "unreachable": true } to retry,
>> use: --limit @/var/lib/awx/.ansible/tmp/test_housekeeping_full.retry
>>
>> The user that i am trying is added to administrator group as well still
>> the issue.
>> Can someone please suggest.
>>
>> Regards,
>> Ishita
>>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/6d37d54f-a341-40c3-941d-678cfe69b0a2%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAPkwwd2z2EVDosuBGowaMEFCEgMC3EnKv4MuCAC%2BKHXvbsszww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Tacacs validation

2018-04-12 Thread Brian Coca
Ansible does not really validate user/pass, the connection system is
responsible for it, normally delegating it to the login system.

i.e ansible passes the info to ssh, sshd can delegate validation to
login/pam.


--
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7coO7wsdYfPn_fu2RE1oZo4RmEMikv06yYzeUyoxJAbQQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: vsphere wait for vm powered off

2018-04-12 Thread Kai Stian Olstad

On 12.04.2018 14:11, Zeljko Dokman wrote:

Hi,
thank you for the info.
one more question, for vsphere_guest module, how to know that "state"
parameter should be referenced as
"vm_state.ansible_facts.hw_power_status", this part a have not find in 
the

documentation.? how is this contracted for all other parameters for
particular module?


Some module has this documented, but most of them don't unfortunately.
So you are left with finding it yourself.

To do that you run the module with "register: ..." directive and print 
the content of the variable.

The content you print like this

  - debug: var=vm_state


--
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/97815bb6bbb0fc8e08407d72c7138c05%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible Playbook running for longtime/indefinitely for windows 2012 R2 Ansible Playbook

2018-04-12 Thread Ramanjaneyulu S
I have the same issue while using win_packageto install applications on 
remote windows servers. in the log ansible is giving status code 200 thrice 
and then status code 500 consistently.

let me know, if you got any workaround.

Thank you

On Thursday, 8 March 2018 02:32:51 UTC-5, Namasivayam C wrote:
>
>
> I am new to Ansible and I'm trying to configure windows 2012 R2 from RHEL 
> 7 Ansible Node. I'm able to establish connection between them using Winrm 
> Credssp. Below is /etc/ansible/group_vars/windows.yml file
>
>
> COMPONENT NAME
> urllib3.connectionpool https://192.168.2.211:5986 "POST /wsman HTTP/1.1" 
> 500 1320
>
>
> ANSIBLE VERSION
> ansible 2.3.1.0
>
> python version = 2.7.5
>
>
> ansible_user: admin
> ansible_password: XXX
> ansible_winrm_scheme: https
> ansible_winrm_transport: credssp
> ansible_port: 5986
> ansible_connection: winrm
> ansible_winrm_server_cert_validation: ignore
> validate_certs: false
>
> When I execute win_ping module for testing connection from Ansible node to 
> Windows 2012 R2 server it was successful.
>
> [root@Ansible-Server playbooks]# ansible windows -m win_ping
> XX.XX.XX.XX | SUCCESS => {
> "changed": false,
> "ping": "pong"
> }
>
> But When I have tried executing Windows 2012 R2 playbook file, after 
> submitting ansible-playbook playbook.yml command, it is continuously 
> waiting for indefinite time, as It is not completing.
>
> Below is the log that is constantly displaying same. Waiting continuously. 
> /var/log/ansible/log
>
> 2018-03-07 19:34:14,255 urllib3.connectionpool https://192.168.2.211:5986 
> "POST 
> /wsman HTTP/1.1" 500 1320
> 2018-03-07 19:34:34,256 urllib3.connectionpool https://192.168.2.211:5986 
> "POST 
> /wsman HTTP/1.1" 500 1320
> 2018-03-07 19:34:54,256 urllib3.connectionpool https://192.168.2.211:5986 
> "POST 
> /wsman HTTP/1.1" 500 1320
> 2018-03-07 19:35:14,258 urllib3.connectionpool https://192.168.2.211:5986 
> "POST 
> /wsman HTTP/1.1" 500 1320
> 2018-03-07 19:35:34,257 urllib3.connectionpool https://192.168.2.211:5986 
> "POST 
> /wsman HTTP/1.1" 500 1320
> 2018-03-07 19:35:54,272 urllib3.connectionpool https://192.168.2.211:5986 
> "POST 
> /wsman HTTP/1.1" 500 1320
> 2018-03-07 19:36:14,272 urllib3.connectionpool https://192.168.2.211:5986 
> "POST 
> /wsman HTTP/1.1" 500 1320
> 2018-03-07 19:36:34,273 urllib3.connectionpool https://192.168.2.211:5986 
> "POST 
> /wsman HTTP/1.1" 500 1320
> 2018-03-07 19:36:54,273 urllib3.connectionpool https://192.168.2.211:5986 
> "POST 
> /wsman HTTP/1.1" 500 1320
> 2018-03-07 19:37:14,273 urllib3.connectionpool https://192.168.2.211:5986 
> "POST 
> /wsman HTTP/1.1" 500 1320
> 2018-03-07 19:37:34,273 urllib3.connectionpool https://192.168.2.211:5986 
> "POST 
> /wsman HTTP/1.1" 500 1320
> 2018-03-07 19:37:54,274 urllib3.connectionpool https://192.168.2.211:5986 
> "POST 
> /wsman HTTP/1.1" 500 1320
> 2018-03-07 19:38:14,274 urllib3.connectionpool https://192.168.2.211:5986 
> "POST 
> /wsman HTTP/1.1" 500 1320
> 2018-03-07 19:38:34,274 urllib3.connectionpool https://192.168.2.211:5986 
> "POST 
> /wsman HTTP/1.1" 500 1320
> 2018-03-07 19:38:54,274 urllib3.connectionpool https://192.168.2.211:5986 
> "POST 
> /wsman HTTP/1.1" 500 1320
>
> above log continues/updates same for every 20 sec.
>
> Could you please any one suggest where it' got stuck and how i can 
> identify and troubleshoot .
>
>
>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b3088ba8-e074-4592-a919-3d6c9a497ff5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Tacacs validation

2018-04-12 Thread 'Juraj Papic' via Ansible Project
Hello,

I would like to know if there's any chance to configure ansible to validate 
user/pass via tacacs , instead of hard coding the user/pass.

I dont want to use vault.

Thanks. 

-- 
 
*BGH* 
informa que todos los actos o hechos que se interpreten como contrarios a 
los principios establecidos por el Código de Ética y Conducta de la 
empresa, podrán ser denunciados en forma anónima, a través de nuestra Línea 
Ética. *Teléfono*: 0800-122-0459 | *Fax*: +54-11-4316-5800 | *Email*: 
lineaetica...@kpmg.com.ar  | *Correo* 
*Postal*: Bouchard 710, 6to piso (1001), Buenos Aires, Argentina - Ref: 
Línea Ética BGH.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/13766775-a8ea-4d30-9537-10aa95ab2fdb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to use the same dictionary to loop over two tasks? is it possible using block?

2018-04-12 Thread Kai Stian Olstad

On 12.04.2018 02:20, Tony Chia wrote:

I would like to do this so that the win_iis_webbinding is called
immediately after win_iis_website instead of calling
win_iis_website,win_iis_website,etc then win_iis_webbinding,
win_iis_webbinding, etc

- block:
  - name: Create IIS site
win_iis_website:
  name:   '{{ item.key }}'
  state: started
  application_pool:   '{{ item.value.application_pool }}'
  physical_path:  '{{ item.value.physical_path }}'
  - name: Bind Site
win_iis_webbinding:
  name:   '{{ item.key }}'
  protocol: https
  ip: '{{ ansible_ip_addresses[0] }}'
  port:   '{{ item.value.http_port }}'
  certificate_hash:   '{{ item.value.cert_thumbprint }}'
  with_dict:"{{ sites }}"
  tags: webapp

However  I got this
ERROR! 'with_dict' is not a valid attribute for a Block


block doesn't support loops.
Too loop over several tasks you need to put the task in a file and use 
include_task: and loop over that.


--
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e2834b07e50b9ef9f493fa1649eef375%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: unable to fit the piece of code in ansible

2018-04-12 Thread Bishwajit Samanta
Thanks Karl, for your reply. Problem statement ::-

My job is to find out the hostname which belongs to hostclass ess, which in 
this case the answer is host002.

hostinfo:
  'host001':
ip: 192.168.43.10
hostclass: 'puppet'
  'host002':
ip: 192.168.43.11
hostclass: 'ess'
  'host003':
ip: 192.168.43.21
hostclass: 'mdb'


i got one solution from some friend in google ansible groups only, but i am 
unable to fit it my ansible playbook.


- debug:
msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
'ess')|first|first }}"


The playbook i am writing, which is wrong but i am not able to figure out 
how to fit the code in my playbook. Can anyone help me in modifying the 
code of mine.

---

- hosts: somehost
  gather_facts: no
  vars_files:
file: sometext.yaml
name: sometext

  - debug:
msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
'ess')|first|first }}


On Thursday, April 12, 2018 at 5:52:14 PM UTC+5:30, Karl Auer wrote:
>
> Can I suggest that you describe what you want to achieve. That is, 
> describe the end result that you are seeking.
>
> That is more likely to get a useful response.
>
> Regards, K.
>
>
> On Thu, Apr 12, 2018 at 9:58 PM, Bishwajit Samanta <
> bishwajits...@gmail.com > wrote:
>
>> Any one can suggest any idea please..
>>
>> On Thursday, April 12, 2018 at 8:21:32 AM UTC+5:30, Bishwajit Samanta 
>> wrote:
>>>
>>> Hi all,
>>>
>>> I am a beginner in ansible. If anyone can help me in finding the answer. 
>>> It would be great. My problem was finding a phrase in ansible which one of 
>>> the person have helped me. But unfortunately i am not able to fit the piece 
>>> of code in my playbook.
>>>
>>> hostinfo:
>>>   host001':
>>> ip: 192.168.43.10
>>> hostclass: 'puppet'
>>>   'host002':
>>> ip: 192.168.43.11
>>> hostclass: 'ess'
>>>   'host003':
>>> ip: 192.168.43.21
>>> hostclass: 'mdb'
>>>
>>> the code was::
>>>
>>> - debug: 
>>>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
>>> 'ess')|first|first }}"
>>>
>>> Now i am writing the code as given below. I know in this piece of code i 
>>> am making mistakes. But since i am a beginner i am not able to understand 
>>> it. Can anyone help me?
>>>
>>> ---
>>> - hosts: test
>>>   gather_facts: no 
>>>
>>> - debug: 
>>>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
>>> 'ess')|first|first }}"
>>>
>>> -- 
>> 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-proje...@googlegroups.com .
>> To post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/4431f374-65b9-4884-9acb-f709bdd658f3%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Karl Auer
>
> Email  : ka...@2pisoftware.com 
> Website: http://2pisoftware.com
>
> GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
> Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/bacee1a5-37a0-423a-9dcf-a8625c361493%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re:

2018-04-12 Thread Jordan Borean
You are also using Basic authentication over HTTP which isn't allowed by 
default on Windows and would be causing the rejection error. Please switch 
to a more secure authentication transport that can encrypt the messages 
over http like NTLM, Kerberos or CredSSP or use a HTTPS endpoint which 
encrypts the whole transport packets for you.

Thanks

Jordan

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b01458db-cc60-4aa4-9b96-343a7f385625%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: unable to fit the piece of code in ansible

2018-04-12 Thread Karl Auer
Can I suggest that you describe what you want to achieve. That is, describe
the end result that you are seeking.

That is more likely to get a useful response.

Regards, K.


On Thu, Apr 12, 2018 at 9:58 PM, Bishwajit Samanta <
bishwajitsamanta1...@gmail.com> wrote:

> Any one can suggest any idea please..
>
> On Thursday, April 12, 2018 at 8:21:32 AM UTC+5:30, Bishwajit Samanta
> wrote:
>>
>> Hi all,
>>
>> I am a beginner in ansible. If anyone can help me in finding the answer.
>> It would be great. My problem was finding a phrase in ansible which one of
>> the person have helped me. But unfortunately i am not able to fit the piece
>> of code in my playbook.
>>
>> hostinfo:
>>   host001':
>> ip: 192.168.43.10
>> hostclass: 'puppet'
>>   'host002':
>> ip: 192.168.43.11
>> hostclass: 'ess'
>>   'host003':
>> ip: 192.168.43.21
>> hostclass: 'mdb'
>>
>> the code was::
>>
>> - debug:
>>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto',
>> 'ess')|first|first }}"
>>
>> Now i am writing the code as given below. I know in this piece of code i
>> am making mistakes. But since i am a beginner i am not able to understand
>> it. Can anyone help me?
>>
>> ---
>> - hosts: test
>>   gather_facts: no
>>
>> - debug:
>>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto',
>> 'ess')|first|first }}"
>>
>> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/4431f374-65b9-4884-9acb-f709bdd658f3%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Karl Auer

Email  : ka...@2pisoftware.com
Website: http://2pisoftware.com

GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2B%2BT08QTxShbDcAykEAFbagCtuKepfV3z51qZ3aLzPJhoW1%2BBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: vsphere wait for vm powered off

2018-04-12 Thread Zeljko Dokman
Hi,
thank you for the info.
one more question, for vsphere_guest module, how to know that "state" 
parameter should be referenced as 
"vm_state.ansible_facts.hw_power_status", this part a have not find in the 
documentation.? how is this contracted for all other parameters for 
particular module?

Best regards


On Wednesday, April 11, 2018 at 7:09:07 PM UTC+2, Kai Stian Olstad wrote:
>
> On Wednesday, 11 April 2018 11.05.42 CEST Zeljko Dokman wrote: 
> > Hi, thank you, your suggestion works. 
> > I am wondering are this options documented some where? or how can I list 
> > this option for a module? 
> > Ansible documentation is not covering all this options or I haven't been 
> > able to find it.   
>
> The directives one the same level as vsphere_guest is not part of the 
> module they are part of the task. 
> The directive you can use and where is documented here 
>
> https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html
>  
>
> The documentation for until you'll find here 
>
> https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#do-until-loops
>  
>
>
> -- 
> 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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/378f1896-e51f-4f1a-a4f2-9aa56ca3ffe9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re:

2018-04-12 Thread Bishwajit Samanta
Share me your host file which you have configured in ansible, where you 
have decalared your connection type as winrm etc. May be i can look into it 
and help you.

On Thursday, April 12, 2018 at 5:13:54 PM UTC+5:30, ishita pandey wrote:
>
> Hi team,
>
>
> I am trying to setup winrm connection to windows 12 but getting below 
> error:
>
> <10.47.11.89> WINRM CONNECTION ERROR: the specified credentials were 
> rejected by the server Traceback (most recent call last): File 
> "/usr/lib/python2.6/site-packages/ansible/plugins/connection/winrm.py", 
> line 154, in _winrm_connect self.shell_id = 
> protocol.open_shell(codepage=65001) # UTF-8 File 
> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/protocol.py", 
> line 132, in open_shell res = self.send_message(xmltodict.unparse(req)) 
> File 
> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/protocol.py", 
> line 207, in send_message return self.transport.send_message(message) File 
> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/transport.py", 
> line 179, in send_message raise InvalidCredentialsError("the specified 
> credentials were rejected by the server") InvalidCredentialsError: the 
> specified credentials were rejected by the server fatal: [10.47.11.89]: 
> UNREACHABLE! => { "changed": false, "msg": "basic: the specified 
> credentials were rejected by the server", "unreachable": true } to retry, 
> use: --limit @/var/lib/awx/.ansible/tmp/test_housekeeping_full.retry 
>
> The user that i am trying is added to administrator group as well still 
> the issue.
> Can someone please suggest.
>
> Regards,
> Ishita
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6d37d54f-a341-40c3-941d-678cfe69b0a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Create a Azure VM with static private IP

2018-04-12 Thread Bubul Medhi
Hi, using Ansible, I want to create a Ubuntu VM in Azure with static 
private IP, i.e a predefined IP. Pls help.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/225e2a73-99b0-406c-ab91-96ad7d4d3011%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re:

2018-04-12 Thread Bishwajit Samanta
i have configured once, this during the time i have change certain 
parameters in the host file, where i declared the connection type as winrm 
etc. If you can share your host file configuaration, may be i can look into 
it.

On Thursday, April 12, 2018 at 5:13:54 PM UTC+5:30, ishita pandey wrote:
>
> Hi team,
>
>
> I am trying to setup winrm connection to windows 12 but getting below 
> error:
>
> <10.47.11.89> WINRM CONNECTION ERROR: the specified credentials were 
> rejected by the server Traceback (most recent call last): File 
> "/usr/lib/python2.6/site-packages/ansible/plugins/connection/winrm.py", 
> line 154, in _winrm_connect self.shell_id = 
> protocol.open_shell(codepage=65001) # UTF-8 File 
> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/protocol.py", 
> line 132, in open_shell res = self.send_message(xmltodict.unparse(req)) 
> File 
> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/protocol.py", 
> line 207, in send_message return self.transport.send_message(message) File 
> "/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/transport.py", 
> line 179, in send_message raise InvalidCredentialsError("the specified 
> credentials were rejected by the server") InvalidCredentialsError: the 
> specified credentials were rejected by the server fatal: [10.47.11.89]: 
> UNREACHABLE! => { "changed": false, "msg": "basic: the specified 
> credentials were rejected by the server", "unreachable": true } to retry, 
> use: --limit @/var/lib/awx/.ansible/tmp/test_housekeeping_full.retry 
>
> The user that i am trying is added to administrator group as well still 
> the issue.
> Can someone please suggest.
>
> Regards,
> Ishita
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d6a4b956-d507-4a24-9725-5d0a4491a269%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Is it possible to show anything graphical (like Zenity or the like) on remote nodes with a Ansible playbook?

2018-04-12 Thread Osqui
Hello.
I have a playbook which removes Downloads folder in remote hosts user's 
home but I'd like to warn the user before he/she could cancel this. 
I've thought about prompting a question on his/her desktop screen with 
zenity. Is it possible to invoke graphical apps inside a playbook? 
If so, which tricks with display variable, ssh configuration, X/Wayland 
stuff, etc is necessary?
Thanks a lot!

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/49595763-fa63-479c-ba84-fe18a229f45e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: unable to fit the piece of code in ansible

2018-04-12 Thread Bishwajit Samanta
Any one can suggest any idea please..

On Thursday, April 12, 2018 at 8:21:32 AM UTC+5:30, Bishwajit Samanta wrote:
>
> Hi all,
>
> I am a beginner in ansible. If anyone can help me in finding the answer. 
> It would be great. My problem was finding a phrase in ansible which one of 
> the person have helped me. But unfortunately i am not able to fit the piece 
> of code in my playbook.
>
> hostinfo:
>   host001':
> ip: 192.168.43.10
> hostclass: 'puppet'
>   'host002':
> ip: 192.168.43.11
> hostclass: 'ess'
>   'host003':
> ip: 192.168.43.21
> hostclass: 'mdb'
>
> the code was::
>
> - debug: 
>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
> 'ess')|first|first }}"
>
> Now i am writing the code as given below. I know in this piece of code i 
> am making mistakes. But since i am a beginner i am not able to understand 
> it. Can anyone help me?
>
> ---
> - hosts: test
>   gather_facts: no 
>
> - debug: 
>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
> 'ess')|first|first }}"
>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4431f374-65b9-4884-9acb-f709bdd658f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project]

2018-04-12 Thread ishita pandey
Hi team,


I am trying to setup winrm connection to windows 12 but getting below error:

<10.47.11.89> WINRM CONNECTION ERROR: the specified credentials were
rejected by the server Traceback (most recent call last): File
"/usr/lib/python2.6/site-packages/ansible/plugins/connection/winrm.py",
line 154, in _winrm_connect self.shell_id =
protocol.open_shell(codepage=65001) # UTF-8 File
"/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/protocol.py",
line 132, in open_shell res = self.send_message(xmltodict.unparse(req))
File
"/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/protocol.py",
line 207, in send_message return self.transport.send_message(message) File
"/var/lib/awx/venv/ansible/lib/python2.6/site-packages/winrm/transport.py",
line 179, in send_message raise InvalidCredentialsError("the specified
credentials were rejected by the server") InvalidCredentialsError: the
specified credentials were rejected by the server fatal: [10.47.11.89]:
UNREACHABLE! => { "changed": false, "msg": "basic: the specified
credentials were rejected by the server", "unreachable": true } to retry,
use: --limit @/var/lib/awx/.ansible/tmp/test_housekeeping_full.retry

The user that i am trying is added to administrator group as well still the
issue.
Can someone please suggest.

Regards,
Ishita

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAKsZHGwovxh3_E-mxCuJeUgVwEzWUVDWuRnYbPj_-VrnRgE2wA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible error : ERROR! The tasks/main.yml file for role 'xyz' must contain a list of tasks

2018-04-12 Thread Irfan Sayed
Thanks. Got it :)

On Wednesday, April 11, 2018 at 11:56:52 PM UTC+2, Brian Coca wrote:
>
> `tasks:` should only appear in a play, not a tasks list for a role, 
> remove it and it should 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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8ba6b8fc-f94c-41f3-8279-bc0a8c9e9b1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: need help to install Visual studio code on linux machine through Ansible

2018-04-12 Thread Varun Chopra
Your question is more suited for 
https://github.com/mhalano/ansible-role-visual-studio-code/issues

On Wednesday, April 11, 2018 at 4:23:22 PM UTC+5:30, Vishal Mane wrote:
>
> I took a role to install vs code from github. now trying to run the role, 
> it gets executes successfully, but vs code doesn't gets installed on the 
> target machine.
> my playbook is 
>
>- 
>- ---
>- - hosts: 
>-   become: true
>-   become_method: sudo
>-   roles:
>-  - { role: working-ansible-role-visual-studio-code, x: 42 }
>- 
>
> I cloned the role from this path --- 
> https://github.com/mhalano/ansible-role-visual-studio-code
>
>
> runnung playbook as -ansible-playbook -i   name>.yml --ask-sudo-pass
>
>
>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f78cb6bb-29c5-4775-b231-b645c1b5991e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: current run timestamp

2018-04-12 Thread Bishwajit Samanta
[defaults]
I used callback_whitelist = profile_tasks 

You can set it in ansible.cfg. 

That can solve your problem i guess.

On Wednesday, March 21, 2018 at 3:57:59 AM UTC+5:30, ordered...@gmail.com 
wrote:
>
> I want to set it up so there is a current ansible playbook run timestamp 
> set at the start of every playbook run so I can use this var in various 
> roles.
> The only way so far I have found is to set a pre_task with set fact in 
> every playbook.
> Does anyone have any suggestions or information on a current playbook run 
> start timestamp or a way to set this var so that I dont need to add the 
> set_fact to every 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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b5c39d27-71a8-4b86-acab-15349093372e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Hostnames with EC2 inventory plugin

2018-04-12 Thread oscar
Thank you very much for the information, and for the work! seems like 
ansible developers accepeted it, wich are great news. 

Regards,
Oscar

El miércoles, 11 de abril de 2018, 11:36:46 (UTC+2), flowerysong escribió:
>
> On Wednesday, April 11, 2018 at 3:19:51 AM UTC-4, os...@apartum.com wrote:
>>
>> I'm testing the new Amazon EC2 dynamic inventory plugin. I need to set 
>> the host names to the "Name" tag, but I don't understand the documentation. 
>> Reading this: 
>> http://docs.ansible.com/ansible/latest/plugins/inventory/aws_ec2.html I 
>> understand I should write something like this:
>>
>> hostnames:
>>   - tag:Name=Name
>>
>>
> The inventory plugin does not currently have useful support for setting 
> hostnames from tags. I submitted a pull request (
> https://github.com/ansible/ansible/pull/35880) to add this functionality, 
> but it hasn't been merged yet.
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/111a9144-123e-4f98-bbea-6dd94e1098e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: List of running processes form multiple linux hosts using with_items

2018-04-12 Thread Bishwajit Samanta
I just changed the host as devops
---

- hosts: devops
  gather_facts: no
  tasks:
- name: Get the running process across the systems
  command: ps -ef
  register: output

- name: Getting some details of systems
  local_action: copy content={{ output }} dest=/opt/{{ 
inventory_hostname }}file

Output::-
-

[root@ansible-master opt]# ls
192.168.56.111file  192.168.56.116file 

You can try with this and see if your problem get resolved.

On Wednesday, April 11, 2018 at 1:42:45 PM UTC+5:30, smitconsu...@gmail.com 
wrote:
>
> Hi 
> I am trying to achieve all running processes on our linux machines via 
> ansible and get output in a file along with each host name and processes. I 
> have made below playbook but not getting to the point how to get list of 
> processes for each host one by one and store in a file. Can anyone please 
> help with the code how can I achieve this? I am using with_items with list 
> of hosts which is coming from inventory group hostlist. many thanks
>
> ---
> - hosts: all
>   gather_facts: false
>   tasks:
>
>   - name: Get Running Processes
> command: ps -ef
> delegate_to: "{{ item }}"
> run_once: false
> with_items:
>  - "{{ groups['hostlist'] }}"
> register: process_list
>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/11e0d7f6-4c90-489b-9df0-d2dd9febdc36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible Python API 2.0 - capture warnings

2018-04-12 Thread Suren Baskaran
Thanks for the prompt response Brian

Any examples or references on how to integrate the display with playbook 
executor callbacks ?

Appreciate your response

Thanks,
Suren VB

From: ansible-project@googlegroups.com  on 
behalf of Brian Coca 
Sent: Wednesday, April 11, 2018 7:18:50 PM
To: Ansible Project
Subject: Re: [ansible-project] Ansible Python API 2.0 - capture warnings

Warnings are not currently handled by callbacks, the Display class handles them.


--
--
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7eFcKLzY5_doDDmQ17UTpsXkLCHkUwM6j2MgyLfFKJY6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/DM5PR14MB15633D56E8A3CE8778568922AABC0%40DM5PR14MB1563.namprd14.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.