Re: [ansible-project] purestorage sdk missing

2019-04-06 Thread Kai Stian Olstad

On 07.04.2019 05:09, Lucas Possamai wrote:


It is definitely a Python problem than Ansible.

[root@db2 ~]# /usr/bin/python -c 'import sys; print sys.path;

import purestorage'

['', '/usr/lib64/python26.zip', '/usr/lib64/python2.6',
'/usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk',
'/usr/lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload',
'/usr/lib64/python2.6/site-packages',
'/usr/lib64/python2.6/site-packages/gtk-2.0',
'/usr/lib/python2.6/site-packages']
Traceback (most recent call last):
  File "", line 2, in 
ImportError: No module named purestorage


Thanks for your help. Will try to get this python issue fixed.


Looks like you have Python 2.6 and 2.7 installed and that 
/usr/bin/python is 2.6 but purestorage is installed in 2.7.
To make Ansible use another Python than /usr/bin/python check out 
ansible_python_interpreter

https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-handle-python-not-having-a-python-interpreter-at-usr-bin-python-on-a-remote-machine

--
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/85f8d3523d11b4ab0751ffa28ac548e8%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: regex_replace filter

2019-04-06 Thread Sri Krishna G
Please ignore this issue. It was a mistake in the next part of the play 
book that is causing the port to come twice. 

On Sunday, April 7, 2019 at 1:03:34 AM UTC+5:30, Sri Krishna G wrote:
>
> I have a list of strings like :
>  
> [hosts]
> 10.100.0.1
> 10.100.0.2
> 10.100.0.3
>
> I am following the example under : 
> https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html to 
> "add "https://; prefix to each item in a list"
> In my case I am appending the port number at the end of every item in the 
> list and joining them with a "," to get a string at the end. I am expecting 
> to see something like:
>
>
> *10.100.0.1:2181,10.100.0.2:2181,10.100.0.3:2181*I am creating a variable 
> as:
>
> zookeeper_masters: "{{'zk://' + hosts | map('regex_replace', '^(.*)$', 
> '\\1:2181') | join(',')}}"
>
>
> My result comes as:
> "zk://10.100.0.1:2181:2181,10.100.0.2:2181:2181,10.100.0.3:2181:2181"
>
> Can some one point out as to why I am getting the port number twice?
>

-- 
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/280b5378-e2c3-41fa-a6be-77557e5d555e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] purestorage sdk missing

2019-04-06 Thread Lucas Possamai
On Sun, 7 Apr 2019 at 01:32, Kai Stian Olstad <
ansible-project+l...@olstad.com> wrote:

> On 06.04.2019 13:20, Lucas Possamai wrote:
> >>
> >> Or just keep "hosts: dbservers" and add "delegate_to: localhost" on
> >> the
> >> purefa_snap task.
> >> Then you don't have to deal the SDK on the remote machine since the
> >> module Python code is run on localhost.
> >>
> >
> > The thing is... I want the playbook to be executed on the host (not
> > locally). Testing it locally was only really a test to see where the
> > problem is. So I need to fix the missing SDK error.
>
> It's more a Python problem than Ansible.
> Ansible is running /usr/bin/python so your module need to be install in
> one of it's search path.
>
> To check the path you can run
> /usr/bin/python -c 'import sys; print sys.path'
>
> If the path listed is one of the paths that purestorage is this command
> should work.
>
> To check if you can import purestorage
> /usr/bin/python -c 'import purestorage'
>
> You should also check from you Ansible control machine to rule out
> environment variables not set by running
> ssh @ "/usr/bin/python -c 'import sys; print sys.path;
> import purestorage'"
>

It is definitely a Python problem than Ansible.

