Re: [ansible-project] var for --ask-pass ?

2019-04-03 Thread sergey . mihailov
its for windows.

Those are not possible to take one variable from the command line and I 
will have to type the same password twice?

четверг, 4 апреля 2019 г., 10:36:58 UTC+4 пользователь Raghavendra Rao 
написал:
>
> On Thu, 4 Apr 2019 at 11:49, > wrote:
>
>> I start playbook : ansible-playbook win_install_ascon.yml --ask-pass
>>
>> define in playbook:
>> ...
>> ansible_become_pass: "{{ remote_pass }}"
>> ...
>>
>> OUT:
>> ...
>>  FAILED! => {"msg": "The field 'become_pass' has an invalid value, which 
>> includes an undefined variable. The error was: 'remote_pass' is undefined"}
>> ...
>>
>> What variable is the password in?
>>
>> I do not want to enter the password twice when: ansible-playbook 
>> win_install_ascon.yml --ask-pass --ask-become-pass
>> I do not want to use ansible-vault
>>
>
> This has nothing to do with ansible vault unless you have vault protected 
> files included in your playbook.
>
> --ask-pass is used for providing a connection password. i.e a way in which 
> the ansible control node talks to the remote systems
> --ask-become-pass is used for providing a pasword for the become_method. 
> for e.g a password for sudo or su
>
> If you don't have passwordless sudo or su set + do not have SSH keys 
> setup, you have to use both of them in a command.
>
> Refer: 
> https://docs.ansible.com/ansible/latest/user_guide/intro_getting_started.html
>
> -R.Rao
>
>>
>> Thank.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ansible...@googlegroups.com .
>> To 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/10cfdd08-a0ed-4627-82b3-998005f23d46%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/4e8eabd1-a845-4192-81d0-1b52c3f2fc4e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] purestorage sdk missing

2019-04-03 Thread Raghavendra Rao
Make sure you have the respective purestorage python library.

Also, set PUREFA_URL and PUREFA_API environment variables if *url* and
*api_token* arguments are not passed to the module directly.

-R.Rao

On Thu, 4 Apr 2019 at 10:05, Lucas Possamai  wrote:

