Ansible delegate to another host

10 views
Skip to first unread message

Amit Juneja

unread,
Feb 21, 2020, 1:33:18 PM2/21/20
to Ansible Project
Hi everyone,

I would appreciate if you could please look at my issue below and provide your suggestions -

GOAL - Identify if the data in lower environment is scrambled.

Steps - 
1. Identify all lower environment and form sql query of random records to run in PROD
2. Dynamically identify the prod server IP address
3. Run the sql query from lower environment task on PROD server

Steps 1 and 2 are working fine, but in the playbook if I use "delegate_to" with prod server ip (identified as part of step 2), it fails.

Query : In my scenario, If I use delegate_to option, does that mean its the UAT server ( and not the Ansible server) trying to connect to PROD?


Please suggest an alternative approach. Let me know if you need more details.

Thanks
Amit

Stefan Hornburg (Racke)

unread,
Feb 21, 2020, 1:38:35 PM2/21/20
to ansible...@googlegroups.com
On 2/21/20 7:33 PM, Amit Juneja wrote:
> Hi everyone,
>
> I would appreciate if you could please look at my issue below and provide your suggestions -
>
> GOAL - Identify if the data in lower environment is scrambled.
>
> Steps - 
> 1. Identify all lower environment and form sql query of random records to run in PROD
> 2. Dynamically identify the prod server IP address
> 3. Run the sql query from lower environment task on PROD server
>
> Steps 1 and 2 are working fine, but in the playbook if I use "delegate_to" with prod server ip (identified as part of
> step 2), it fails.
>
> Query : In my scenario, If I use delegate_to option, does that mean its the UAT server ( and not the Ansible server)
> trying to connect to PROD?
>

The Ansible controller connects to the host in delegate_to:.
>
> Please suggest an alternative approach. Let me know if you need more details.
>

Well obviously the task you are running and the error message.

Regards
Racke

> 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-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/7c4e2d5a-095b-4ea1-a98c-377c59e2d07b%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/7c4e2d5a-095b-4ea1-a98c-377c59e2d07b%40googlegroups.com?utm_medium=email&utm_source=footer>.


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

signature.asc

James Cassell

unread,
Feb 21, 2020, 4:53:36 PM2/21/20
to Ansible List

On Fri, Feb 21, 2020, at 1:33 PM, Amit Juneja wrote:
> Hi everyone,
>
> I would appreciate if you could please look at my issue below and
> provide your suggestions -
>
> GOAL - Identify if the data in lower environment is scrambled.
>
> Steps -
> 1. Identify all lower environment and form sql query of random records
> to run in PROD
> 2. Dynamically identify the prod server IP address
> 3. Run the sql query from lower environment task on PROD server
>
> Steps 1 and 2 are working fine, but in the playbook if I use
> "delegate_to" with prod server ip (identified as part of step 2), it
> fails.
>

Make sure the host is in your inventory, or try add_host to get it there.

V/r,
James Cassell
Reply all
Reply to author
Forward
0 new messages