[root@db2 ~]# /usr/bin/python -c 'import sys; print sys.path;
> import purestorage'
['', '/usr/lib64/python26.zip', '/usr/lib64/python2.6',
'/usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk',
'/usr/lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload',
'/usr/lib64/python2.6/site-packages',
'/usr/lib64/python2.6/site-packages/gtk-2.0',
'/usr/lib/python2.6/site-packages']
Traceback (most recent call last):
  File "", line 2, in 
ImportError: No module named purestorage


Thanks for your help. Will try to get this python issue fixed.
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/CAE_gQfUBmZGe-wvaH5bsd5BxKp28EqxOD1MObQ6OQqo1fhBNBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] cannot get this playbook to work with inventory file

2019-04-06 Thread Tony Wong


I am having an issue with ansible/vmware. Trying to clone vms from an 
inventory file and playbook

inventory file:

[test-vms]
ans-test[01:05] 'disk'='60' 'memory'='2048' 'cpucount'='1' 
'datastore'='VOL1-TEST' 'osid='windows9Server64Guest'

playbook yml file:

vars_prompt:
- name: "vcenter_hostname"
prompt: "Enter vcenter hostname"
private: no
default: "vcsa"
- name: "vcenter_user"
prompt: "Enter vcenter username"
private: no
- name: "vcenter_pass"
prompt: "Enter vcenter password"
private: yes

vars:
datacenter: 'DC''
esxi_host: 'xxx'
notes: 'Created by Ansible'
template: '2016STDx64_Template'
datastore: 'VOL1-TEST'
network: 'vlan200'
folder: 'ansible'

tasks:
- vsphere_guest:
vcenter_hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pass }}"
guest: "{{ inventory_hostname }}"
validate_certs: False
from_template: yes
template_src: "{{ template }}"

vm_extra_config:
  folder: "{{ folder }}"
  notes: "{{ notes }}"
vm_disk:
  disk1:
size_gb: "{{ disk }}"
type: thin
datastore: "{{ datastore }}"
vm_nic:
  nic1:
type: vmxnet3
network: "{{ network }}"
network_type: standard
vm_hardware:
  memory_mb: "{{ memory }}"
  num_cpus: "{{ cpucount }}"
  osid: "{{ osid }}"
  scsi: paravirtual
esxi:
  datacenter: "{{ datacenter }}"
  hostname: "{{ esxi_host }}"

the playbook runs but the VMs asre not getting put in the right datastore. 
Also the memory is not set correctly at 2GB ram. vcpus is ok at 1

any idea?

-- 
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/5782fddb-f4c0-456a-9491-6c536013a596%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ssh transport and windows

2019-04-06 Thread Jordan Borean
Until you upgrade to Ansible 2.8 (currently has an alpha1 release) this won’t 
work. Experimental support for using SSH with Windows was added with 
https://github.com/ansible/ansible/pull/47732. Be aware that this is 
experimental and if you want something more solid then I advise that you 
continue to use WinRM 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 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/1ca027fe-c376-48fa-90e9-e019278395dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] regex_replace filter

2019-04-06 Thread Sri Krishna G
I have a list of strings like :
 
[hosts]
10.100.0.1
10.100.0.2
10.100.0.3

I am following the example under : 
https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html to 
"add "https://; prefix to each item in a list"
In my case I am appending the port number at the end of every item in the 
list and joining them with a "," to get a string at the end. I am expecting 
to see something like:


*10.100.0.1:2181,10.100.0.2:2181,10.100.0.3:2181*I am creating a variable 
as:

zookeeper_masters: "{{'zk://' + hosts | map('regex_replace', '^(.*)$', 
'\\1:2181') | join(',')}}"


My result comes as:
"zk://10.100.0.1:2181:2181,10.100.0.2:2181:2181,10.100.0.3:2181:2181"

Can some one point out as to why I am getting the port number twice?

-- 
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/e2cb5729-5027-4c7e-baa0-a1bdfb9fd288%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ssh transport and windows

2019-04-06 Thread Varun Chopra
SSH is not supported on Windows.