> Hi guys.
>
> When calling a playbook I get the following error:
> FAILED! => {"changed": false, "msg": "purestorage sdk is required for this
> module in volume"}
>
> Purestorage sdk is installed in my laptop (i'm running that locally):
> purestorage (1.16.0)
>
> ansible 2.7.9
>   config file = /etc/ansible/ansible.cfg
>   configured module search path =
> [u'/home/lucas/.ansible/plugins/modules',
> u'/usr/share/ansible/plugins/modules']
>   ansible python module location =
> /home/lucas/.local/lib/python2.7/site-packages/ansible
>   executable location = /usr/bin/ansible
>   python version = 2.7.15+ (default, Oct  2 2018, 22:12:08) [GCC 8.2.0]
>
> What could that error be for?
> 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_gQfUdPurAMF9Q4mpProD4BeGjDbaJ5tSqwqXekUMAC%2Bf4Dg%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/CAKbF63gDBN6YANcqVv%2BZKv%2BS7jprT2wy9V1qkZPRMi3pQ3d0xA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-04-03 Thread Kunalsing Thakur
is there any example which i refer like this to get sorted out?

On Thu, Apr 4, 2019 at 11:55 AM Kunalsing Thakur 
wrote:

> Hi Brian,
> I have registered results. i am able to access the content using
> pulp.results.[0].stdout. if nothing is found stdout prints this "\e[0m".
> And i want to compare this string to failed the task using failed_when
> condition.
> but somehow it gives me below error.
> fatal: [pulp]: FAILED! =>
>   msg: 'The conditional check ''pulp.results.[0].stdout == "\e[0m"''
> failed. The error was: template error while templating string: expected
> name or number. String: {% if pulp.results.[0].stdout == "\e[0m" %} True {%
> else %} False {% endif %}'
>
>
> Playbook:-
> ---
> - name: Deploying PCC-test
>   hosts: pulp
>   gather_facts: true
>   vars_files:
> - /etc/ansible/inventories/mobitv/group_vars/common.yaml
>   vars:
> - rpmsearch: true
> - rpmname:
> - mobi-auth-manager-5.42.0-2019h
>   serial: 1
>   any_errors_fatal: true
>   roles:
> - role: mobi_ansible_role_pulp
>
> role-task:-
> ---
> - 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
>   failed_when: pulp.results.[0].stdout == "\e[0m"
> - debug:
> var: pulp.results.0.stdout
>
> Results:-
> PLAY [Deploying PCC-test]
> ***
>
> TASK [Gathering Facts]
> **
> task path: /etc/ansible/playbooks/paytv/pulp.yaml:2
> Thursday 04 April 2019  06:24:44 + (0:00:00.139)   0:00:00.139
> 
> ok: [pulp]
> META: ran handlers
>
> TASK [mobi_ansible_role_pulp : include_tasks]
> ***
> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/main.yml:12
> Thursday 04 April 2019  06:24:48 + (0:00:03.441)   0:00:03.580
> 
> included: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml for
> pulp
>
> TASK [mobi_ansible_role_pulp : Logging into pulp]
> ***
> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:2
> Thursday 04 April 2019  06:24:48 + (0:00:00.485)   0:00:04.066
> 
> changed: [pulp] => changed=true
>   cmd: pulp-admin login -u admin -p admin
>   delta: '0:00:01.067098'
>   end: '2019-04-04 06:24:50.812519'
>   rc: 0
>   start: '2019-04-04 06:24:49.745421'
>   stderr: ''
>   stderr_lines: []
>   stdout: |-
> [0m[92mSuccessfully logged in. Session certificate will expire at Apr
> 11 06:24:50 2019
> GMT.[0m
>   stdout_lines: 
>
> TASK [mobi_ansible_role_pulp : searching the rpm into pulp repo]
> 
> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:4
> Thursday 04 April 2019  06:24:50 + (0:00:02.175)   0:00:06.241
> 
> fatal: [pulp]: FAILED! =>
>   msg: 'The conditional check ''pulp.results.[0].stdout == "\e[0m"''
> failed. The error was: template error while templating string: expected
> name or number. String: {% if pulp.results.[0].stdout == "\e[0m" %} True {%
> else %} False {% endif %}'
>
> NO MORE HOSTS LEFT
> **
> to retry, use: --limit @/etc/ansible/playbooks/paytv/pulp.retry
>
> PLAY RECAP
> **
> pulp : ok=3changed=1unreachable=0failed=1
>
>
>
> Any help will be much appreciated.
>
>
> On Thu, Apr 4, 2019 at 1:13 AM Brian Coca  wrote:
>
>> results only exists if you registered in a loop
>>
>> --
>> --
>> 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/CACVha7ec-JCvmHLeMW%2BAjFUWqu4J9bnP6-uMh0oD5e-vU8k8iA%40mail.gmail.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
>
>
> [image: --]
>
> kunalsing thakur
> [image: https://]about.me/kunalsingthakur
>
> 
>


-- 


[image: --]

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


--

Re: [ansible-project] var for --ask-pass ?

2019-04-03 Thread Raghavendra Rao
On Thu, 4 Apr 2019 at 11:49,  wrote:

> I start playbook : ansible-playbook win_install_ascon.yml --ask-pass
>
> define in playbook:
> ...
> ansible_become_pass: "{{ remote_pass }}"
> ...
>
> OUT:
> ...
>  FAILED! => {"msg": "The field 'become_pass' has an invalid value, which
> includes an undefined variable. The error was: 'remote_pass' is undefined"}
> ...
>
> What variable is the password in?
>
> I do not want to enter the password twice when: ansible-playbook
> win_install_ascon.yml --ask-pass --ask-become-pass
> I do not want to use ansible-vault
>

This has nothing to do with ansible vault unless you have vault protected
files included in your playbook.

--ask-pass is used for providing a connection password. i.e a way in which
the ansible control node talks to the remote systems
--ask-become-pass is used for providing a pasword for the become_method.
for e.g a password for sudo or su

If you don't have passwordless sudo or su set + do not have SSH keys setup,
you have to use both of them in a command.

Refer:
https://docs.ansible.com/ansible/latest/user_guide/intro_getting_started.html

-R.Rao

>
> Thank.
>
> --
> 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/10cfdd08-a0ed-4627-82b3-998005f23d46%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/CAKbF63hzJ6KmRLNe08BjFXo87qJxv%3DkPyJajdR3CN7-O6fS0wQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-04-03 Thread Kunalsing Thakur
Hi Brian,
I have registered results. i am able to access the content using
pulp.results.[0].stdout. if nothing is found stdout prints this "\e[0m".
And i want to compare this string to failed the task using failed_when
condition.
but somehow it gives me below error.
fatal: [pulp]: FAILED! =>
  msg: 'The conditional check ''pulp.results.[0].stdout == "\e[0m"''
failed. The error was: template error while templating string: expected
name or number. String: {% if pulp.results.[0].stdout == "\e[0m" %} True {%
else %} False {% endif %}'


Playbook:-
---
- name: Deploying PCC-test
  hosts: pulp
  gather_facts: true
  vars_files:
- /etc/ansible/inventories/mobitv/group_vars/common.yaml
  vars:
- rpmsearch: true
- rpmname:
- mobi-auth-manager-5.42.0-2019h
  serial: 1
  any_errors_fatal: true
  roles:
- role: mobi_ansible_role_pulp

role-task:-
---
- 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
  failed_when: pulp.results.[0].stdout == "\e[0m"
- debug:
var: pulp.results.0.stdout

Results:-
PLAY [Deploying PCC-test]
***

TASK [Gathering Facts]
**
task path: /etc/ansible/playbooks/paytv/pulp.yaml:2
Thursday 04 April 2019  06:24:44 + (0:00:00.139)   0:00:00.139

ok: [pulp]
META: ran handlers

TASK [mobi_ansible_role_pulp : include_tasks]
***
task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/main.yml:12
Thursday 04 April 2019  06:24:48 + (0:00:03.441)   0:00:03.580

included: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml for pulp

TASK [mobi_ansible_role_pulp : Logging into pulp]
***
task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:2
Thursday 04 April 2019  06:24:48 + (0:00:00.485)   0:00:04.066

changed: [pulp] => changed=true
  cmd: pulp-admin login -u admin -p admin
  delta: '0:00:01.067098'
  end: '2019-04-04 06:24:50.812519'
  rc: 0
  start: '2019-04-04 06:24:49.745421'
  stderr: ''
  stderr_lines: []
  stdout: |-
[0m[92mSuccessfully logged in. Session certificate will expire at Apr
11 06:24:50 2019
GMT.[0m
  stdout_lines: 

TASK [mobi_ansible_role_pulp : searching the rpm into pulp repo]

task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:4
Thursday 04 April 2019  06:24:50 + (0:00:02.175)   0:00:06.241

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

NO MORE HOSTS LEFT
**
to retry, use: --limit @/etc/ansible/playbooks/paytv/pulp.retry

PLAY RECAP
**
pulp : ok=3changed=1unreachable=0failed=1



Any help will be much appreciated.


On Thu, Apr 4, 2019 at 1:13 AM Brian Coca  wrote:

> results only exists if you registered in a loop
>
> --
> --
> 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/CACVha7ec-JCvmHLeMW%2BAjFUWqu4J9bnP6-uMh0oD5e-vU8k8iA%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/CANErU6n1oemLSYCJTKvpVJNGwJ8FwG5%3DGtZVZZM4Da-wYawz2w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] var for --ask-pass ?

2019-04-03 Thread sergey . mihailov
I start playbook : ansible-playbook win_install_ascon.yml --ask-pass

define in playbook:
...
ansible_become_pass: "{{ remote_pass }}"
...

OUT:
...
 FAILED! => {"msg": "The field 'become_pass' has an invalid value, which 
includes an undefined variable. The error was: 'remote_pass' is undefined"}
...

What variable is the password in?

I do not want to enter the password twice when: ansible-playbook 
win_install_ascon.yml --ask-pass --ask-become-pass
I do not want to use ansible-vault

Thank.

-- 
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/10cfdd08-a0ed-4627-82b3-998005f23d46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] purestorage sdk missing

2019-04-03 Thread Lucas Possamai
Hi guys.

When calling a playbook I get the following error:
FAILED! => {"changed": false, "msg": "purestorage sdk is required for this
module in volume"}

Purestorage sdk is installed in my laptop (i'm running that locally):
purestorage (1.16.0)

ansible 2.7.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/lucas/.ansible/plugins/modules',
u'/usr/share/ansible/plugins/modules']
  ansible python module location =
/home/lucas/.local/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.15+ (default, Oct  2 2018, 22:12:08) [GCC 8.2.0]

What could that error be for?
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_gQfUdPurAMF9Q4mpProD4BeGjDbaJ5tSqwqXekUMAC%2Bf4Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] list containing any item of another list

2019-04-03 Thread Adam E
Hi, wondering if there is any cleaner way to see if two lists have 1 or 
more intersecting values?

the following works for me

# returns true
> {{ ['value1', 'value2'] | intersect(['value1', 'value2']) | length > 0 }}
> # returns false
> {{ ['value3', 'value4'] | intersect(['value1', 'value2']) | length > 0 }}


just wondering if there is a cleaner looking solution that I am not aware 
of as I am using it frequently.  
something like would be handy. 

> {{ ['value1', 'value2].any(['value1', 'value2']) }}

-- 
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/ac91665d-1ad3-4099-84df-e6b5513e16b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible with gpg-agent prompts for private key password constantly

2019-04-03 Thread Derek Murawsky
What does your ~/.gnupg/gpg-agent.conf file?
https://www.gnupg.org/documentation/manuals/gnupg/Agent-Options.html

It sounds almost like your auth socket isn't working properly. Meaning the
agent is being restarted and is readding the key instead of using the key
loaded in the agent once.

On Wed, Apr 3, 2019 at 5:32 PM Brian Coca  wrote:

> Ansible does not deal with those, it executes an ssh command,  use
> -vvv to see exactly the ssh command Ansible runs and see if any of
> those options need to be tweaked to allow for the gpg agent to
> continue working.
>
>
> --
> --
> 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/CACVha7fAUtZQ5xxXCUqmJxw063jNGTC9a-LkfRjmCzc%3DRc2L-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/CAMieHs%3DUA%2BW2HNWJv3eYH2uByC3QYopwfkC2rw%3Dtt6k03-%2BumA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ansible concatenate variables

2019-04-03 Thread Brian Coca
Variables are lazy loaded so :

vars:
  x: '{{ x + [1] }}'

will not work since the value of x is not known before you try to use
x creating a self referential loop.

But you can get around it with `set_fact` as we evaluate variables at
the time of module execution and set_fact is a module that sets a new
variable:

set_fact:
x : '{{ x + [1] }}'

this defines a 'new x' that is the 'old x + [1]' (add a list with the
number 1 as an element, assumes x is already a list, you might use
|default([]) if you are not assured x was previously defined


--
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/CACVha7d%3DdaR55qZJo1Cs--GbnxK8w4L4%2B%2BOsXiV_vgTzK0t3%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible with gpg-agent prompts for private key password constantly

2019-04-03 Thread Brian Coca
Ansible does not deal with those, it executes an ssh command,  use
-vvv to see exactly the ssh command Ansible runs and see if any of
those options need to be tweaked to allow for the gpg agent to
continue working.


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


[ansible-project] Ansible with gpg-agent prompts for private key password constantly

2019-04-03 Thread Mark Clarke
Hi all,

We are using gpg-agent to provide ssh-agent functionality for the caching 
the private key passphrases. Some of the keys will be stored in the gpg 
keyring whilst some services such as ansible uses a standard ssh key. Our 
ansible scripts run without problems with the standard ssh-agent. When the 
$SSH_AUTH_SOCK variable is pointer to the gpg-agent ssh socket the script 
continually prompts for the pass phrase and it always comes back as 
invalid. Is this some config issue I need to sort out? "ssh-add -L" show 
keys from the gpg and standard ssh keys (ansible's one too) are cached so 
not sure why we getting the repeated prompts

Any ideas?.

cheers

-- 
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/f5989fdc-bcd4-4073-9586-19a3458b3537%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] connection caching throughout a play

2019-04-03 Thread Brian Coca
Currently there is no way to do this, but it is something we have been
thinking about for a while now as a feature.

Just don't expect it anytime soon, as it is a complex ask, specially
if you consider modules are not guaranteed to execute on the same
machine.


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


Re: [ansible-project] How to write an Ansible Module that does not do the initial check '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''

2019-04-03 Thread Brian Coca
See the networking modules, specially those using network_cli as
networking appliances have the same issue, ssh access but no real
'shell' environment.

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


Re: [ansible-project] more freedom and options for `run_once`

2019-04-03 Thread Brian Coca
I've really regretted the naming of this feature, its really
`run_on_first_active_host_in_play_execution_apply_facts_and_register_to_all`
, I don't think we can change the current nature of run_once from
boolean to string choices, but I am in favor of a new option that does
a better job of specifying conditions.

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


Re: [ansible-project] workaround for serial: 1 failures stopping the entire playbook?

2019-04-03 Thread Brian Coca
there are several ways, the simplest might be putting the whole thing
in a 'block' with a 'rescue' that always succeeds so it will go to the
next host.



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


Re: [ansible-project] Re: How to copy directory from remote machine to ansible machine

2019-04-03 Thread Brian Coca
https://docs.ansible.com/ansible/latest/modules/synchronize_module.html
see 'mode' specifically the 'pull' value

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


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

2019-04-03 Thread Brian Coca
results only exists if you registered in a loop

-- 
--
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/CACVha7ec-JCvmHLeMW%2BAjFUWqu4J9bnP6-uMh0oD5e-vU8k8iA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Ansible unable to except any other body format except raw and jason in the uri module and upload a zip or a jar via POST method

2019-04-03 Thread Dick Visser
What does your task look like?
Also, the original report is against 2.4.2 which by now is almost 1.5 years
old, and the uri module has since seen a lot of changes.
What version do you run?

Dick

On Wed, 3 Apr 2019 at 15:31, Fabio Martins  wrote:

> I am facing exactly the same issue when trying to upload a jar file over a 
> Flink
> REST endpoint
> 
> .
>
> I tried both with curl and postman, it works flawlessly, but using Ansible
> URI module, I am getting the error message:  FAILED! => {"changed": false,
> "content": "", "msg": "Status code was -1 and not [200]: Request failed:
> ", "redirected": false,
> "status": -1, "url": "http://:8081/jars/upload}
>
> Any idea, or should I continue using the shell module with curl (I don't
> like it, but it's the only way it works for now).
>
>
> On Monday, May 21, 2018 at 8:05:47 PM UTC+2, Apu Mondal wrote:
>>
>> Zip file not getting POST to the server with the uri module in Ansible.
>>
>> These are the codes I am trying to execute
>>
>>- name: Transfering the Proxies
>>uri:
>>headers:
>>Authorization: '{{API_USER_PASS_BASE64_ENCRYPT}}'
>>Content-Type: "application/octet-stream"
>>url:
>>
>> https://api.enterprise.apigee.com/v1/organizations/{{API_ORG}}/apis?action=import&name={{proxy_name
>>}}-{{API_ENVIRONMENT}}
>>#body: "{{ lookup('file','{{ path
>>
>> }}/{{bundle_name}}/apigee/proxies/{{proxy_name}}--hughes-dev-test-dev.zip')
>>}}" --> doesn't work
>>src: /{{ path
>>}}/{{bundle_name}}/apigee/proxies/{{proxy_name}}--hughes-dev-test-dev.zip
>>body_format: raw
>>status_code: 201, 200
>>method: POST
>>register: version
>>
>> It gives the following error:
>> "json": {
>> "code": "messaging.config.beans.InvalidBundle",
>> "contexts": [],
>> "message": "Bundle is invalid. Empty bundle"
>> },
>>
>> Also it sets the "content_type": "application/json", at the top of the
>> message like this:
>>
>> The full traceback is:
>> File "/tmp/ansible_NyKoMf/ansible_module_uri.py", line 468, in main
>> uresp['location'] = absolute_location(url, uresp['location'])
>>
>> fatal: [localhost]: FAILED! => {
>> "changed": false,
>> "connection": "Close",
>> "content": "{\n "code" : "messaging.config.beans.InvalidBundle",\n
>> "message" : "Bundle is invalid. Empty bundle",\n "contexts" : [ ]\n}",
>> "content_length": "122",
>> "content_type": "application/json",
>> "date": "Mon, 14 May 2018 19:03:48 GMT",
>> "invocation": {
>> "module_args": {
>> "attributes": null,
>> "backup": null,
>> "body": null,
>> "body_format": "raw",
>> "client_cert": null,
>> "client_key": null,
>> "content": null,
>> "creates": null,
>> "delimiter": null,
>> "dest": null,
>> "directory_mode": null,
>> "follow": false,
>> "follow_redirects": "safe",
>> "force": false,
>> "force_basic_auth": false,
>> "group": null,
>> "headers": {
>> "Authorization": "Basic YXBvb3J2YS5tb25kYWxAaHVnaGVzLmNvbTphcG9vcnZhNw==",
>> "Content-Type": "application/octet-stream"
>> },
>> "http_agent": "ansible-httpget",
>> "method": "POST",
>> "mode": null,
>> "owner": null,
>> "regexp": null,
>> "remote_src": null,
>> "removes": null,
>> "return_content": false,
>> "selevel": null,
>> "serole": null,
>> "setype": null,
>> "seuser": null,
>> "src":
>> "/var/tmp/APIGEE_COM_R001_B-001_P-001/apigee/proxies/FapProxy--hughes-dev-test-dev.zip",
>> "status_code": [
>> "201",
>> " 200"
>> ],
>> "timeout": 30,
>> "unsafe_writes": null,
>> "url": "
>> https://api.enterprise.apigee.com/v1/organizations/hughes-dev/apis?action=import&name=FapProxy-sa-dev
>> ",
>> "url_password": null,
>> "url_username": null,
>> "use_proxy": true,
>> "validate_certs": true
>> }
>> },
>> "json": {
>> "code": "messaging.config.beans.InvalidBundle",
>> "contexts": [],
>> "message": "Bundle is invalid. Empty bundle"
>> },
>> "msg": "Status code was not [201, 200]: HTTP Error 400: Bad Request",
>> "redirected": false,
>> "server": "Apigee LB",
>> "status": 400,
>> "url": "
>> https://api.enterprise.apigee.com/v1/organizations/hughes-dev/apis?action=import&name=FapProxy-sa-dev
>> "
>> }
>>
>>
>> 2) - name: Transfering the Proxies
>>
>>   uri:
>> headers:
>>  Authorization: '{{API_USER_PASS_BASE64_ENCRYPT}}'
>>  Content-Type: "application/zip"
>> url: 
>> https://api.enterprise.apigee.com/v1/organizations/{{API_ORG}}/apis?action=import&name={{
>>  proxy_name }}-{{API_ENVIRONMENT}}
>> body: "{{ lookup('file','{{ path 
>> }}/{{bundle_name}}/apigee/proxies/{{proxy_name}}--hughes-dev-test-dev.zip') 
>> }}"
>> #src: '{{ path 
>> }}/{{bundle_name}}/apigee/proxies/{{proxy_name}}--hughes-dev-test-dev.zip'
>> #body_format: raw
>> status_code: 201, 200
>> method: POST
>>   register: version
>>
>>
>> Please check and provide information on how to properly POST a zip file.
>> ISSUE TYPE
>>
>>- Bug Report
>>- Feature Idea
>>- Documentation Report
>>
>> COMPONENT NAME
>>
>> URI Modu

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

