Hello Matt,
i tried with task
- name: searching the rpm into {{ reponame }} repo
shell: pulp-admin rpm repo content rpm --repo-id={{reponame}} --match
'filename={{ item }}'
with_items: "{{ rpmname | default([]) }}"
register: pulp
when: search is defined
failed_when: escape in pulp.results.[0].stdout
vars:
escape: "\u001b[0m"
But get jinja templating error as below:-
TASK [mobi_ansible_role_pulp : searching the rpm into infra]
******************************
task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:5
Saturday 06 April 2019 09:55:41 +0000 (0:00:02.011) 0:00:02.434
********
fatal: [node]: FAILED! =>
msg: 'The conditional check ''escape in pulp.results.[0].stdout'' failed.
The error was: template error while templating string: expected name or
number. String: {% if escape in pulp.results.[0].stdout %} True {% else %}
False {% endif %}'
I tried use following syntax also:-
- name: searching the rpm into {{ reponame }} repo
shell: pulp-admin rpm repo content rpm --repo-id={{reponame}} --match
'filename={{ item }}'
with_items: "{{ rpmname | default([]) }}"
register: pulp
when: search is defined
failed_when: 'escape in pulp.results.[0].stdout'
vars:
escape: "\u001b[0m"
TASK [mobi_ansible_role_pulp : searching the rpm into infra]
******************************
task path: /etc/ansible/roles/mobi_ansible_role_pulp/tasks/pulp.yaml:5
Saturday 06 April 2019 09:56:37 +0000 (0:00:02.166) 0:00:02.655
********
fatal: [node]: FAILED! =>
msg: 'The conditional check ''escape in pulp.results.[0].stdout'' failed.
The error was: template error while templating string: expected name or
number. String: {% if escape in pulp.results.[0].stdout %} True {% else %}
False {% endif %}'
Any Help will be much appreciated..
On Sat, Apr 6, 2019 at 1:16 AM Matt Martz <[email protected]> wrote:
> You would need to convert that value from a shell escape sequence, to a
> python escape sequence, for consumption by PyYAML.
>
> The easiest way to express this will likely be:
>
> - name: searching the rpm into pulp repo
> shell: pulp-admin rpm repo content rpm --repo-id=mobi-snapshots --match
> 'filename={{ item }}'
> with_items: "{{ rpmname | default([]) }}"
> register: pulp
> when: rpmsearch is defined
> failed_when: escape in pulp.results.[0].stdout
> vars:
> escape: "\u001b[0m"
>
>
> On Fri, Apr 5, 2019 at 1:12 PM Kunalsing Thakur <[email protected]>
> wrote:
>
>> Gentle reminder, is anyone can help on this
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/ba24777d-4e0d-4899-9c6a-419b866124a2%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Matt Martz
> @sivel
> sivel.net
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAD8N0v_TCdRSuRUZg%2BBR0LQEU%3Dc69XsExQd8gKHCGs_PP%3DLF%3DQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAD8N0v_TCdRSuRUZg%2BBR0LQEU%3Dc69XsExQd8gKHCGs_PP%3DLF%3DQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
[image: --]
kunalsing thakur
[image: https://]about.me/kunalsingthakur
<https://about.me/kunalsingthakur?promo=email_sig&utm_source=email_sig&utm_medium=email_sig&utm_campaign=external_links>
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CANErU6kPQ9YqC29iYkBzkTSFQPjAvfqZYLr0eQOAB1ixwxzxfg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.