On Saturday, April 6, 2019 at 1:44:27 PM UTC+5:30, sergey@gmail.com 
wrote:
>
> Hello.
>
> I am aware of the support for SSH in Windows 2019 and Windows 10.
> I installed the OpenSSH in Windows 8.1 and tried to enter it. All is well.
> But if you turn on ssh transport in ansable, then nothing works :(
>
> 1. I have not done something in Windows 8.1 and it works in Windows 2019 
> and Windows 10?
> 2. Or ansibla does not support work in Windows through SSH at all?
>
> thank
>
> P.S. I am using the ansible version : 2.7.9
>

-- 
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/e54deef5-2ee6-4f21-8f8c-eab50ccbb73b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] purestorage sdk missing

2019-04-06 Thread Kai Stian Olstad

On 06.04.2019 13:20, Lucas Possamai wrote:


Or just keep "hosts: dbservers" and add "delegate_to: localhost" on 
the

purefa_snap task.
Then you don't have to deal the SDK on the remote machine since the
module Python code is run on localhost.



The thing is... I want the playbook to be executed on the host (not
locally). Testing it locally was only really a test to see where the
problem is. So I need to fix the missing SDK error.


It's more a Python problem than Ansible.
Ansible is running /usr/bin/python so your module need to be install in 
one of it's search path.


To check the path you can run
/usr/bin/python -c 'import sys; print sys.path'

If the path listed is one of the paths that purestorage is this command 
should work.


To check if you can import purestorage
/usr/bin/python -c 'import purestorage'

You should also check from you Ansible control machine to rule out 
environment variables not set by running
ssh @ "/usr/bin/python -c 'import sys; print sys.path; 
import purestorage'"



--
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/b0d3e1fe19e61f0fa75a9df877501330%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] purestorage sdk missing

2019-04-06 Thread Lucas Possamai
>
> Or just keep "hosts: dbservers" and add "delegate_to: localhost" on the
> purefa_snap task.
> Then you don't have to deal the SDK on the remote machine since the
> module Python code is run on localhost.
>

The thing is... I want the playbook to be executed on the host (not
locally). Testing it locally was only really a test to see where the
problem is. So I need to fix the missing SDK error.

Lucas

-- 
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/CAE_gQfUpHw6KGSBUQXkHM8ksen2XjJHya3oe-u1Azje1_u9bWg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] purestorage sdk missing

2019-04-06 Thread Kai Stian Olstad

On 06.04.2019 07:03, Lucas Possamai wrote:

So.. doing some tests.

Playbook is as follow:

---
- name: Oracle Database Snapshots
  hosts: dbservers
  remote_user: oracle
  sudo: true
  sudo_user: root
  vars_files:
- vars/arrays.yaml
- vars/database.yaml

  tasks:

# Take Snapshot of database volumes
- include: tasks/take_snapshot.yaml
  run_once: yes


tasks/take_snapshot.yaml:

---
# Perform PURE Flasharray Database snapshots
- name: perform PURE volume snapshot
  purefa_snap:
name: db2-prod-oracledb
suffix: snap
fa_url: "{{ fa_url }}"
api_token: "{{ apiToken }}"


Now, if I replace "*hosts: dbservers*" for "*hosts: localhost*", it 
works.

So that means it was indeed trying to connect to "*dbservers*" and then
running the commands.


As I explained to you in a previous mail :-)
This is how must modules work, they run on remote host unless hosts: 
localhost, connection: local or delegate_to: localhost is set somewhere.




I did check the dbservers host and I can see purestorage sdk is also
installed there.

oracle[DR]@db2:~$pip freeze |grep purestorage
DEPRECATION: Python 2.7 will reach the end of its life on January 1st,
2020. Please upgrade your Python as Python 2.7 won't be maintained 
after

that date. A future version of pip will drop support for Python 2.7.
purestorage==1.16.0


How can I fix the missing purestorage sdk error?  It is an RHEL 6.7.