2019-04-03 Thread Kunalsing Thakur
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  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.
>

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


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

2019-04-03 Thread Kunalsing Thakur
Yes ,

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'''

On Wed, 3 Apr 2019, 20:46 Raghavendra Rao  I see you used debug to get a verbose out from that specific command.
>
> Does that list stdout as one of the return values?
>
> -R.Rao
>
> On Wed, 3 Apr 2019 at 20:12, Kunalsing Thakur 
> wrote:
>
>> Hi Rao,
>> when i check with this condition
>>   failed_when: pulp.results.0.stdout == "\e[0m"
>> it gives me following error
>>
>> 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 7:57:21 PM UTC+5:30, Raghavendra Rao wrote:
>>>
>>> Hmmm... it should fail as the string is matched
>>>
>>> What happens when you do this instead?:
>>>
>>> - name: searching the rpm into pulp repo
>>>   command: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots
>>> --match 'filename={{ item }}'
>>>   loop: "{{ rpmname | default([]) }}"
>>>   register: pulpresult
>>>   when: rpmsearch is defined
>>>   ignore_errors: yes
>>>
>>> - name: invoke failure
>>>   fail:
>>>   when: pulpresult.stdout == "\e[0m"
>>>
>>> -R.Rao
>>>
>>> On Wed, 3 Apr 2019 at 19:24, Kunalsing Thakur 
>>> wrote:
>>>
 Can anyone help on this?


 On Wednesday, April 3, 2019 at 7:15:25 PM UTC+5:30, Kunalsing Thakur
 wrote:
>
> playbook:-
> ---
> - name: Deploying PCC-test
>   hosts: inplp01p2.infra.smf1.mobitv
>   gather_facts: true
>   vars_files:
> -
> /etc/ansible/inventories/mobitv/paytv.smf1.mobitv/group_vars/common.yaml
>   vars:
> - rpmsearch: true
> - rpmname:
> - kunal
>   serial: 1
>   any_errors_fatal: true
>   roles:
> - role: mobi_ansible_role_pulp
>
>
>
> role task:-
> pulp.yaml
> ---
> - name: Logging into pulp
>   command: pulp-admin login -u admin -p admin
> - name: searching the rpm into pulp repo
>   command: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots
> --match 'filename={{ item }}'
>   loop: "{{ rpmname | default([]) }}"
>   register: pulpresult
>   when: rpmsearch is defined
>   failed_when: pulpresult.stdout == "\e[0m"
>
>
> Ansible Output:-
> PLAY [Deploying PCC-test]
> 
>
> TASK [Gathering Facts]
> ***
> task path: /etc/ansible/playbooks/paytv/pulp.yaml:2
> Wednesday 03 April 2019  13:44:13 + (0:00:00.138)
> 0:00:00.138 ***
> ok: [inplp01p2.infra.smf1.mobitv]
> META: ran handlers
>
> TASK [mobi_ansible_role_pulp : include_tasks]
> 
> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/main.yml:12
> Wednesday 03 April 2019  13:44:17 + (0:00:04.113)
> 0:00:04.252 ***
> included: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml
> for inplp01p2.infra.smf1.mobitv
>
> TASK [mobi_ansible_role_pulp : Logging into pulp]
> 
> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:2
> Wednesday 03 April 2019  13:44:18 + (0:00:00.452)
> 0:00:04.705 ***
> changed: [pulpnode] => changed=true
>   cmd:
>   - pulp-admin
>   - login
>   - -u
>   - admin
>   - -p
>   - admin
>   delta: '0:00:01.103429'
>   end: '2019-04-03 13:44:20.453693'
>   rc: 0
>   start: '2019-04-03 13:44:19.350264'
>   stderr: ''
>   stderr_lines: []
>   stdout: |-
> [0m[92mSuccessfully logged in. Session certificate will expire at
> Apr 10 13:44:20 2019
> GMT.[0m
>   stdout_lines: 
>
> 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  13:44:20 + (0:00:02.181)
> 0:00:06.887 ***
> changed: [pulpnode] => (item=kunal) =>

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

2019-04-03 Thread Raghavendra Rao
I see you used debug to get a verbose out from that specific command.

Does that list stdout as one of the return values?

-R.Rao

On Wed, 3 Apr 2019 at 20:12, Kunalsing Thakur 
wrote:

> Hi Rao,
> when i check with this condition
>   failed_when: pulp.results.0.stdout == "\e[0m"
> it gives me following error
>
> 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 7:57:21 PM UTC+5:30, Raghavendra Rao wrote:
>>
>> Hmmm... it should fail as the string is matched
>>
>> What happens when you do this instead?:
>>
>> - name: searching the rpm into pulp repo
>>   command: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots
>> --match 'filename={{ item }}'
>>   loop: "{{ rpmname | default([]) }}"
>>   register: pulpresult
>>   when: rpmsearch is defined
>>   ignore_errors: yes
>>
>> - name: invoke failure
>>   fail:
>>   when: pulpresult.stdout == "\e[0m"
>>
>> -R.Rao
>>
>> On Wed, 3 Apr 2019 at 19:24, Kunalsing Thakur 
>> wrote:
>>
>>> Can anyone help on this?
>>>
>>>
>>> On Wednesday, April 3, 2019 at 7:15:25 PM UTC+5:30, Kunalsing Thakur
>>> wrote:

 playbook:-
 ---
 - name: Deploying PCC-test
   hosts: inplp01p2.infra.smf1.mobitv
   gather_facts: true
   vars_files:
 -
 /etc/ansible/inventories/mobitv/paytv.smf1.mobitv/group_vars/common.yaml
   vars:
 - rpmsearch: true
 - rpmname:
 - kunal
   serial: 1
   any_errors_fatal: true
   roles:
 - role: mobi_ansible_role_pulp



 role task:-
 pulp.yaml
 ---
 - name: Logging into pulp
   command: pulp-admin login -u admin -p admin
 - name: searching the rpm into pulp repo
   command: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots
 --match 'filename={{ item }}'
   loop: "{{ rpmname | default([]) }}"
   register: pulpresult
   when: rpmsearch is defined
   failed_when: pulpresult.stdout == "\e[0m"


 Ansible Output:-
 PLAY [Deploying PCC-test]
 

 TASK [Gathering Facts]
 ***
 task path: /etc/ansible/playbooks/paytv/pulp.yaml:2
 Wednesday 03 April 2019  13:44:13 + (0:00:00.138)   0:00:00.138
 ***
 ok: [inplp01p2.infra.smf1.mobitv]
 META: ran handlers

 TASK [mobi_ansible_role_pulp : include_tasks]
 
 task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/main.yml:12
 Wednesday 03 April 2019  13:44:17 + (0:00:04.113)   0:00:04.252
 ***
 included: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml for
 inplp01p2.infra.smf1.mobitv

 TASK [mobi_ansible_role_pulp : Logging into pulp]
 
 task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:2
 Wednesday 03 April 2019  13:44:18 + (0:00:00.452)   0:00:04.705
 ***
 changed: [pulpnode] => changed=true
   cmd:
   - pulp-admin
   - login
   - -u
   - admin
   - -p
   - admin
   delta: '0:00:01.103429'
   end: '2019-04-03 13:44:20.453693'
   rc: 0
   start: '2019-04-03 13:44:19.350264'
   stderr: ''
   stderr_lines: []
   stdout: |-
 [0m[92mSuccessfully logged in. Session certificate will expire at
 Apr 10 13:44:20 2019
 GMT.[0m
   stdout_lines: 

 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  13:44:20 + (0:00:02.181)   0:00:06.887
 ***
 changed: [pulpnode] => (item=kunal) => changed=true
   cmd:
   - pulp-admin
   - rpm
   - repo
   - content
   - rpm
   - --repo-id=mobi-snapshots
   - --match
   - filename=kunal
   delta: '0:00:01.359062'
   end: '2019-04-03 13:44:22.679585'
   failed_when_result: false
   item: kunal
   rc: 0
   start: '2019-04-03 13:44:21.320523'
   stderr: ''
   stderr_lines: []
   stdout: "\e[0m"
   stdout_lines: 
 META: ran handlers
 META: ran handlers

 PLAY RECAP
 **

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

2019-04-03 Thread Sebastian Meyer
On 03.04.19 16:44, 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'''

While you are in the loop you should be able to use just pulp.stdout,
only afterwards the results are merged.

Sebastian

> 
> 
> 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 
>>
> 

-- 
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/0749a574-c80b-a765-72c9-928842320e95%40b1-systems.de.
For more options, visit https://groups.google.com/d/optout.


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

2019-04-03 Thread Kunalsing Thakur
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.


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

2019-04-03 Thread Kunalsing Thakur
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/9eeb9ab0-5574-4b62-94b5-efa27885946a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-04-03 Thread Kunalsing Thakur
Hi Rao,
when i check with this condition
  failed_when: pulp.results.0.stdout == "\e[0m"
