Hi stefan ,
It is for rest api call for individual REST end points (Resource/service
end points).
and Below is the resturlcall.yaml which is included in above code.
Basically i want to POST the data on REST url only when particular
variable is defined. (as shown in above code item1Conf,item2Conf, item3Conf
and these variable carries actual data to be posted)
resturlcall.yml -
#tasks:
- name: application resource provisioning
uri:
url: https://{{ hostname}}/myconfig/rest/{{item.resource}}
body_format: json
method: PUT
body: "{{item.name}}"
user: "{{ restapi_user }}"
password: "{{ restapi_password }}"
force_basic_auth: true
follow_redirects: all
Regards
Rahul
On Wed, 11 Dec 2019 at 20:35, Stefan Hornburg (Racke) <[email protected]>
wrote:
> On 12/11/19 3:33 PM, Rahul Kumar wrote:
> > Hi Ansible Gurus,
> > How can I optimize below code ? below is the sufficient code to
> understand the problem...
>
> The code doesn't tell me anything what your objectives are and which tasks
> you are actually
> running.
>
> There is no point in optimizing code when it might be wrong in the first
> place.
>
> Regards
> Racke
>
> >
> > - name: Application item1Conf provisioning
> > include_tasks: resturlcall.yml
> > with_items:
> > - { name: '{{item1Conf}}', resource: 'item1' }
> > when: item1Conf is defined
> >
> > - name: Application item2Conf provisioning
> > include_tasks: resturlcall.yml
> > with_items:
> > - { name: '{{item2Conf}}', resource: 'item2' }
> > when: item2Conf is defined
> >
> > - name: Application item3Conf provisioning
> > include_tasks: resturlcall.yml
> > with_items:
> > - { name: '{{item3Conf}}', resource: 'item3' }
> > when: item3Conf is defined
> >
> > Regards
> > Rahul
> >
> > --
> > 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] <mailto:
> [email protected]>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-project/CAGH8rEy6yh4hbRRnitfRWsp7gs7vYKxtDiv98NazfZ6MQc9F2Q%40mail.gmail.com
> > <
> https://groups.google.com/d/msgid/ansible-project/CAGH8rEy6yh4hbRRnitfRWsp7gs7vYKxtDiv98NazfZ6MQc9F2Q%40mail.gmail.com?utm_medium=email&utm_source=footer
> >.
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/7c5e1930-bb12-92e6-4928-08b3a646a10b%40linuxia.de
> .
>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAGH8rEyiYbY62CrX%3DPNRyi9Upb_-C5R559mT%2BNpkqq0zUCUhGg%40mail.gmail.com.