Or just keep "hosts: dbservers" and add "delegate_to: localhost" on the 
purefa_snap task.
Then you don't have to deal the SDK on the remote machine since the 
module Python code is run on localhost.


--
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/08c85a3d95a883efed26dda97ea0bff4%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] how to access debug stdout variable

2019-04-06 Thread Kunalsing Thakur
 I was able to successfully do this task by following the instructions.
Thanks for matt to give some logic.

- name: searching the rpm into {{ reponame }} repo
  shell: pulp-admin rpm repo content rpm --repo-id={{reponame}} --match
'filename={{ item }}'
  loop: "{{ rpmname | default([]) }}"
  register: pulp
  when: search is defined
  failed_when: pulp.stdout == "\u001b[0m"

Result:-
TASK [mobi_ansible_role_pulp : searching the rpm into infra]
**
task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:5
Saturday 06 April 2019  10:07:15 + (0:00:02.298)   0:00:02.709

failed: [node]
(item=GoIP-devel-1.6.11-201711302323.798cb6f.el7.centos.x86_64.rpm) =>
changed=true
  cmd: pulp-admin rpm repo content rpm --repo-id=mobi-infra.smf1.mobitv
--match
'filename=GoIP-devel-1.6.11-201711302323.798cb6f.el7.centos.x86_64.rpm'
  delta: '0:00:00.781775'
  end: '2019-04-06 10:07:17.178794'
  failed_when_result: true
  item: GoIP-devel-1.6.11-201711302323.798cb6f.el7.centos.x86_64.rpm
  rc: 0
  start: '2019-04-06 10:07:16.397019'
  stderr: ''
  stderr_lines: []
  stdout: "\e[0m"
  stdout_lines: 


This issue is resolved now. :)


On Wed, Apr 3, 2019 at 9:32 PM Kunalsing Thakur 
wrote:

> Hi sebastian,
> pulp.results.0.stdout give me output "\e[0m"
>
> But when I try to access in failed_when condition
> It is giving me below error.
> fatal: [node]: FAILED! =>
>
>   msg: 'The conditional check ''pulp.results.0.stdout == "\e[0m"'' failed.
> The error was: error while evaluating conditional (pulp.results.0.stdout ==
> "\e[0m"): ''dict object'' has no attribute ''results'''
>
> Looks like in faiked_when condition it needs dictionary?
>
>
>
>
> On Wed, 3 Apr 2019, 20:18 Kunalsing Thakur  wrote:
>
>> when i print the pulp.results.0.stdout it will give me following output:-
>> TASK [mobi_ansible_role_pulp : debug]
>> 
>> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:9
>> Wednesday 03 April 2019  14:46:40 + (0:00:02.206)   0:00:09.036
>> ***
>> ok: [inplp01p2.infra.smf1.mobitv] =>
>>   pulp.results.0.stdout: "\e[0m"
>> which is blank so i want to failed this task?
>>
>>
>> On Wednesday, April 3, 2019 at 8:14:31 PM UTC+5:30, Kunalsing Thakur
>> wrote:
>>>
>>> Hi sebastian,
>>> when i try to fail the task with this below condition i get the error in
>>> task
>>>
>>> *failed_when: pulp.results.0.stdout == "\e[0m"*
>>>
>>> TASK [mobi_ansible_role_pulp : searching the rpm into pulp repo]
>>> *
>>> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:4
>>> Wednesday 03 April 2019  14:40:58 + (0:00:01.856)   0:00:06.231
>>> ***
>>> fatal: [inplp01p2.infra.smf1.mobitv]: FAILED! =>
>>>   msg: 'The conditional check ''pulp.results.0.stdout == "\e[0m"''
>>> failed. The error was: error while evaluating conditional
>>> (pulp.results.0.stdout == "\e[0m"): ''dict object'' has no attribute
>>> ''results'''
>>>
>>>
>>> On Wednesday, April 3, 2019 at 8:01:59 PM UTC+5:30, Sebastian Meyer
>>> wrote:

 On 03.04.19 16:22, Kunalsing Thakur wrote:
 > ---
 > - name: Logging into pulp
 >   shell: pulp-admin login -u admin -p admin
 > - name: searching the rpm into pulp repo
 >   shell: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots
 --match
 > 'filename={{ item }}'
 >   with_items: "{{ rpmname | default([]) }}"
 >   register: pulp
 >   when: rpmsearch is defined

 You are using register with a loop. That means pulp.results is a list
 and there's an element for each item in that list.

 You can access the stdout for the first item with pulp.results.0.stdout

 Sebastian
 --
 Sebastian Meyer
 Linux Consultant & Trainer
 Mail: me...@b1-systems.de

 B1 Systems GmbH
 Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
 GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537