it gives me following error 

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 7:57:21 PM UTC+5:30, Raghavendra Rao wrote:
>
> Hmmm... it should fail as the string is matched
>
> What happens when you do this instead?:
>
> - name: searching the rpm into pulp repo
>   command: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots 
> --match 'filename={{ item }}'
>   loop: "{{ rpmname | default([]) }}"
>   register: pulpresult
>   when: rpmsearch is defined
>   ignore_errors: yes
>
> - name: invoke failure
>   fail:
>   when: pulpresult.stdout == "\e[0m"
>
> -R.Rao
>
> On Wed, 3 Apr 2019 at 19:24, Kunalsing Thakur  > wrote:
>
>> Can anyone help on this?
>>
>>
>> On Wednesday, April 3, 2019 at 7:15:25 PM UTC+5:30, Kunalsing Thakur 
>> wrote:
>>>
>>> playbook:-
>>> ---
>>> - name: Deploying PCC-test
>>>   hosts: inplp01p2.infra.smf1.mobitv
>>>   gather_facts: true
>>>   vars_files:
>>> - 
>>> /etc/ansible/inventories/mobitv/paytv.smf1.mobitv/group_vars/common.yaml
>>>   vars:
>>> - rpmsearch: true
>>> - rpmname:
>>> - kunal
>>>   serial: 1
>>>   any_errors_fatal: true
>>>   roles:
>>> - role: mobi_ansible_role_pulp
>>>
>>>
>>>
>>> role task:-
>>> pulp.yaml
>>> ---
>>> - name: Logging into pulp
>>>   command: pulp-admin login -u admin -p admin
>>> - name: searching the rpm into pulp repo
>>>   command: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots 
>>> --match 'filename={{ item }}'
>>>   loop: "{{ rpmname | default([]) }}"
>>>   register: pulpresult
>>>   when: rpmsearch is defined
>>>   failed_when: pulpresult.stdout == "\e[0m"
>>>
>>>
>>> Ansible Output:-
>>> PLAY [Deploying PCC-test] 
>>> 
>>>
>>> TASK [Gathering Facts] 
>>> ***
>>> task path: /etc/ansible/playbooks/paytv/pulp.yaml:2
>>> Wednesday 03 April 2019  13:44:13 + (0:00:00.138)   0:00:00.138 
>>> ***
>>> ok: [inplp01p2.infra.smf1.mobitv]
>>> META: ran handlers
>>>
>>> TASK [mobi_ansible_role_pulp : include_tasks] 
>>> 
>>> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/main.yml:12
>>> Wednesday 03 April 2019  13:44:17 + (0:00:04.113)   0:00:04.252 
>>> ***
>>> included: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml for 
>>> inplp01p2.infra.smf1.mobitv
>>>
>>> TASK [mobi_ansible_role_pulp : Logging into pulp] 
>>> 
>>> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:2
>>> Wednesday 03 April 2019  13:44:18 + (0:00:00.452)   0:00:04.705 
>>> ***
>>> changed: [pulpnode] => changed=true
>>>   cmd:
>>>   - pulp-admin
>>>   - login
>>>   - -u
>>>   - admin
>>>   - -p
>>>   - admin
>>>   delta: '0:00:01.103429'
>>>   end: '2019-04-03 13:44:20.453693'
>>>   rc: 0
>>>   start: '2019-04-03 13:44:19.350264'
>>>   stderr: ''
>>>   stderr_lines: []
>>>   stdout: |-
>>> [0m[92mSuccessfully logged in. Session certificate will expire at 
>>> Apr 10 13:44:20 2019
>>> GMT.[0m
>>>   stdout_lines: 
>>>
>>> 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  13:44:20 + (0:00:02.181)   0:00:06.887 
>>> ***
>>> changed: [pulpnode] => (item=kunal) => changed=true
>>>   cmd:
>>>   - pulp-admin
>>>   - rpm
>>>   - repo
>>>   - content
>>>   - rpm
>>>   - --repo-id=mobi-snapshots
>>>   - --match
>>>   - filename=kunal
>>>   delta: '0:00:01.359062'
>>>   end: '2019-04-03 13:44:22.679585'
>>>   failed_when_result: false
>>>   item: kunal
>>>   rc: 0
>>>   start: '2019-04-03 13:44:21.320523'
>>>   stderr: ''
>>>   stderr_lines: []
>>>   stdout: "\e[0m"
>>>   stdout_lines: 
>>> META: ran handlers
>>> META: ran handlers
>>>
>>> PLAY RECAP 
>>> ***
>>> inplp01p2.infra.smf1.mobitv : ok=4changed=2unreachable=0
>>> failed=0
>>>
>>> Wednesday 03 April 2019  13:44:22 + (0:00:02.150)   0:00:09.037 
>>> ***
>>>
>>> ===

[ansible-project] What is the parameter attribute to use VM storage Policy

2019-04-03 Thread himanshu gupta
Hi All,

Can anyone please suggest.

Thanks,
Himanshu

-- 
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/b3864d85-d677-4f11-89c4-621c80fae972%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-04-03 Thread kunalsing thakur
Thank You sebastian. Now i am able to print stdout using
pulp.results.0.stdout

On Wed, Apr 3, 2019 at 8:01 PM 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/d0544de0-7767-8996-9d83-c037b4307869%40b1-systems.de
> .
> 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/CAEXQph7T8dihNZ2LHqib4Ywm%2BkUXi-SLeWXKWF-Z2za-iab30A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-04-03 Thread Kunalsing Thakur
Wednesday 03 April 2019  14:32:02 + (0:00:02.598)   0:00:07.161 
***
fatal: [node]: FAILED! =>
  msg: |-
The conditional check 'pulpresult.stdout == "\e[0m"' failed. The error 
was: error while evaluating conditional (pulpresult.stdout == "\e[0m"): 
'dict object' has no attribute 'stdout'

The error appears to have been in 
'/etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml': line 9, column 
3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: invoke failure
  ^ here


On Wednesday, April 3, 2019 at 7:57:21 PM UTC+5:30, Raghavendra Rao wrote:
>
> Hmmm... it should fail as the string is matched
>
> What happens when you do this instead?:
>
> - name: searching the rpm into pulp repo
>   command: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots 
> --match 'filename={{ item }}'
>   loop: "{{ rpmname | default([]) }}"
>   register: pulpresult
>   when: rpmsearch is defined
>   ignore_errors: yes
>
> - name: invoke failure
>   fail:
>   when: pulpresult.stdout == "\e[0m"
>
> -R.Rao
>
> On Wed, 3 Apr 2019 at 19:24, Kunalsing Thakur  > wrote:
>
>> Can anyone help on this?
>>
>>
>> On Wednesday, April 3, 2019 at 7:15:25 PM UTC+5:30, Kunalsing Thakur 
>> wrote:
>>>
>>> playbook:-
>>> ---
>>> - name: Deploying PCC-test
>>>   hosts: inplp01p2.infra.smf1.mobitv
>>>   gather_facts: true
>>>   vars_files:
>>> - 
>>> /etc/ansible/inventories/mobitv/paytv.smf1.mobitv/group_vars/common.yaml
>>>   vars:
>>> - rpmsearch: true
>>> - rpmname:
>>> - kunal
>>>   serial: 1
>>>   any_errors_fatal: true
>>>   roles:
>>> - role: mobi_ansible_role_pulp
>>>
>>>
>>>
>>> role task:-
>>> pulp.yaml
>>> ---
>>> - name: Logging into pulp
>>>   command: pulp-admin login -u admin -p admin
>>> - name: searching the rpm into pulp repo
>>>   command: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots 
>>> --match 'filename={{ item }}'
>>>   loop: "{{ rpmname | default([]) }}"
>>>   register: pulpresult
>>>   when: rpmsearch is defined
>>>   failed_when: pulpresult.stdout == "\e[0m"
>>>
>>>
>>> Ansible Output:-
>>> PLAY [Deploying PCC-test] 
>>> 
>>>
>>> TASK [Gathering Facts] 
>>> ***
>>> task path: /etc/ansible/playbooks/paytv/pulp.yaml:2
>>> Wednesday 03 April 2019  13:44:13 + (0:00:00.138)   0:00:00.138 
>>> ***
>>> ok: [inplp01p2.infra.smf1.mobitv]
>>> META: ran handlers
>>>
>>> TASK [mobi_ansible_role_pulp : include_tasks] 
>>> 
>>> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/main.yml:12
>>> Wednesday 03 April 2019  13:44:17 + (0:00:04.113)   0:00:04.252 
>>> ***
>>> included: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml for 
>>> inplp01p2.infra.smf1.mobitv
>>>
>>> TASK [mobi_ansible_role_pulp : Logging into pulp] 
>>> 
>>> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:2
>>> Wednesday 03 April 2019  13:44:18 + (0:00:00.452)   0:00:04.705 
>>> ***
>>> changed: [pulpnode] => changed=true
>>>   cmd:
>>>   - pulp-admin
>>>   - login
>>>   - -u
>>>   - admin
>>>   - -p
>>>   - admin
>>>   delta: '0:00:01.103429'
>>>   end: '2019-04-03 13:44:20.453693'
>>>   rc: 0
>>>   start: '2019-04-03 13:44:19.350264'
>>>   stderr: ''
>>>   stderr_lines: []
>>>   stdout: |-
>>> [0m[92mSuccessfully logged in. Session certificate will expire at 
>>> Apr 10 13:44:20 2019
>>> GMT.[0m
>>>   stdout_lines: 
>>>
>>> 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  13:44:20 + (0:00:02.181)   0:00:06.887 
>>> ***
>>> changed: [pulpnode] => (item=kunal) => changed=true
>>>   cmd:
>>>   - pulp-admin
>>>   - rpm
>>>   - repo
>>>   - content
>>>   - rpm
>>>   - --repo-id=mobi-snapshots
>>>   - --match
>>>   - filename=kunal
>>>   delta: '0:00:01.359062'
>>>   end: '2019-04-03 13:44:22.679585'
>>>   failed_when_result: false
>>>   item: kunal
>>>   rc: 0
>>>   start: '2019-04-03 13:44:21.320523'
>>>   stderr: ''
>>>   stderr_lines: []
>>>   stdout: "\e[0m"
>>>   stdout_lines: 
>>> META: ran handlers
>>> META: ran handlers
>>>
>>> PLAY RECAP 
>>> ***
>>> inplp01p2.infra.smf1.mobitv : ok=4changed=2unreachable=0
>>> failed=0
>>>
>>> Wednesday 03 April 2019  13:44:22 + (0:00:02.150)   0:00:09.037 
>>> ***
>>>
>>> ===
>>> Gathering Facts 
>>> 

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

2019-04-03 Thread kunalsing thakur
TASK [mobi_ansible_role_pulp : invoke failure]
***
task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:9
Wednesday 03 April 2019  14:32:02 + (0:00:02.598)   0:00:07.161
***
fatal: [node]: FAILED! =>
  msg: |-
The conditional check 'pulpresult.stdout == "\e[0m"' failed. The error
was: error while evaluating conditional (pulpresult.stdout == "\e[0m"):
'dict object' has no attribute 'stdout'

The error appears to have been in
'/etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml': line 9, column
3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

On Wed, Apr 3, 2019 at 7:57 PM Raghavendra Rao 
wrote:

> Hmmm... it should fail as the string is matched
>
> What happens when you do this instead?:
>
> - name: searching the rpm into pulp repo
>   command: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots
> --match 'filename={{ item }}'
>   loop: "{{ rpmname | default([]) }}"
>   register: pulpresult
>   when: rpmsearch is defined
>   ignore_errors: yes
>
> - name: invoke failure
>   fail:
>   when: pulpresult.stdout == "\e[0m"
>
> -R.Rao
>
> On Wed, 3 Apr 2019 at 19:24, Kunalsing Thakur 
> wrote:
>
>> Can anyone help on this?
>>
>>
>> On Wednesday, April 3, 2019 at 7:15:25 PM UTC+5:30, Kunalsing Thakur
>> wrote:
>>>
>>> playbook:-
>>> ---
>>> - name: Deploying PCC-test
>>>   hosts: inplp01p2.infra.smf1.mobitv
>>>   gather_facts: true
>>>   vars_files:
>>> -
>>> /etc/ansible/inventories/mobitv/paytv.smf1.mobitv/group_vars/common.yaml
>>>   vars:
>>> - rpmsearch: true
>>> - rpmname:
>>> - kunal
>>>   serial: 1
>>>   any_errors_fatal: true
>>>   roles:
>>> - role: mobi_ansible_role_pulp
>>>
>>>
>>>
>>> role task:-
>>> pulp.yaml
>>> ---
>>> - name: Logging into pulp
>>>   command: pulp-admin login -u admin -p admin
>>> - name: searching the rpm into pulp repo
>>>   command: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots
>>> --match 'filename={{ item }}'
>>>   loop: "{{ rpmname | default([]) }}"
>>>   register: pulpresult
>>>   when: rpmsearch is defined
>>>   failed_when: pulpresult.stdout == "\e[0m"
>>>
>>>
>>> Ansible Output:-
>>> PLAY [Deploying PCC-test]
>>> 
>>>
>>> TASK [Gathering Facts]
>>> ***
>>> task path: /etc/ansible/playbooks/paytv/pulp.yaml:2
>>> Wednesday 03 April 2019  13:44:13 + (0:00:00.138)   0:00:00.138
>>> ***
>>> ok: [inplp01p2.infra.smf1.mobitv]
>>> META: ran handlers
>>>
>>> TASK [mobi_ansible_role_pulp : include_tasks]
>>> 
>>> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/main.yml:12
>>> Wednesday 03 April 2019  13:44:17 + (0:00:04.113)   0:00:04.252
>>> ***
>>> included: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml for
>>> inplp01p2.infra.smf1.mobitv
>>>
>>> TASK [mobi_ansible_role_pulp : Logging into pulp]
>>> 
>>> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:2
>>> Wednesday 03 April 2019  13:44:18 + (0:00:00.452)   0:00:04.705
>>> ***
>>> changed: [pulpnode] => changed=true
>>>   cmd:
>>>   - pulp-admin
>>>   - login
>>>   - -u
>>>   - admin
>>>   - -p
>>>   - admin
>>>   delta: '0:00:01.103429'
>>>   end: '2019-04-03 13:44:20.453693'
>>>   rc: 0
>>>   start: '2019-04-03 13:44:19.350264'
>>>   stderr: ''
>>>   stderr_lines: []
>>>   stdout: |-
>>> [0m[92mSuccessfully logged in. Session certificate will expire at
>>> Apr 10 13:44:20 2019
>>> GMT.[0m
>>>   stdout_lines: 
>>>
>>> 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  13:44:20 + (0:00:02.181)   0:00:06.887
>>> ***
>>> changed: [pulpnode] => (item=kunal) => changed=true
>>>   cmd:
>>>   - pulp-admin
>>>   - rpm
>>>   - repo
>>>   - content
>>>   - rpm
>>>   - --repo-id=mobi-snapshots
>>>   - --match
>>>   - filename=kunal
>>>   delta: '0:00:01.359062'
>>>   end: '2019-04-03 13:44:22.679585'
>>>   failed_when_result: false
>>>   item: kunal
>>>   rc: 0
>>>   start: '2019-04-03 13:44:21.320523'
>>>   stderr: ''
>>>   stderr_lines: []
>>>   stdout: "\e[0m"
>>>   stdout_lines: 
>>> META: ran handlers
>>> META: ran handlers
>>>
>>> PLAY RECAP
>>> ***
>>> inplp01p2.infra.smf1.mobitv : ok=4changed=2unreachable=0
>>> failed=0
>>>
>>> Wednesday 03 April 2019  13:44:22 + (0:00:02.150)   0:00:09.037
>>> ***
>>>
>>> =

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

2019-04-03 Thread Sebastian Meyer
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/d0544de0-7767-8996-9d83-c037b4307869%40b1-systems.de.
For more options, visit https://groups.google.com/d/optout.


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

2019-04-03 Thread Stefan Hornburg (Racke)
On 4/3/19 4:22 PM, Kunalsing Thakur wrote:
> playbook:-
> task:-
> - name: Deploying PCC-test
>   hosts: pulp
>   gather_facts: true
>   vars_files:
>     - /etc/ansible/inventories/group_vars/common.yaml
>   vars:
>     - rpmsearch: true
>     - rpmname:
>     - mobi-auth-manager-5.42.0-201903291228.ed4d6a0.noarch
>   serial: 1
>   any_errors_fatal: true
>   roles:
>     - role: mobi_ansible_role_pulp
> 
> Pulp.yaml:-
> 
> ---
> - 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
> - debug:
>     var: pulp.results.stdout
> 

Hello Kunalsing,

please try pulp.stdout instead.

Regards
  Racke

> 
> Playbook output:-
> PLAYBOOK: pulp.yaml 
> **
> 1 plays in pulp.yaml
>  [WARNING]: Found variable using reserved name: remote_user
> 
> 
> PLAY [Deploying PCC-test] 
> 
> 
> TASK [Gathering Facts] 
> ***
> task path: /etc/ansible/playbooks/paytv/pulp.yaml:2
> Wednesday 03 April 2019  14:18:45 + (0:00:00.136)   0:00:00.136 
> ***
> ok: [node]
> META: ran handlers
> 
> TASK [mobi_ansible_role_pulp : include_tasks] 
> 
> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/main.yml:12
> Wednesday 03 April 2019  14:18:49 + (0:00:03.725)   0:00:03.862 
> ***
> included: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml for 
> inplp01p2.infra.smf1.mobitv
> 
> TASK [mobi_ansible_role_pulp : Logging into pulp] 
> 
> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:2
> Wednesday 03 April 2019  14:18:49 + (0:00:00.409)   0:00:04.271 
> ***
> changed: [node] => changed=true
>   cmd: pulp-admin login -u admin -p admin
>   delta: '0:00:01.010085'
>   end: '2019-04-03 14:18:51.477441'
>   rc: 0
>   start: '2019-04-03 14:18:50.467356'
>   stderr: ''
>   stderr_lines: []
>   stdout: |-
>     [0m[92mSuccessfully logged in. Session certificate will expire at Apr 10 
> 14:18:51 2019
>     GMT.[0m
>   stdout_lines: 
> 
> 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:18:51 + (0:00:01.985)   0:00:06.256 
> ***
> changed: [node] => 
> (item=mobi-auth-manager-5.42.0-201903291228.ed4d6a0.noarch) => changed=true
>   cmd: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots --match
> 'filename=mobi-auth-manager-5.42.0-201903291228.ed4d6a0.noarch'
>   delta: '0:00:01.417179'
>   end: '2019-04-03 14:18:53.720125'
>   item: mobi-auth-manager-5.42.0-201903291228.ed4d6a0.noarch
>   rc: 0
>   start: '2019-04-03 14:18:52.302946'
>   stderr: ''
>   stderr_lines: []
>   stdout: |-
>     [0mArch: noarch
>     Buildhost:    3c33318f8330
>     Checksum: 
> 33816f5a2680403526591148da282e680655ad354fe23f80cc100824dcc1b4f1
>     Checksumtype: sha256
>     Description:  Mobi Auth Manager
>     Epoch:    0
>     Filename: mobi-auth-manager-5.42.0-201903291228.ed4d6a0.noarch.rpm
>     License:  MobiTV, Inc.
>     Name: mobi-auth-manager
>     Provides: mobi-auth-manager = 5.42.0-201903291228.ed4d6a0-0,
>   osgi(ch.qos.logback.classic) = 1.1.2-0, 
> osgi(ch.qos.logback.core)
>   = 1.1.2-0, osgi(com.google.guava) = 14.0.1-0,
>   osgi(com.sun.jersey.client) = 1.17.0-0,
>   osgi(com.sun.jersey.contribs.jersey-apache-client) = 
> 1.17.0-0,
>   osgi(com.sun.jersey.contribs.jersey-apache-client4) = 
> 1.17.1-0,
>   osgi(com.sun.jersey.contribs.jersey-spring) = 1.17.0-0,
>   osgi(com.sun.jersey.core) = 1.17.0-0,
>   osgi(com.sun.jersey.jersey-server) = 1.17.0-0,
>   osgi(com.sun.jersey.json) = 1.17.0-0, 
> osgi(com.sun.jersey.servlet)
>   = 1.17.0-0, osgi(com.sun.xml.bind) = 2.2.3-0, 
> osgi(curator-client)
>   = 2.2.0-0, osgi(curator-framework) = 2.2.0-0,
>   osgi(curator-recipes) = 2.2.0-0, osgi(curator-x-discovery) =
>   2.2.0-0, osgi(jackson-core-asl) = 1.9.12-0, 
> osgi(jackson-jaxrs) =
>   1.9.9-0, osgi(jackson-mapper-asl) = 1.9.9-0, 
> osgi(jackson-xc) =
>   1.9.9-0, osgi(javax.ws.rs.jsr311-api) = 1.1.1-0, 
> osgi(jaxb-api) =
>   2.2.2-0, osgi(jcl.over.slf4

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

2019-04-03 Thread Raghavendra Rao
On Wed, 3 Apr 2019 at 19:52, Kunalsing Thakur 
wrote:

> playbook:-
> task:-
> - name: Deploying PCC-test
>   hosts: pulp
>   gather_facts: true
>   vars_files:
> - /etc/ansible/inventories/group_vars/common.yaml
>   vars:
> - rpmsearch: true
> - rpmname:
> - mobi-auth-manager-5.42.0-201903291228.ed4d6a0.noarch
>   serial: 1
>   any_errors_fatal: true
>   roles:
> - role: mobi_ansible_role_pulp
>
> Pulp.yaml:-
>
> ---
> - 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
> - debug:
> var: pulp.results.stdout
>

This should be
 var: pulp.stdout

-R.Rao

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


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

2019-04-03 Thread Raghavendra Rao
Hmmm... it should fail as the string is matched

What happens when you do this instead?:

- name: searching the rpm into pulp repo
  command: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots --match
'filename={{ item }}'
  loop: "{{ rpmname | default([]) }}"
  register: pulpresult
  when: rpmsearch is defined
  ignore_errors: yes

- name: invoke failure
  fail:
  when: pulpresult.stdout == "\e[0m"

-R.Rao

On Wed, 3 Apr 2019 at 19:24, Kunalsing Thakur 
wrote:

> Can anyone help on this?
>
>
> On Wednesday, April 3, 2019 at 7:15:25 PM UTC+5:30, Kunalsing Thakur wrote:
>>
>> playbook:-
>> ---
>> - name: Deploying PCC-test
>>   hosts: inplp01p2.infra.smf1.mobitv
>>   gather_facts: true
>>   vars_files:
>> -
>> /etc/ansible/inventories/mobitv/paytv.smf1.mobitv/group_vars/common.yaml
>>   vars:
>> - rpmsearch: true
>> - rpmname:
>> - kunal
>>   serial: 1
>>   any_errors_fatal: true
>>   roles:
>> - role: mobi_ansible_role_pulp
>>
>>
>>
>> role task:-
>> pulp.yaml
>> ---
>> - name: Logging into pulp
>>   command: pulp-admin login -u admin -p admin
>> - name: searching the rpm into pulp repo
>>   command: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots
>> --match 'filename={{ item }}'
>>   loop: "{{ rpmname | default([]) }}"
>>   register: pulpresult
>>   when: rpmsearch is defined
>>   failed_when: pulpresult.stdout == "\e[0m"
>>
>>
>> Ansible Output:-
>> PLAY [Deploying PCC-test]
>> 
>>
>> TASK [Gathering Facts]
>> ***
>> task path: /etc/ansible/playbooks/paytv/pulp.yaml:2
>> Wednesday 03 April 2019  13:44:13 + (0:00:00.138)   0:00:00.138
>> ***
>> ok: [inplp01p2.infra.smf1.mobitv]
>> META: ran handlers
>>
>> TASK [mobi_ansible_role_pulp : include_tasks]
>> 
>> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/main.yml:12
>> Wednesday 03 April 2019  13:44:17 + (0:00:04.113)   0:00:04.252
>> ***
>> included: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml for
>> inplp01p2.infra.smf1.mobitv
>>
>> TASK [mobi_ansible_role_pulp : Logging into pulp]
>> 
>> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:2
>> Wednesday 03 April 2019  13:44:18 + (0:00:00.452)   0:00:04.705
>> ***
>> changed: [pulpnode] => changed=true
>>   cmd:
>>   - pulp-admin
>>   - login
>>   - -u
>>   - admin
>>   - -p
>>   - admin
>>   delta: '0:00:01.103429'
>>   end: '2019-04-03 13:44:20.453693'
>>   rc: 0
>>   start: '2019-04-03 13:44:19.350264'
>>   stderr: ''
>>   stderr_lines: []
>>   stdout: |-
>> [0m[92mSuccessfully logged in. Session certificate will expire at Apr
>> 10 13:44:20 2019
>> GMT.[0m
>>   stdout_lines: 
>>
>> 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  13:44:20 + (0:00:02.181)   0:00:06.887
>> ***
>> changed: [pulpnode] => (item=kunal) => changed=true
>>   cmd:
>>   - pulp-admin
>>   - rpm
>>   - repo
>>   - content
>>   - rpm
>>   - --repo-id=mobi-snapshots
>>   - --match
>>   - filename=kunal
>>   delta: '0:00:01.359062'
>>   end: '2019-04-03 13:44:22.679585'
>>   failed_when_result: false
>>   item: kunal
>>   rc: 0
>>   start: '2019-04-03 13:44:21.320523'
>>   stderr: ''
>>   stderr_lines: []
>>   stdout: "\e[0m"
>>   stdout_lines: 
>> META: ran handlers
>> META: ran handlers
>>
>> PLAY RECAP
>> ***
>> inplp01p2.infra.smf1.mobitv : ok=4changed=2unreachable=0
>> failed=0
>>
>> Wednesday 03 April 2019  13:44:22 + (0:00:02.150)   0:00:09.037
>> ***
>>
>> ===
>> Gathering Facts
>> ---
>> 4.11s
>> /etc/ansible/playbooks/paytv/pulp.yaml:2
>> 
>> mobi_ansible_role_pulp : Logging into pulp
>>  2.18s
>> /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:2
>> -
>> mobi_ansible_role_pulp : searching the rpm into pulp repo
>> - 2.15s
>> /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:4
>> -
>> mobi_ansible_role_pulp : include_tasks
>>  0.45s
>> /etc/ansible/roles/mobi_ansib

[ansible-project] how to access debug stdout variable

2019-04-03 Thread Kunalsing Thakur
playbook:-
task:-
- name: Deploying PCC-test
  hosts: pulp
  gather_facts: true
  vars_files:
- /etc/ansible/inventories/group_vars/common.yaml
  vars:
- rpmsearch: true
- rpmname:
- mobi-auth-manager-5.42.0-201903291228.ed4d6a0.noarch
  serial: 1
  any_errors_fatal: true
  roles:
- role: mobi_ansible_role_pulp

Pulp.yaml:-

---
- 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
- debug:
var: pulp.results.stdout


Playbook output:-
PLAYBOOK: pulp.yaml 
**
1 plays in pulp.yaml
 [WARNING]: Found variable using reserved name: remote_user


PLAY [Deploying PCC-test] 


TASK [Gathering Facts] 
***
task path: /etc/ansible/playbooks/paytv/pulp.yaml:2
Wednesday 03 April 2019  14:18:45 + (0:00:00.136)   0:00:00.136 
***
ok: [node]
META: ran handlers

TASK [mobi_ansible_role_pulp : include_tasks] 

task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/main.yml:12
Wednesday 03 April 2019  14:18:49 + (0:00:03.725)   0:00:03.862 
***
included: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml for 
inplp01p2.infra.smf1.mobitv

TASK [mobi_ansible_role_pulp : Logging into pulp] 

task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:2
Wednesday 03 April 2019  14:18:49 + (0:00:00.409)   0:00:04.271 
***
changed: [node] => changed=true
  cmd: pulp-admin login -u admin -p admin
  delta: '0:00:01.010085'
  end: '2019-04-03 14:18:51.477441'
  rc: 0
  start: '2019-04-03 14:18:50.467356'
  stderr: ''
  stderr_lines: []
  stdout: |-
[0m[92mSuccessfully logged in. Session certificate will expire at Apr 
10 14:18:51 2019
GMT.[0m
  stdout_lines: 

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:18:51 + (0:00:01.985)   0:00:06.256 
***
changed: [node] => 
(item=mobi-auth-manager-5.42.0-201903291228.ed4d6a0.noarch) => changed=true
  cmd: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots --match 
'filename=mobi-auth-manager-5.42.0-201903291228.ed4d6a0.noarch'
  delta: '0:00:01.417179'
  end: '2019-04-03 14:18:53.720125'
  item: mobi-auth-manager-5.42.0-201903291228.ed4d6a0.noarch
  rc: 0
  start: '2019-04-03 14:18:52.302946'
  stderr: ''
  stderr_lines: []
  stdout: |-
[0mArch: noarch
Buildhost:3c33318f8330
Checksum: 
33816f5a2680403526591148da282e680655ad354fe23f80cc100824dcc1b4f1
Checksumtype: sha256
Description:  Mobi Auth Manager
Epoch:0
Filename: mobi-auth-manager-5.42.0-201903291228.ed4d6a0.noarch.rpm
License:  MobiTV, Inc.
Name: mobi-auth-manager
Provides: mobi-auth-manager = 5.42.0-201903291228.ed4d6a0-0,
  osgi(ch.qos.logback.classic) = 1.1.2-0, 
osgi(ch.qos.logback.core)
  = 1.1.2-0, osgi(com.google.guava) = 14.0.1-0,
  osgi(com.sun.jersey.client) = 1.17.0-0,
  osgi(com.sun.jersey.contribs.jersey-apache-client) = 
1.17.0-0,
  osgi(com.sun.jersey.contribs.jersey-apache-client4) = 
1.17.1-0,
  osgi(com.sun.jersey.contribs.jersey-spring) = 1.17.0-0,
  osgi(com.sun.jersey.core) = 1.17.0-0,
  osgi(com.sun.jersey.jersey-server) = 1.17.0-0,
  osgi(com.sun.jersey.json) = 1.17.0-0, 
osgi(com.sun.jersey.servlet)
  = 1.17.0-0, osgi(com.sun.xml.bind) = 2.2.3-0, 
osgi(curator-client)
  = 2.2.0-0, osgi(curator-framework) = 2.2.0-0,
  osgi(curator-recipes) = 2.2.0-0, 
osgi(curator-x-discovery) =
  2.2.0-0, osgi(jackson-core-asl) = 1.9.12-0, 
osgi(jackson-jaxrs) =
  1.9.9-0, osgi(jackson-mapper-asl) = 1.9.9-0, 
osgi(jackson-xc) =
  1.9.9-0, osgi(javax.ws.rs.jsr311-api) = 1.1.1-0, 
osgi(jaxb-api) =
  2.2.2-0, osgi(jcl.over.slf4j) = 1.7.7-0, 
osgi(log4j.over.slf4j) =
  1.7.7-0, osgi(org.apache.commons.codec) = 1.10.0-0,
  osgi(org.apache.commons.collections) = 3.2.1-0,
  osgi(org.apache.commons.io) = 2.4.0-0,
  osgi(org.apache.commons.lang) = 2.6-0,
  osgi(org.apache.commons.net) = 2.2-0,
  osgi(org.a

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

2019-04-03 Thread Kunalsing Thakur
Can anyone help on this?


On Wednesday, April 3, 2019 at 7:15:25 PM UTC+5:30, Kunalsing Thakur wrote:
>
> playbook:-
> ---
> - name: Deploying PCC-test
>   hosts: inplp01p2.infra.smf1.mobitv
>   gather_facts: true
>   vars_files:
> - 
> /etc/ansible/inventories/mobitv/paytv.smf1.mobitv/group_vars/common.yaml
>   vars:
> - rpmsearch: true
> - rpmname:
> - kunal
>   serial: 1
>   any_errors_fatal: true
>   roles:
> - role: mobi_ansible_role_pulp
>
>
>
> role task:-
> pulp.yaml
> ---
> - name: Logging into pulp
>   command: pulp-admin login -u admin -p admin
> - name: searching the rpm into pulp repo
>   command: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots 
> --match 'filename={{ item }}'
>   loop: "{{ rpmname | default([]) }}"
>   register: pulpresult
>   when: rpmsearch is defined
>   failed_when: pulpresult.stdout == "\e[0m"
>
>
> Ansible Output:-
> PLAY [Deploying PCC-test] 
> 
>
> TASK [Gathering Facts] 
> ***
> task path: /etc/ansible/playbooks/paytv/pulp.yaml:2
> Wednesday 03 April 2019  13:44:13 + (0:00:00.138)   0:00:00.138 
> ***
> ok: [inplp01p2.infra.smf1.mobitv]
> META: ran handlers
>
> TASK [mobi_ansible_role_pulp : include_tasks] 
> 
> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/main.yml:12
> Wednesday 03 April 2019  13:44:17 + (0:00:04.113)   0:00:04.252 
> ***
> included: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml for 
> inplp01p2.infra.smf1.mobitv
>
> TASK [mobi_ansible_role_pulp : Logging into pulp] 
> 
> task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:2
> Wednesday 03 April 2019  13:44:18 + (0:00:00.452)   0:00:04.705 
> ***
> changed: [pulpnode] => changed=true
>   cmd:
>   - pulp-admin
>   - login
>   - -u
>   - admin
>   - -p
>   - admin
>   delta: '0:00:01.103429'
>   end: '2019-04-03 13:44:20.453693'
>   rc: 0
>   start: '2019-04-03 13:44:19.350264'
>   stderr: ''
>   stderr_lines: []
>   stdout: |-
> [0m[92mSuccessfully logged in. Session certificate will expire at Apr 
> 10 13:44:20 2019
> GMT.[0m
>   stdout_lines: 
>
> 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  13:44:20 + (0:00:02.181)   0:00:06.887 
> ***
> changed: [pulpnode] => (item=kunal) => changed=true
>   cmd:
>   - pulp-admin
>   - rpm
>   - repo
>   - content
>   - rpm
>   - --repo-id=mobi-snapshots
>   - --match
>   - filename=kunal
>   delta: '0:00:01.359062'
>   end: '2019-04-03 13:44:22.679585'
>   failed_when_result: false
>   item: kunal
>   rc: 0
>   start: '2019-04-03 13:44:21.320523'
>   stderr: ''
>   stderr_lines: []
>   stdout: "\e[0m"
>   stdout_lines: 
> META: ran handlers
> META: ran handlers
>
> PLAY RECAP 
> ***
> inplp01p2.infra.smf1.mobitv : ok=4changed=2unreachable=0
> failed=0
>
> Wednesday 03 April 2019  13:44:22 + (0:00:02.150)   0:00:09.037 
> ***
>
> ===
> Gathering Facts 
> ---
>  
> 4.11s
> /etc/ansible/playbooks/paytv/pulp.yaml:2 
> 
> mobi_ansible_role_pulp : Logging into pulp 
>  2.18s
> /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:2 
> -
> mobi_ansible_role_pulp : searching the rpm into pulp repo 
> - 2.15s
> /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:4 
> -
> mobi_ansible_role_pulp : include_tasks 
>  0.45s
> /etc/ansible/roles/mobi_ansible_role_pulp/tasks/main.yml:12 
> -
> Playbook run took 0 days, 0 hours, 0 minutes, 9 seconds
>
>
>
>
> It should fail the task not 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-proje

[ansible-project] Re: How to copy directory from remote machine to ansible machine

2019-04-03 Thread Tony Chia


If you don't want the complete path, you can set "flat: yes" in the fetch task 
and it will flatten the directory for you.

--Tony



On Wednesday, April 3, 2019 at 4:08:42 AM UTC-7, amit ahuja wrote:
>
> Hi,
>
> i want to know if there is any way to copy complete directory from remote 
> machine to local ansible machine . i tried to used fetch method but it is  
> copying files with complete path which i dont want . pls help .
>
> thanks
> Amit
>
>
>

-- 
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/ab72deb4-ffc7-4d70-b053-ee8987689391%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-04-03 Thread Kunalsing Thakur
playbook:-
---
- name: Deploying PCC-test
  hosts: inplp01p2.infra.smf1.mobitv
  gather_facts: true
  vars_files:
- 
/etc/ansible/inventories/mobitv/paytv.smf1.mobitv/group_vars/common.yaml
  vars:
- rpmsearch: true
- rpmname:
- kunal
  serial: 1
  any_errors_fatal: true
  roles:
- role: mobi_ansible_role_pulp



role task:-
pulp.yaml
---
- name: Logging into pulp
  command: pulp-admin login -u admin -p admin
- name: searching the rpm into pulp repo
  command: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots --match 
'filename={{ item }}'
  loop: "{{ rpmname | default([]) }}"
  register: pulpresult
  when: rpmsearch is defined
  failed_when: pulpresult.stdout == "\e[0m"


Ansible Output:-
PLAY [Deploying PCC-test] 


TASK [Gathering Facts] 
***
task path: /etc/ansible/playbooks/paytv/pulp.yaml:2
Wednesday 03 April 2019  13:44:13 + (0:00:00.138)   0:00:00.138 
***
ok: [inplp01p2.infra.smf1.mobitv]
META: ran handlers

TASK [mobi_ansible_role_pulp : include_tasks] 

task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/main.yml:12
Wednesday 03 April 2019  13:44:17 + (0:00:04.113)   0:00:04.252 
***
included: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml for 
inplp01p2.infra.smf1.mobitv

TASK [mobi_ansible_role_pulp : Logging into pulp] 

task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:2
Wednesday 03 April 2019  13:44:18 + (0:00:00.452)   0:00:04.705 
***
changed: [pulpnode] => changed=true
  cmd:
  - pulp-admin
  - login
  - -u
  - admin
  - -p
  - admin
  delta: '0:00:01.103429'
  end: '2019-04-03 13:44:20.453693'
  rc: 0
  start: '2019-04-03 13:44:19.350264'
  stderr: ''
  stderr_lines: []
  stdout: |-
[0m[92mSuccessfully logged in. Session certificate will expire at Apr 
10 13:44:20 2019
GMT.[0m
  stdout_lines: 

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  13:44:20 + (0:00:02.181)   0:00:06.887 
***
changed: [pulpnode] => (item=kunal) => changed=true
  cmd:
  - pulp-admin
  - rpm
  - repo
  - content
  - rpm
  - --repo-id=mobi-snapshots
  - --match
  - filename=kunal
  delta: '0:00:01.359062'
  end: '2019-04-03 13:44:22.679585'
  failed_when_result: false
  item: kunal
  rc: 0
  start: '2019-04-03 13:44:21.320523'
  stderr: ''
  stderr_lines: []
  stdout: "\e[0m"
  stdout_lines: 
META: ran handlers
META: ran handlers

PLAY RECAP 
***
inplp01p2.infra.smf1.mobitv : ok=4changed=2unreachable=0failed=0

Wednesday 03 April 2019  13:44:22 + (0:00:02.150)   0:00:09.037 
***
===
Gathering Facts 
---
 
4.11s
/etc/ansible/playbooks/paytv/pulp.yaml:2 

mobi_ansible_role_pulp : Logging into pulp 
 2.18s
/etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:2 
-
mobi_ansible_role_pulp : searching the rpm into pulp repo 
- 2.15s
/etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:4 
-
mobi_ansible_role_pulp : include_tasks 
 0.45s
/etc/ansible/roles/mobi_ansible_role_pulp/tasks/main.yml:12 
-
Playbook run took 0 days, 0 hours, 0 minutes, 9 seconds




It should fail the task not 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/56afad8e-15fb-450b-9e12-604bfa166cff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible unable to except any other body format except raw and jason in the uri module and upload a zip or a jar via POST method

2019-04-03 Thread Fabio Martins
I am facing exactly the same issue when trying to upload a jar file over a 
Flink 
REST endpoint 

.

I tried both with curl and postman, it works flawlessly, but using Ansible 
URI module, I am getting the error message:  FAILED! => {"changed": false, 
"content": "", "msg": "Status code was -1 and not [200]: Request failed: 
", "redirected": false, 
"status": -1, "url": "http://:8081/jars/upload}

Any idea, or should I continue using the shell module with curl (I don't 
like it, but it's the only way it works for now).

On Monday, May 21, 2018 at 8:05:47 PM UTC+2, Apu Mondal wrote:
>
> Zip file not getting POST to the server with the uri module in Ansible.
>
> These are the codes I am trying to execute
>
>- name: Transfering the Proxies
>uri:
>headers:
>Authorization: '{{API_USER_PASS_BASE64_ENCRYPT}}'
>Content-Type: "application/octet-stream"
>url: 
>
> https://api.enterprise.apigee.com/v1/organizations/{{API_ORG}}/apis?action=import&name={{proxy_name
>  
>}}-{{API_ENVIRONMENT}}
>#body: "{{ lookup('file','{{ path 
>
> }}/{{bundle_name}}/apigee/proxies/{{proxy_name}}--hughes-dev-test-dev.zip') 
>}}" --> doesn't work
>src: /{{ path 
>}}/{{bundle_name}}/apigee/proxies/{{proxy_name}}--hughes-dev-test-dev.zip
>body_format: raw
>status_code: 201, 200
>method: POST
>register: version
>
> It gives the following error:
> "json": {
> "code": "messaging.config.beans.InvalidBundle",
> "contexts": [],
> "message": "Bundle is invalid. Empty bundle"
> },
>
> Also it sets the "content_type": "application/json", at the top of the 
> message like this:
>
> The full traceback is:
> File "/tmp/ansible_NyKoMf/ansible_module_uri.py", line 468, in main
> uresp['location'] = absolute_location(url, uresp['location'])
>
> fatal: [localhost]: FAILED! => {
> "changed": false,
> "connection": "Close",
> "content": "{\n "code" : "messaging.config.beans.InvalidBundle",\n 
> "message" : "Bundle is invalid. Empty bundle",\n "contexts" : [ ]\n}",
> "content_length": "122",
> "content_type": "application/json",
> "date": "Mon, 14 May 2018 19:03:48 GMT",
> "invocation": {
> "module_args": {
> "attributes": null,
> "backup": null,
> "body": null,
> "body_format": "raw",
> "client_cert": null,
> "client_key": null,
> "content": null,
> "creates": null,
> "delimiter": null,
> "dest": null,
> "directory_mode": null,
> "follow": false,
> "follow_redirects": "safe",
> "force": false,
> "force_basic_auth": false,
> "group": null,
> "headers": {
> "Authorization": "Basic YXBvb3J2YS5tb25kYWxAaHVnaGVzLmNvbTphcG9vcnZhNw==",
> "Content-Type": "application/octet-stream"
> },
> "http_agent": "ansible-httpget",
> "method": "POST",
> "mode": null,
> "owner": null,
> "regexp": null,
> "remote_src": null,
> "removes": null,
> "return_content": false,
> "selevel": null,
> "serole": null,
> "setype": null,
> "seuser": null,
> "src": 
> "/var/tmp/APIGEE_COM_R001_B-001_P-001/apigee/proxies/FapProxy--hughes-dev-test-dev.zip",
> "status_code": [
> "201",
> " 200"
> ],
> "timeout": 30,
> "unsafe_writes": null,
> "url": "
> https://api.enterprise.apigee.com/v1/organizations/hughes-dev/apis?action=import&name=FapProxy-sa-dev
> ",
> "url_password": null,
> "url_username": null,
> "use_proxy": true,
> "validate_certs": true
> }
> },
> "json": {
> "code": "messaging.config.beans.InvalidBundle",
> "contexts": [],
> "message": "Bundle is invalid. Empty bundle"
> },
> "msg": "Status code was not [201, 200]: HTTP Error 400: Bad Request",
> "redirected": false,
> "server": "Apigee LB",
> "status": 400,
> "url": "
> https://api.enterprise.apigee.com/v1/organizations/hughes-dev/apis?action=import&name=FapProxy-sa-dev
> "
> }
>
>
> 2) - name: Transfering the Proxies
>
>   uri:
> headers:
>  Authorization: '{{API_USER_PASS_BASE64_ENCRYPT}}'
>  Content-Type: "application/zip"
> url: 
> https://api.enterprise.apigee.com/v1/organizations/{{API_ORG}}/apis?action=import&name={{
>  proxy_name }}-{{API_ENVIRONMENT}}
> body: "{{ lookup('file','{{ path 
> }}/{{bundle_name}}/apigee/proxies/{{proxy_name}}--hughes-dev-test-dev.zip') 
> }}"
> #src: '{{ path 
> }}/{{bundle_name}}/apigee/proxies/{{proxy_name}}--hughes-dev-test-dev.zip'
> #body_format: raw
> status_code: 201, 200
> method: POST
>   register: version
>
>
> Please check and provide information on how to properly POST a zip file.
> ISSUE TYPE
>
>- Bug Report
>- Feature Idea
>- Documentation Report
>
> COMPONENT NAME
>
> URI Module
> ANSIBLE VERSION
>
> ansible 2.4.2.0
>
> CONFIGURATIONOS / ENVIRONMENT
>
> Red Hat Enterprise Linux Server 7.3 (Maipo)
> STEPS TO REPRODUCE
>
> - name: Transfering the Proxies
>   uri:
> headers:
>  Authorization: '{{API_USER_PASS_BASE64_ENCRYPT}}'
>  Content-Type: "application/zip"
> url: 
> https://api.enterprise.apigee.com/v1/organizations/{{API_ORG}}/apis?action=import&name

Re: [ansible-project] How to avoid backslash and quote from variable

2019-04-03 Thread bikram40
Hi 
Thanks for your feedback 
I solved it using regular expression 

Bikram

Sent from my iPhone

> On Apr 2, 2019, at 11:28 PM, P. Varsha  wrote:
> 
> Hello,
> I am not working on cisco switches but try once - "show run interface 
> "\Gi9/1\" | i no cdp" .
> check your commands once your using - "show run interface \" right because of 
> that you got error.
> 
> Thanks
> 
> 
>> On Tue, Apr 2, 2019 at 8:28 AM bikram40  wrote:
>> Hello,
>> 
>> I am running an audit against some interfaces on Cisco switches:
>> Here is the task:
>> - ios_command:
>> provider: "{{ cli }}"
>> commands: show run interface "{{ item }}" | i no cdp
>> timeout: 15
>>   register: no_cdp
>>   with_items: "{{ interface_all.stdout_lines }}"
>> 
>> From with_items the value of variables passing as "show run interface 
>> \"Gi9/1\" | i no cdp" which gives me an error as it has \" in both leading 
>> and trailing side of interface name.
>> 
>> I tried  | regex_replace after item to avoid these two characters but no 
>> luck.
>> 
>> Could you please help.
>> 
>> Thanks,
>> Bikram Biswas
>> 
>> 
>> -- 
>> 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/CAEFfMJTTQEjjBHUq_iXjPSH5iAwB6unSYws%2BrKbk%2B79Eg2e58Q%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/CAA3T03%2BUff_ftstzjB6Tv9TW8F-Q-2-vscLR0GqV44AzDnLT9g%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/4B13253B-E467-4EA6-92F5-50120B1AAE3D%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to copy directory from remote machine to ansible machine

2019-04-03 Thread Vinu Vajravel
SCP you tried ?

On Wed, Apr 3, 2019 at 4:38 PM amit ahuja  wrote:

> Hi,
>
> i want to know if there is any way to copy complete directory from remote
> machine to local ansible machine . i tried to used fetch method but it is
> copying files with complete path which i dont want . pls help .
>
> thanks
> Amit
>
>
> --
> 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/CAMW2Xdf2Fh81YHh_C%3DiQ3%2BTk41eSScd4Pm5JTAgc4%2BBNr8LuxA%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/CAPFALF5hsFcdX-rRHk-p_hkaOH0JdYvyrLEZ9cETWV26CcB-gA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to copy directory from remote machine to ansible machine

2019-04-03 Thread amit ahuja
Hi,

i want to know if there is any way to copy complete directory from remote
machine to local ansible machine . i tried to used fetch method but it is
copying files with complete path which i dont want . pls help .

thanks
Amit

-- 
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/CAMW2Xdf2Fh81YHh_C%3DiQ3%2BTk41eSScd4Pm5JTAgc4%2BBNr8LuxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible how to get output as variable without brackets and u

2019-04-03 Thread Stefan Hornburg (Racke)
On 4/3/19 11:47 AM, Jerome Denechaud wrote:
> it works thanks a lot can you explain to me please about the [0][0]
> thanks in advance
> 

OK, say you have the following query:

select first_name, last_name from test_table

With two results:

Test | Tester
Foo  | Bar

In your smth variable it will look like that:

[["Test", "Tester"]["Foo", "Bar"]]

smth[0][0] = Test
smth[0][1] = Tester
smth[1][0] = Foo
smth[1][1] = Bar

The first index is for the SQL record, the second index for the fields you put 
into the select statement.

Regards
Racke

> Le mer. 3 avr. 2019 à 11:42, Stefan Hornburg (Racke)  > a écrit :
> 
> On 4/3/19 11:35 AM, wanex...@gmail.com  wrote:
> > I have the result of a query from ansible and I tried to use the result 
> as a variable
> >
> > My playbook is like this
> >
> > |-name:Queryoracle_sql:username:"{{ user }}"password:"{{ password 
> }}"service_name:"{{ service_name }}"sql:"select smth
> > from table where smth like 'OK_%'"register:smth"|
> >
> > the result is formatted as below
> >
> > |"msg":[["SMTH"]]|
> >
> > no stdout, no stderr
> >
> > after this I want to use my variable
> >
> > |-name:echo shell:echo {{smth.msg[0]}}>/tmp/test|
> >
> > and the outuput is like this:
> >
> > [uSMTH]
> >
> > How to remove brackets and 'u' , I know it s a list but I can t get rid 
> of this
> >
> > I tried to convert in yaml or json format no luck , this last add some 
> retrun carriage with
> >
> > ||to_yaml |to_json |to_nice_yaml |to_nice_json|
> >
> > Any advice ?
> 
> Using smth[0][0] should do the trick (first field in the first sql 
> record).
> 
> Regards
>          Racke
> 
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to
> > ansible-project+unsubscr...@googlegroups.com 
> 
>  >.
> > To 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/737ba56a-896f-4506-b297-7d84458594b7%40googlegroups.com
> >
> 
> .
> > For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to
> ansible-project+unsubscr...@googlegroups.com 
> .
> To 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/00407cd6-33b6-9b4f-0779-ad22c877e524%40linuxia.de.
> 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/CADC4zwwApAufpzEeDgnSA%2B72enXytqs_ToYBDLccVkK6im%2B2yg%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.


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

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web vi

Re: [ansible-project] Ansible how to get output as variable without brackets and u

2019-04-03 Thread Jerome Denechaud
it works thanks a lot can you explain to me please about the [0][0]
thanks in advance

Le mer. 3 avr. 2019 à 11:42, Stefan Hornburg (Racke)  a
écrit :

> On 4/3/19 11:35 AM, wanex...@gmail.com wrote:
> > I have the result of a query from ansible and I tried to use the result
> as a variable
> >
> > My playbook is like this
> >
> > |-name:Queryoracle_sql:username:"{{ user }}"password:"{{ password
> }}"service_name:"{{ service_name }}"sql:"select smth
> > from table where smth like 'OK_%'"register:smth"|
> >
> > the result is formatted as below
> >
> > |"msg":[["SMTH"]]|
> >
> > no stdout, no stderr
> >
> > after this I want to use my variable
> >
> > |-name:echo shell:echo {{smth.msg[0]}}>/tmp/test|
> >
> > and the outuput is like this:
> >
> > [uSMTH]
> >
> > How to remove brackets and 'u' , I know it s a list but I can t get rid
> of this
> >
> > I tried to convert in yaml or json format no luck , this last add some
> retrun carriage with
> >
> > ||to_yaml |to_json |to_nice_yaml |to_nice_json|
> >
> > Any advice ?
>
> Using smth[0][0] should do the trick (first field in the first sql record).
>
> Regards
>  Racke
>
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to
> > ansible-project+unsubscr...@googlegroups.com  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/737ba56a-896f-4506-b297-7d84458594b7%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/ansible-project/737ba56a-896f-4506-b297-7d84458594b7%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
> > For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To 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/00407cd6-33b6-9b4f-0779-ad22c877e524%40linuxia.de
> .
> 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/CADC4zwwApAufpzEeDgnSA%2B72enXytqs_ToYBDLccVkK6im%2B2yg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible how to get output as variable without brackets and u

2019-04-03 Thread Stefan Hornburg (Racke)
On 4/3/19 11:35 AM, wanex...@gmail.com wrote:
> I have the result of a query from ansible and I tried to use the result as a 
> variable
> 
> My playbook is like this
> 
> |-name:Queryoracle_sql:username:"{{ user }}"password:"{{ password 
> }}"service_name:"{{ service_name }}"sql:"select smth
> from table where smth like 'OK_%'"register:smth"|
> 
> the result is formatted as below
> 
> |"msg":[["SMTH"]]|
> 
> no stdout, no stderr
> 
> after this I want to use my variable
> 
> |-name:echo shell:echo {{smth.msg[0]}}>/tmp/test|
> 
> and the outuput is like this:
> 
> [uSMTH]
> 
> How to remove brackets and 'u' , I know it s a list but I can t get rid of 
> this
> 
> I tried to convert in yaml or json format no luck , this last add some retrun 
> carriage with
> 
> ||to_yaml |to_json |to_nice_yaml |to_nice_json|
> 
> Any advice ?

Using smth[0][0] should do the trick (first field in the first sql record).

Regards
 Racke

> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to
> ansible-project+unsubscr...@googlegroups.com 
> .
> To 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/737ba56a-896f-4506-b297-7d84458594b7%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.


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

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To 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/00407cd6-33b6-9b4f-0779-ad22c877e524%40linuxia.de.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


[ansible-project] Ansible how to get output as variable without brackets and u

2019-04-03 Thread wanexa77


I have the result of a query from ansible and I tried to use the result as 
a variable

My playbook is like this

- name: Query
  oracle_sql:
username: "{{ user }}"
password: "{{ password }}"
service_name: "{{ service_name }}"
sql: "select smth  from table where smth like 'OK_%'"
  register: smth"

the result is formatted as below

"msg": [
[
"SMTH"
]]

no stdout, no stderr

after this I want to use my variable

- name: echo
  shell: echo {{ smth.msg[0] }} > /tmp/test

and the outuput is like this:

[uSMTH]

How to remove brackets and 'u' , I know it s a list but I can t get rid of 
this

I tried to convert in yaml or json format no luck , this last add some 
retrun carriage with

| to_yaml | to_json|to_nice_yaml| to_nice_json

Any advice ?

-- 
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/737ba56a-896f-4506-b297-7d84458594b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] LDAP integration with ldap_entry module.

2019-04-03 Thread Nikhil
Hi,

  Am trying to interface with LDAP on Linux and creating a new user. if uid 
doesn't exist, then it should ideally create one. However, am getting below 
error. 

My ansible playbbok is as below:

- name: LDAP user check
  hosts: LOCAL
  tasks:
  - name: check ldap entry
ldap_entry:
dn: cn=admin,dc=example,dc=com
objectClass:
- simpleSecurityObject
- organizationalRole

  - name: Ensure an LDAP entry exists for uid
ldap_entry:
   server_uri: ldaps://directory.example.com:636
   bind_dn: cn=admin,dc=example,dc=com
   bind_pw: XX
   dn: uid=njain10,ou=people,dc=example,dc=com
   objectClass:
- account
   attributes:
   uid: njain10

ERROR:
--

TASK [Ensure an LDAP entry exists for uid] 
*
An exception occurred during task execution. To see the full traceback, use 
-vvv. The error was: NO_SUCH_OBJECT: {'matched': u'dc=example,dc=com', 
'desc': u'No such object'}
fatal: [192.168.XXX.XXX]: FAILED! => {"changed": false, "details": 
"{'matched': u'dc=example,dc=com', 'desc': u'No such object'}", "msg": 
"Entry action failed."}


Appreciate anyone's help here.

Regards,
Nikhil

-- 
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/97e07c4f-c8a9-4f3b-b854-cc101d33126f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Fwd: Us congress hearing of maan alsaan Money laundry قضية الكونغجرس لغسيل الأموال للمليادير معن الصانع

2019-04-03 Thread Raghavendra Rao
Dont forward such useless stuff on a purely technical group.

On Wed, 3 Apr 2019, 03:45 safi al,  wrote:

>
>
>
>
> YouTube videos of
>
>
>
>  U.S. Congress money laundering hearing
>
>
> of
>
> Saudi Billionaire  " Maan  Al sanea"
>
>  with *bank of America*
>
>
> and  The  owner of Saad Hospital and  Schools
>
>  in the Eastern Province in *Saudi Arabia*
>
>
>
> and the Chairman of the Board of Directors of Awal Bank  in *Bahrain*
>
>
> With Arabic Subtitles
>
>
> http://www.youtube.com/watch?v=mIBNnQvhU8s
>
>
>
>
>
> *موقع اليوتيوب الذي عرض جلسة استماع الكونجرس الأمريكي *
>
> * لمتابعة نشاطات غسل الأموال ونشاطات*
>
>
>
> *السعودي معن عبدالواحد الصانع*
>
>
>
> *مالك مستشفى  وشركة سعد  ومدارس سعد بالمنطقة الشرقية بالسعودية   ورئيس
> مجلس ادارة بنك اوال البحريني*
>
>
>
> *مترجم باللغة العربية*
>
>
>
> http://www.youtube.com/watch?v=mIBNnQvhU8s
>
>
>
>
> --
> 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/CACKBTFGjLH-JoEDFcEr%3DHqRZHFFdfLghtGTQHPXSWG_sviyNTA%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/CAKbF63g%2Bscq4AMJV1dhokXsqahrhdRX6hZ10W1zay_Nb3v4FCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.