>>> --
>> 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/0012f2e5-b6b2-4b49-9e19-1d698605c598%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 


[image: --]

kunalsing thakur
[image: https://]about.me/kunalsingthakur


-- 
You received this message because you 

Re: [ansible-project] Re: \e[0m comapre this string in failed_when condition

2019-04-06 Thread Kunalsing Thakur
Hello Matt,
I was able to successfully do this task by following the instructions.
Thanks for matt to give some logic.

- name: searching the rpm into {{ reponame }} repo
  shell: pulp-admin rpm repo content rpm --repo-id={{reponame}} --match
'filename={{ item }}'
  loop: "{{ rpmname | default([]) }}"
  register: pulp
  when: search is defined
  failed_when: pulp.stdout == "\u001b[0m"

Result:-
TASK [mobi_ansible_role_pulp : searching the rpm into infra]
**
task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:5
Saturday 06 April 2019  10:07:15 + (0:00:02.298)   0:00:02.709

failed: [node]
(item=GoIP-devel-1.6.11-201711302323.798cb6f.el7.centos.x86_64.rpm) =>
changed=true
  cmd: pulp-admin rpm repo content rpm --repo-id=mobi-infra.smf1.mobitv
--match
'filename=GoIP-devel-1.6.11-201711302323.798cb6f.el7.centos.x86_64.rpm'
  delta: '0:00:00.781775'
  end: '2019-04-06 10:07:17.178794'
  failed_when_result: true
  item: GoIP-devel-1.6.11-201711302323.798cb6f.el7.centos.x86_64.rpm
  rc: 0
  start: '2019-04-06 10:07:16.397019'
  stderr: ''
  stderr_lines: []
  stdout: "\e[0m"
  stdout_lines: 


This issue is resolved now. :)


On Sat, Apr 6, 2019 at 3:28 PM Kunalsing Thakur 
wrote:

> Hello Matt,
>
>  i tried with task
>
> - name: searching the rpm into {{ reponame }} repo
>   shell: pulp-admin rpm repo content rpm --repo-id={{reponame}} --match
> 'filename={{ item }}'
>   with_items: "{{ rpmname | default([]) }}"
>   register: pulp
>   when: search is defined
>   failed_when: escape in pulp.results.[0].stdout
>   vars:
>escape: "\u001b[0m"
>
>
> But get jinja templating error as below:-
> TASK [mobi_ansible_role_pulp : searching the rpm into infra]
> **
> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:5
> Saturday 06 April 2019  09:55:41 + (0:00:02.011)   0:00:02.434
> 
> fatal: [node]: FAILED! =>
>   msg: 'The conditional check ''escape in pulp.results.[0].stdout''
> failed. The error was: template error while templating string: expected
> name or number. String: {% if escape in pulp.results.[0].stdout %} True {%
> else %} False {% endif %}'
>
> I tried use following syntax also:-
>
> - name: searching the rpm into {{ reponame }} repo
>   shell: pulp-admin rpm repo content rpm --repo-id={{reponame}} --match
> 'filename={{ item }}'
>   with_items: "{{ rpmname | default([]) }}"
>   register: pulp
>   when: search is defined
>   failed_when: 'escape in pulp.results.[0].stdout'
>   vars:
>escape: "\u001b[0m"
>
> TASK [mobi_ansible_role_pulp : searching the rpm into infra]
> **
> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:5
> Saturday 06 April 2019  09:56:37 + (0:00:02.166)   0:00:02.655
> 
> fatal: [node]: FAILED! =>
>   msg: 'The conditional check ''escape in pulp.results.[0].stdout''
> failed. The error was: template error while templating string: expected
> name or number. String: {% if escape in pulp.results.[0].stdout %} True {%
> else %} False {% endif %}'
>
> Any Help will be much appreciated..
>
>
>
> On Sat, Apr 6, 2019 at 1:16 AM Matt Martz  wrote:
>
>> You would need to convert that value from a shell escape sequence, to a
>> python escape sequence, for consumption by PyYAML.
>>
>> The easiest way to express this will likely be:
>>
>> - name: searching the rpm into pulp repo
>>   shell: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots --match
>> 'filename={{ item }}'
>>   with_items: "{{ rpmname | default([]) }}"
>>   register: pulp
>>   when: rpmsearch is defined
>>   failed_when: escape in pulp.results.[0].stdout
>>   vars:
>> escape: "\u001b[0m"
>>
>>
>> On Fri, Apr 5, 2019 at 1:12 PM Kunalsing Thakur 
>> wrote:
>>
>>> Gentle reminder, is anyone can help on this
>>>
>>> --
>>> 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/ba24777d-4e0d-4899-9c6a-419b866124a2%40googlegroups.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/CAD8N0v_TCdRSuRUZg%2BBR0LQEU%3Dc69XsExQd8gKHCGs_PP%3DLF%3DQ%40mail.gmail.com
>> 

Re: [ansible-project] Re: failed_when not working for empty sting output in task output

2019-04-06 Thread Kunalsing Thakur
Hi Brian,

I was able to successfully do this task by following the instructions.
Thanks for matt to give some logic.

- name: searching the rpm into {{ reponame }} repo
  shell: pulp-admin rpm repo content rpm --repo-id={{reponame}} --match
'filename={{ item }}'
  loop: "{{ rpmname | default([]) }}"
  register: pulp
  when: search is defined
  failed_when: pulp.stdout == "\u001b[0m"

Result:-
TASK [mobi_ansible_role_pulp : searching the rpm into infra]
**
task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:5
Saturday 06 April 2019  10:07:15 + (0:00:02.298)   0:00:02.709

failed: [node]
(item=GoIP-devel-1.6.11-201711302323.798cb6f.el7.centos.x86_64.rpm) =>
changed=true
  cmd: pulp-admin rpm repo content rpm --repo-id=mobi-infra.smf1.mobitv
--match
'filename=GoIP-devel-1.6.11-201711302323.798cb6f.el7.centos.x86_64.rpm'
  delta: '0:00:00.781775'
  end: '2019-04-06 10:07:17.178794'
  failed_when_result: true
  item: GoIP-devel-1.6.11-201711302323.798cb6f.el7.centos.x86_64.rpm
  rc: 0
  start: '2019-04-06 10:07:16.397019'
  stderr: ''
  stderr_lines: []
  stdout: "\e[0m"
  stdout_lines: 


This issue is resolved now. :)


On Fri, Apr 5, 2019 at 1:09 AM Brian Coca  wrote:

> ''pulp.results.[0].std" is incorrect you have extra .
> "pullp.results[0].std" is the correct form
>
> --
> --
> 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/CACVha7crqc5aH3pSvFUhHeMt6JG4GZfS2G6g-e6qwfVdWO7Z%2BA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 


[image: --]

kunalsing thakur
[image: https://]about.me/kunalsingthakur


-- 
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/CANErU6keHH6ct%2Bq81PESHJc%2BeB7cPW9wk8bDyNYH8b0Jz75qbg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: \e[0m comapre this string in failed_when condition

2019-04-06 Thread Kunalsing Thakur
Hello Matt,

 i tried with task

- name: searching the rpm into {{ reponame }} repo
  shell: pulp-admin rpm repo content rpm --repo-id={{reponame}} --match
'filename={{ item }}'
  with_items: "{{ rpmname | default([]) }}"
  register: pulp
  when: search is defined
  failed_when: escape in pulp.results.[0].stdout
  vars:
   escape: "\u001b[0m"


But get jinja templating error as below:-
TASK [mobi_ansible_role_pulp : searching the rpm into infra]
**
task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:5
Saturday 06 April 2019  09:55:41 + (0:00:02.011)   0:00:02.434

fatal: [node]: FAILED! =>
  msg: 'The conditional check ''escape in pulp.results.[0].stdout'' failed.
The error was: template error while templating string: expected name or
number. String: {% if escape in pulp.results.[0].stdout %} True {% else %}
False {% endif %}'

I tried use following syntax also:-

- name: searching the rpm into {{ reponame }} repo
  shell: pulp-admin rpm repo content rpm --repo-id={{reponame}} --match
'filename={{ item }}'
  with_items: "{{ rpmname | default([]) }}"
  register: pulp
  when: search is defined
  failed_when: 'escape in pulp.results.[0].stdout'
  vars:
   escape: "\u001b[0m"

TASK [mobi_ansible_role_pulp : searching the rpm into infra]
**
task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:5
Saturday 06 April 2019  09:56:37 + (0:00:02.166)   0:00:02.655

fatal: [node]: FAILED! =>
  msg: 'The conditional check ''escape in pulp.results.[0].stdout'' failed.
The error was: template error while templating string: expected name or
number. String: {% if escape in pulp.results.[0].stdout %} True {% else %}
False {% endif %}'

Any Help will be much appreciated..



On Sat, Apr 6, 2019 at 1:16 AM Matt Martz  wrote:

> You would need to convert that value from a shell escape sequence, to a
> python escape sequence, for consumption by PyYAML.
>
> The easiest way to express this will likely be:
>
> - name: searching the rpm into pulp repo
>   shell: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots --match
> 'filename={{ item }}'
>   with_items: "{{ rpmname | default([]) }}"
>   register: pulp
>   when: rpmsearch is defined
>   failed_when: escape in pulp.results.[0].stdout
>   vars:
> escape: "\u001b[0m"
>
>
> On Fri, Apr 5, 2019 at 1:12 PM Kunalsing Thakur 
> wrote:
>
>> Gentle reminder, is anyone can help on this
>>
>> --
>> 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/ba24777d-4e0d-4899-9c6a-419b866124a2%40googlegroups.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/CAD8N0v_TCdRSuRUZg%2BBR0LQEU%3Dc69XsExQd8gKHCGs_PP%3DLF%3DQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 


[image: --]

kunalsing thakur
[image: https://]about.me/kunalsingthakur


-- 
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/CANErU6kPQ9YqC29iYkBzkTSFQPjAvfqZYLr0eQOAB1ixwxzxfg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ssh transport and windows

2019-04-06 Thread sergey . mihailov
Hello.

I am aware of the support for SSH in Windows 2019 and Windows 10.
I installed the OpenSSH in Windows 8.1 and tried to enter it. All is well.
But if you turn on ssh transport in ansable, then nothing works :(

1. I have not done something in Windows 8.1 and it works in Windows 2019 
and Windows 10?
2. Or ansibla does not support work in Windows through SSH at all?

thank

P.S. I am using the ansible version : 2.7.9

-- 
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/02c5c3d0-1d4e-4d06-8c60-85b631de8d43%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.