Re: [ansible-project] depending on extra variables call a template

2024-05-20 Thread Prady A
Hi Dick,

Sorry to confuse.
We already have a Job template which installs the DB independently.
ALSO we ha have a workflow which builds server without DB Installation.

Service Catalog we use this term in ServiceNow.
The catalog will call AAP via rest and execute the job templates based on
the service catalog..

Regards

On Tue, 21 May 2024 at 3:31, Dick Visser  wrote:

> I'm not sure what "call a template which install the actual db" means?
> There is a template task that can template a file.
> And if you want to install a db then that would consist of a number of
> tasks that do that.
> And I also don't know what a "service catalog" is in an ansible context?
>
> Can you share the playbook that you have right now?
> Dick
>
> On Mon, 20 May 2024 at 19:39, Prady A  wrote:
>
>> Hi experts,
>>
>> I m trying to add a feature to install db after installing vm. In my
>> service catalog if I select Postgres db it is passing extra variable as
>> Postgres to ansible  platform. Using that variable how can a call a
>> template which install the actual db..
>>
>> Regards
>> PD
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAEuB3AqWL68%3DpYMjxSp%2BAfpoXzWVH-fA8h-yXV0zVDc%2BMfDbEA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAEuB3AqWL68%3DpYMjxSp%2BAfpoXzWVH-fA8h-yXV0zVDc%2BMfDbEA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAF8BbLYX1CdCGseo%2BPo4vSZkt9UfmgicokzYjDUqG4qXj1a43w%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAF8BbLYX1CdCGseo%2BPo4vSZkt9UfmgicokzYjDUqG4qXj1a43w%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Aoe%3DG%3DYELTejPeHW9xb2%3D2QYGCkoh%2Bq3umUchWnSTFvMw%40mail.gmail.com.


[ansible-project] depending on extra variables call a template

2024-05-20 Thread Prady A
Hi experts,

I m trying to add a feature to install db after installing vm. In my
service catalog if I select Postgres db it is passing extra variable as
Postgres to ansible  platform. Using that variable how can a call a
template which install the actual db..

Regards
PD

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3AqWL68%3DpYMjxSp%2BAfpoXzWVH-fA8h-yXV0zVDc%2BMfDbEA%40mail.gmail.com.


Re: [ansible-project] Get_url

2024-04-10 Thread Prady A
Yes you are right.
The ssl certificate was pretty old and I ve no idea how to update it also.

So I skipped Ssl verification and it worked
get_url:
  dest: /tmp
  url: https://
  username: <>
  password: <>
*   validate_certs: no*

Thank you again both of you.

Regards
PD

On Wed, 10 Apr 2024 at 14:14, Prady A  wrote:

> Thank you I see. I ll check the script. Can we call the execute
> the get_url without ssl certificate ?
>
> This is ansible verbose report. Seems the SSL is too old.
>
>  Failed to connect to the host via ssh: OpenSSH_7.4p1, *OpenSSL
>> 1.0.2k-fips  26 Jan 2017*
>> debug1: Reading configuration data /etc/ssh/ssh_config
>> debug1: /etc/ssh/ssh_config line 11: Applying options for *
>> debug1: auto-mux: Trying existing master
>> debug2: fd 3 setting O_NONBLOCK
>> debug2: mux_client_hello_exchange: master version 4
>> debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
>> debug3: mux_client_request_session: entering
>> debug3: mux_client_request_alive: entering
>> debug3: mux_client_request_alive: done pid = 4632
>> debug3: mux_client_request_session: session request sent
>> debug1: mux_client_request_session: master session id: 2
>> debug3: mux_client_read_packet: read header failed: Broken pipe
>> debug2: Received exit status from master 1
>> Shared connection to server1234 closed.
>>
>
> Regards
>
> On Wed, Apr 10, 2024 at 5:08 PM Stefan Hornburg (Racke) 
> wrote:
>
>> On 10/04/2024 09:55, Prady A wrote:
>> > Thanks dick
>> >
>> > Yes by default those commands doesn’t comes oob.
>> >
>> > Tried with verbosity mode.
>> > Request failed:> (ssl.c:1125)>”
>>
>> It is possible that the SSL setup on the target is too old. You could
>> check that
>> with the "testssl" script from the controller (https://testssl.sh/).
>>
>> Regards
>>  Racke
>>
>> >
>> > On Wed, 10 Apr 2024 at 16:15, Dick Visser > dnmvis...@gmail.com>> wrote:
>> >
>> > Too bad, that would have helped to indicate SSL issues on that
>> remote host.
>> > Try running with more verbosity (-vvv) and see what that returns.
>> >
>> > --
>> > 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%2bunsubscr...@googlegroups.com>.
>> > To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAF8BbLZmEaBXSvNPCJK7cAmxmm0uq%3DEwPq27omdkLiq8eL5beQ%40mail.gmail.com
>> <
>> https://groups.google.com/d/msgid/ansible-project/CAF8BbLZmEaBXSvNPCJK7cAmxmm0uq%3DEwPq27omdkLiq8eL5beQ%40mail.gmail.com
>> >.
>> >
>> > --
>> > 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAEuB3ArncgH9yXxg_Gh_v8xqQ9NQcgNNV8xm_HABkN5kiBRRsA%40mail.gmail.com
>> <
>> https://groups.google.com/d/msgid/ansible-project/CAEuB3ArncgH9yXxg_Gh_v8xqQ9NQcgNNV8xm_HABkN5kiBRRsA%40mail.gmail.com?utm_medium=email&utm_source=footer
>> >.
>>
>> --
>> Automation expert - Ansible and friends
>> Linux administrator & Debian maintainer
>> Perl Dancer & conference hopper
>>
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/1564c781-cba4-46f1-9228-9a4fac8ef2a7%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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Aq08O_SeZzT71M0Aa%2BeKiGhMKC7nVc%2BkLoXimus3qgS0Q%40mail.gmail.com.


Re: [ansible-project] Get_url

2024-04-10 Thread Prady A
Thank you I see. I ll check the script. Can we call the execute the get_url
without ssl certificate ?

This is ansible verbose report. Seems the SSL is too old.

 Failed to connect to the host via ssh: OpenSSH_7.4p1, *OpenSSL
> 1.0.2k-fips  26 Jan 2017*
> debug1: Reading configuration data /etc/ssh/ssh_config
> debug1: /etc/ssh/ssh_config line 11: Applying options for *
> debug1: auto-mux: Trying existing master
> debug2: fd 3 setting O_NONBLOCK
> debug2: mux_client_hello_exchange: master version 4
> debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
> debug3: mux_client_request_session: entering
> debug3: mux_client_request_alive: entering
> debug3: mux_client_request_alive: done pid = 4632
> debug3: mux_client_request_session: session request sent
> debug1: mux_client_request_session: master session id: 2
> debug3: mux_client_read_packet: read header failed: Broken pipe
> debug2: Received exit status from master 1
> Shared connection to server1234 closed.
>

Regards

On Wed, Apr 10, 2024 at 5:08 PM Stefan Hornburg (Racke) 
wrote:

> On 10/04/2024 09:55, Prady A wrote:
> > Thanks dick
> >
> > Yes by default those commands doesn’t comes oob.
> >
> > Tried with verbosity mode.
> > Request failed: (ssl.c:1125)>”
>
> It is possible that the SSL setup on the target is too old. You could
> check that
> with the "testssl" script from the controller (https://testssl.sh/).
>
> Regards
>  Racke
>
> >
> > On Wed, 10 Apr 2024 at 16:15, Dick Visser  dnmvis...@gmail.com>> wrote:
> >
> > Too bad, that would have helped to indicate SSL issues on that
> remote host.
> > Try running with more verbosity (-vvv) and see what that returns.
> >
> > --
> > 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%2bunsubscr...@googlegroups.com>.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAF8BbLZmEaBXSvNPCJK7cAmxmm0uq%3DEwPq27omdkLiq8eL5beQ%40mail.gmail.com
> <
> https://groups.google.com/d/msgid/ansible-project/CAF8BbLZmEaBXSvNPCJK7cAmxmm0uq%3DEwPq27omdkLiq8eL5beQ%40mail.gmail.com
> >.
> >
> > --
> > 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAEuB3ArncgH9yXxg_Gh_v8xqQ9NQcgNNV8xm_HABkN5kiBRRsA%40mail.gmail.com
> <
> https://groups.google.com/d/msgid/ansible-project/CAEuB3ArncgH9yXxg_Gh_v8xqQ9NQcgNNV8xm_HABkN5kiBRRsA%40mail.gmail.com?utm_medium=email&utm_source=footer
> >.
>
> --
> Automation expert - Ansible and friends
> Linux administrator & Debian maintainer
> Perl Dancer & conference hopper
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/1564c781-cba4-46f1-9228-9a4fac8ef2a7%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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ArQ6tYUHzDts4q-XjGqskyZuF8uxB_bssHCY3Bzf%2Bm4OQ%40mail.gmail.com.


Re: [ansible-project] Get_url

2024-04-10 Thread Prady A
Thanks dick

Yes by default those commands doesn’t comes oob.

Tried with verbosity mode.
Request failed:”

Regards




On Wed, 10 Apr 2024 at 16:15, Dick Visser  wrote:

> Too bad, that would have helped to indicate SSL issues on that remote host.
> Try running with more verbosity (-vvv) and see what that returns.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAF8BbLZmEaBXSvNPCJK7cAmxmm0uq%3DEwPq27omdkLiq8eL5beQ%40mail.gmail.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ArncgH9yXxg_Gh_v8xqQ9NQcgNNV8xm_HABkN5kiBRRsA%40mail.gmail.com.


Re: [ansible-project] Get_url

2024-04-09 Thread Prady A
Thanks but both curl and wget command not found..

Regards

On Wed, 10 Apr 2024 at 15:12, Dick Visser  wrote:

> Are you able to use curl on that remote host with the same URL and
> credentials?
>
> Sent from Gmail Mobile
>
>
> On Wed, 10 Apr 2024 at 07:36, Prady A  wrote:
>
>> Hi experts
>>
>> I ve been trying get_url in Aix server but no luck yet..
>>
>>
>> In Linux the below ansible code is working
>>
>>  get_url:
>>   dest: /tmp
>>   url: https://
>>   username: <>
>>   password: <>
>>
>>  But in AIX machine it is giving below error.
>>
>> .. Request failed:
>>
>>
>> Any pointer or advice pls..
>>
>> Regards
>> Prady
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAEuB3AqzPGi1jF3Za46_NHPGUxrNbOG6115e7vJj-YXtT%3D8n8g%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAEuB3AqzPGi1jF3Za46_NHPGUxrNbOG6115e7vJj-YXtT%3D8n8g%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAF8BbLacTD%3DNJzsSM%3D%3DBy091owXhNnZzygM0sDr4dT642w6EaQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAF8BbLacTD%3DNJzsSM%3D%3DBy091owXhNnZzygM0sDr4dT642w6EaQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Ap3qNPsJsPuCPuJ5L_O20oD7J2v7%3Da8VmzPUtK0eQCKFg%40mail.gmail.com.


[ansible-project] Get_url

2024-04-09 Thread Prady A
Hi experts

I ve been trying get_url in Aix server but no luck yet..


In Linux the below ansible code is working

 get_url:
  dest: /tmp
  url: https://
  username: <>
  password: <>

 But in AIX machine it is giving below error.

.. Request failed:


Any pointer or advice pls..

Regards
Prady

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3AqzPGi1jF3Za46_NHPGUxrNbOG6115e7vJj-YXtT%3D8n8g%40mail.gmail.com.


Re: [ansible-project] Ternary or when in ansible

2024-03-07 Thread Prady A
Thanks Dick that’s what I needed

On Fri, 8 Mar 2024 at 00:36, Dick Visser  wrote:

>
>
> On Thu, 7 Mar 2024 at 16:02, Prady A  wrote:
>
>> Hi again
>>
>> For simplicity I thought to do like this.
>>
>> Current code
>> - name: Subscribe my repo
>>shell: |
>>   subscription-manager register bla bla
>>
>>
>> *After*
>>
>> - name: Subscribe US REPO
>>shell: |
>>   subscription-manager register US server
>> When:
>> IS_UK = false
>>
>> - name: Subscribe UK REPO
>>shell: |
>>   subscription-manager register UK server
>> When:
>> IS_UK = True
>>
>> Regards
>> PD
>>
>>
> I would use a helper variable to you can reuse in some places, for example
> in the task title:
>
>
>   vars:
> IS_UK: false
> server: "{{ IS_UK | ternary('UK-server', 'US-server') }}"
>
>   tasks:
> - name: "Subscribe to {{ server }} repo"
>   ansible.builtin.shell:
> echo subscription-managed register {{ server }}
>
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAF8BbLbpJmFkf_2wvny6EBWRRhb%3DdF0PLfYW_MqRsicCkDroPA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAF8BbLbpJmFkf_2wvny6EBWRRhb%3DdF0PLfYW_MqRsicCkDroPA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ApzLQBmHWkem%3D716BBJ6MXwgq1g4h%3Dd59ifToKo%3Dst_Tg%40mail.gmail.com.


Re: [ansible-project] Ternary or when in ansible

2024-03-07 Thread Prady A
Hi again

For simplicity I thought to do like this.

Current code
- name: Subscribe my repo
   shell: |
  subscription-manager register bla bla


*After*

- name: Subscribe US REPO
   shell: |
  subscription-manager register US server
When:
IS_UK = false

- name: Subscribe UK REPO
   shell: |
  subscription-manager register UK server
When:
IS_UK = True

Regards
PD



On Thu, 7 Mar 2024 at 22:44, Prady A  wrote:

> Hi TODD,
>
> Thanks for your reply.
> Yes I ve that variable(IS_UK= TRUE)
> defined already  and it is coming from upstream.
> Just need to the logic for efficient if then syntax in ansible.
>
> Secondly subscription manager is shell command.
>
> Regards
> Prady
>
> On Thu, 7 Mar 2024 at 21:42, Todd Lewis  wrote:
>
>> Is "Subscription-manager" a command you want to run, or part of a string
>> you're trying to initialize, or are you trying to set a variable for later
>> use?
>> Is "IS_UK" a variable you already have, or is the problem how to create
>> or set "IS_UK" itself?
>>
>> In other words, you've described very well what you want to do, but you
>> haven't described at all the problem(s) you've encountered doing it with
>> Ansible.
>>
>>
>> On 3/7/24 12:14 AM, Prady A wrote:
>>
>> Hi Ansible experts
>>
>> I am confused which one to use
>>
>> I want to subscribe US servers default but if the server is in UK I want
>> to subscription should Point to UK capsule server..
>>
>> If IS_UK= TRUE
>> Subscription-manager 
>> then
>> Subscription-manager 
>>
>>
>> Regards
>>
>>
>>
>>
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAEuB3ArAMzXhjok0YTnJ40a3QbCKm2-pAhR%2Bb%3DRn3m%3DLiPkmgQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAEuB3ArAMzXhjok0YTnJ40a3QbCKm2-pAhR%2Bb%3DRn3m%3DLiPkmgQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>>
>>
>> --
>> Todd
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/955e9331-132a-4140-9a31-160e0bb30a07%40gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/955e9331-132a-4140-9a31-160e0bb30a07%40gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3AoE4obGmXGitM%3Dp-9d4EG2tMyswrGAq4-rbGv60sqVrQQ%40mail.gmail.com.


Re: [ansible-project] Ternary or when in ansible

2024-03-07 Thread Prady A
Hi TODD,

Thanks for your reply.
Yes I ve that variable(IS_UK= TRUE)
defined already  and it is coming from upstream.
Just need to the logic for efficient if then syntax in ansible.

Secondly subscription manager is shell command.

Regards
Prady

On Thu, 7 Mar 2024 at 21:42, Todd Lewis  wrote:

> Is "Subscription-manager" a command you want to run, or part of a string
> you're trying to initialize, or are you trying to set a variable for later
> use?
> Is "IS_UK" a variable you already have, or is the problem how to create or
> set "IS_UK" itself?
>
> In other words, you've described very well what you want to do, but you
> haven't described at all the problem(s) you've encountered doing it with
> Ansible.
>
>
> On 3/7/24 12:14 AM, Prady A wrote:
>
> Hi Ansible experts
>
> I am confused which one to use
>
> I want to subscribe US servers default but if the server is in UK I want
> to subscription should Point to UK capsule server..
>
> If IS_UK= TRUE
> Subscription-manager 
> then
> Subscription-manager 
>
>
> Regards
>
>
>
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAEuB3ArAMzXhjok0YTnJ40a3QbCKm2-pAhR%2Bb%3DRn3m%3DLiPkmgQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAEuB3ArAMzXhjok0YTnJ40a3QbCKm2-pAhR%2Bb%3DRn3m%3DLiPkmgQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
>
>
> --
> Todd
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/955e9331-132a-4140-9a31-160e0bb30a07%40gmail.com
> <https://groups.google.com/d/msgid/ansible-project/955e9331-132a-4140-9a31-160e0bb30a07%40gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ArTNXdS54_R95%3Dh_scxegpa0idJWpj5n%3DEDe14K5G_MMg%40mail.gmail.com.


[ansible-project] Ternary or when in ansible

2024-03-06 Thread Prady A
Hi Ansible experts

I am confused which one to use

I want to subscribe US servers default but if the server is in UK I want to
subscription should Point to UK capsule server..

If IS_UK= TRUE
Subscription-manager 
then
Subscription-manager 


Regards

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ArAMzXhjok0YTnJ40a3QbCKm2-pAhR%2Bb%3DRn3m%3DLiPkmgQ%40mail.gmail.com.


Re: [ansible-project] ansible question

2024-03-04 Thread Prady A
Hi

Welcome..
There should be a handler to listen this notification..
The handler should have the same keyword.

Ex:
--- # webserver.yml - name: "Install and configure web server" hosts: "all"
handlers: - name: "Start and enable httpd Service" ansible.builtin.service:
name: "httpd.service" state: "started" enabled: true become: true tasks: -
name: "Install httpd Packages" ansible.builtin.package: name: "httpd"
state: "present" become: true notify: - "Start and enable httpd Service"


Hope it helps..


On Mon, 4 Mar 2024 at 19:12, Christoph Christ 
wrote:

> Hi all,
>
> i have to implement an ansible task. where the action is, to reload the
> dconf for Gnome.
>
> It is telling me: the requested handler "reload dconf" was not found in
> either the main handlers list nor in the listening handlers list.
>
> ---
> - name: Ensure GDM disable-user-list option is enabled
>   ansible.builtin.lineinfile:
>   path: "{{ item.file }}"
>   regexp: "{{ item.regexp }}"
>   line: "{{ item.line }}"
>   create: true
>   owner: root
>   group: root
>   mode: '0644'
>   notify: reload dconf
>   loop:
>   - { file: '/etc/dconf/profile/gdm', regexp: 'user-db', line:
> 'user-db:user' }
>   - { file: '/etc/dconf/profile/gdm', regexp: 'system-db', line:
> 'system-db:gdm' }
>   - { file: '/etc/dconf/profile/gdm', regexp: 'file-db', line:
> 'file-db:/usr/share/gdm/greeter-dconf-defaults'}
>   - { file: '/etc/dconf/db/gdm.d/00-login-screen', regexp:
> '\[org\/gnome\/login-screen\]', line: '[org/gnome/login-screen]' }
>   - { file: '/etc/dconf/db/gdm.d/00-login-screen', regexp:
> 'disable-user-list=', line: 'disable-user-list=true' }
> ...
>
> Could you pleas point me into the right direction how to fix this issue? I
> have tested this manually and it is working, why is it not working, when
> called in a bigger scope?
>
> KR
> Christoph
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/6837e6ad-d474-45d5-b60e-d4e2804684f0n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3AofFyS-xpQmVp6ghBkDDcP6hVmacagZbqEiNo1UgRW6JQ%40mail.gmail.com.


Re: [ansible-project] Rhel 7-> 8 upgrade

2024-02-22 Thread Prady A
Thank you.. I ll try to use the modules instead.
And we run ansible with the root user ..
also when I rebooting my server manually the default python link is getting
updated to pyhon3

Now I raised the issue to RH let’s see what comes up

Thanks again

On Fri, 23 Feb 2024 at 06:18, Evan Hisey  wrote:

> Lines 77-79 and 107-110 would be the ones I would change. Using Modules is
> cleaner, and more predictable typically.
>
> Have you confirmed the user specific settings for the ansible user on the
> remote host? The per user alternative may be different than the system.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAEcFzYzz8gyh6kqfLaZ_dypsNWJKLiL%3DO%3DDsBUrBqnS3ys_HFg%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ApUfUJQ%3D5L5i4Dv3NX09S%2B6PoJ-fu%2B40LDKpifwkHUWvQ%40mail.gmail.com.


Re: [ansible-project] Rhel 7-> 8 upgrade

2024-02-21 Thread Prady A
Thank you the problem is before updating to Rhel 8 also when it reboots in
the last below task (line#99) the alternatives is updating to python3 link
which is not present . Do you suggest to use subscription module in line#79
instead of shell?



   1. name: Get root volume size
   2.   set_fact:
   3. root_size: "{{ (ansible_mounts |selectattr('mount', 'equalto',
   '/') | list)[0].size_total }}"
   4.
   5. - name: Get root volume free size
   6.   set_fact:
   7. root_available: "{{ (ansible_mounts |selectattr('mount',
   'equalto', '/') | list)[0].size_available }}"
   8.
   9. - name: root filesystem expansion
   10.   block:
   11.
   12. - name: Calculte required additional root space
   13.   set_fact:
   14. root_reqd: "{{ ((root_size | int + (4294967296 -
   root_available | int)) / 1024 / 1024) | int }}"
   15.
   16. - name: Resize root filesystem to {{ root_reqd }}MB
   17.   lvol:
   18. vg: rootvg
   19. lv: LogVol00
   20. size: "{{ root_reqd }}M"
   21. resizefs: true
   22.
   23.   when: root_available | int < 4294967296
   24.
   25. - name: Get /var volume size
   26.   set_fact:
   27. var_size: "{{ (ansible_mounts |selectattr('mount', 'equalto',
   '/var') | list)[0].size_total }}"
   28.
   29. - name: Get /var volume free size
   30.   set_fact:
   31. var_available: "{{ (ansible_mounts |selectattr('mount',
   'equalto', '/var') | list)[0].size_available }}"
   32.
   33. - name: /var filesystem expansion
   34.   block:
   35.
   36. - name: Calculte required additional var space
   37.   set_fact:
   38. var_reqd: "{{ ((var_size | int + (5368709120 - var_available
   | int)) / 1024 / 1024) | int }}"
   39.
   40. - name: Resize /var filesystem to {{ var_reqd }}MB
   41.   lvol:
   42. vg: rootvg
   43. lv: LogVol03
   44. size: "{{ var_reqd }}M"
   45. resizefs: true
   46.
   47.   when: var_available | int < 5368709120
   48.
   49.  Pre-upgrade tasks 
   50. - name: Remove unwanted packages
   51.   yum:
   52. name: "{{ item }}"
   53. state: absent
   54.   loop: "{{ remove_rpms }}"
   55.
   56. - name: Remove unwanted data
   57.   file:
   58. path: "{{ item }}"
   59. state: absent
   60.   loop: "{{ remove_files }}"
   61.
   62. - name: Get contents of /usr/openv/ folder
   63.   find:
   64. paths: /usr/openv/
   65. file_type: any
   66.   register: openv
   67.
   68. - name: Remove contents of /usr/openv/ folder
   69.   file:
   70. path: "{{ item.path }}"
   71. state: absent
   72.   loop: "{{ openv.files }}"
   73.   loop_control:
   74. label: "{{ item.path }}"
   75.
   76. - name: Subscribe to RHEL7 Repo
   77.   shell: |
   78. yum clean all
   79. subscription-manager register --org="X"
   --activationkey="rhel7-prod" --force
   80.
   81. - name: Yum update
   82.   yum:
   83. state: latest
   84.
   85. - name: Backup /etc/fstab file
   86.   copy:
   87. src: /etc/fstab
   88. dest: /etc/fstab.PreUpgrade
   89. remote_src: yes
   90. force: false
   91.
   92. - name: Remove non system entries from /etc/fstab
   93.   shell: |
   94. cat /etc/fstab|egrep -w '/ |/opt |/boot |/tmp |/var |swap |^#' >
   /tmp/fstab
   95. /bin/cp /tmp/fstab /etc/fstab
   96.
   97. - debug: var=ansible_python_version
   98.
   99. - name: Reboot server
   100.   reboot:
   101. reboot_timeout: 3600
   102.
   103. - debug: var=ansible_python_version
   104.
   105.  Leapp pre-upgrade tasks 
   106. - name: Unsubscribe from satellite
   107.   shell: |
   108. yum clean all
   109. subscription-manager unsubscribe --all
   110. subscription-manager clean


Regards

On Thu, 22 Feb 2024 at 05:00, Evan Hisey  wrote:

> That is a Rhel7 to RHEL 8 change. The default python in REHL7 is Python
> 2.7 while RHEL 8 is python3.6. I would also consider moving the
> subscription tasks to community.general.redhat_subscription module. That
> is should automatically change python version, but you may need to
> disconnect and reconnect to update the user environment.
>
> On Wed, Feb 21, 2024 at 5:07 AM Prady A  wrote:
>
>> Hello all,
>>
>>
>> Upgrading from Rhel7-> 8 using ansible. In the pre upgrade task I
>> performed few checks like space check and yum update and
>> subscription-manager registration. No issues in the beginning tasks..
>>
>> But when performing below task post reboot taskShell:
>>  Yum clean all
>>  Subscription-manager unsubscribe —all
>

[ansible-project] Rhel 7-> 8 upgrade

2024-02-21 Thread Prady A
Hello all,


Upgrading from Rhel7-> 8 using ansible. In the pre upgrade task I performed
few checks like space check and yum update and subscription-manager
registration. No issues in the beginning tasks..

But when performing below task post reboot taskShell:
 Yum clean all
 Subscription-manager unsubscribe —all
 Subscription-manager clean

* It is giving me no such file /usr/bin/python *

 Before running the job In RHEl 7 the python version was pointing to

Python2 /usr/bin/python-> /etc/alternatives/python /etc/alternatives/python
-> /usr/bin/python2

 but after the above task is executed somehow it is changing to
 /usr/bin/python-> /etc/alternatives/python /etc/alternatives/python ->
/usr/bin/python3

 When I performed manually the task command there is no issue .. could you
pls suggest..

Regards
PD

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ApKqRhVmC3DzvX-EpBpebQCk5EKEq3CWkRv_uGH1ni50A%40mail.gmail.com.


Re: [ansible-project] [Ansible-Project] Installation of AAP 2.3

2024-02-14 Thread Prady A
Thanks again. Below both the EE are pointing to the same image I guess.
Anyway both the EE are working fine.


   - *Control Plane Execution Environment:*
   registry.redhat.io/ansible-automation-platform-23/ee-supported-rhel8:latest
   - *Default execution environment: *
   registry.redhat.io/ansible-automation-platform-23/ee-supported-rhel8:latest

I ran the below pull command and now the latest image got updated I guess.
$podman pull 'default ee link'

[awx@controller ~]$ podman images
> REPOSITORY
>TAG   IMAGE IDCREATED
>  SIZE
> registry.redhat.io/ansible-automation-platform-23/ee-supported-rhel8
>  latest 3571afc85a2a  2 months ago  1.68 GB
> 
> eeb06402373b 15 months ago
> 1.65 GB
> registry.redhat.io/ansible-automation-platform-23/ee-minimal-rhel8
> latest c44964e880d4 15 months ago299 MB
> registry.redhat.io/ansible-automation-platform-23/ee-29-rhel8
>   latest  e3efe0afa65e   15 months ago878 MB
> [awx@controller ~]$


Currently focusing on how to call the templates from ServiceNow catalog,
Thanks  a ton..


Regards
PD

On Wed, Feb 14, 2024 at 6:33 PM Bülent ŞENGÜLER 
wrote:

> Hi,
>
> Default EE image link must be like registry.redhat.io/ee-supported:latest,
> can you see this link after edited default EE and you may try
>
> $podman pull 'default ee link'
>
> This process need to login registry.redhat.io successfully
>
> Regards
> Bülent
>
>
>
> 14 Şub 2024 Çar 03:14 tarihinde Prady A  şunu
> yazdı:
>
>> Hi
>>
>> Thank you for your kind reply.
>> I can see the default EE on AAP GUIattached).
>> But no images in CLI. I didn't install any dedicated EE server for
>> execution environment. I ve only Controller IP in the installation
>> inventory file. Please suggest.
>>
>>
>> [prady@controller ~]$ podman images
>> REPOSITORY  TAG IMAGE IDCREATED SIZE
>> [prady@controller ~]$
>>
>> Regards
>>
>>
>> On Wed, Feb 14, 2024 at 4:42 AM Bülent ŞENGÜLER 
>> wrote:
>>
>>> Hello,
>>>
>>> You need to have execution env that is container image. Can You share
>>> aap execution env list on gui and then you can check on shell;
>>> #su  - awx
>>> $podman images (you need to see a few images)
>>> $podman run -it container_image
>>>
>>> Regards
>>> Bulent
>>>
>>>
>>>
>>> 13 Şub 2024 Sal 21:27 tarihinde Prady A  şunu
>>> yazdı:
>>>
>>>> HI All,
>>>>
>>>> Facing acute challenge while running the first job in AAP 2.3.
>>>> StandAlone AAP was installed with success but when I tried to synch demo
>>>> project or my own project it keeps on saying this one line error.
>>>> No idea how to proceed from here. Kindly advise.
>>>>
>>>> ERRO[] invalid internal status, try resetting the pause process
>>>> with "/usr/bin/podman system migrate": could not find any running process:
>>>> no such process.
>>>>
>>>> Regards
>>>> PD
>>>>
>>>> --
>>>> 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 view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/ansible-project/CAEuB3Arx85DRuCxHBTp4znUv8nWgRrDThFitjJXmpQRTLtvJ2A%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/ansible-project/CAEuB3Arx85DRuCxHBTp4znUv8nWgRrDThFitjJXmpQRTLtvJ2A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/CAFqD%3DS_NScsTHTSC0ePy61HZsFxBtKgDnN9khT1q5tmoFc_DxA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/ansible-project/CAFqD%3DS_NScsTHTSC0ePy61HZsFxBtKgDnN9khT1q5tmoFc_DxA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
&g

Re: [ansible-project] [Ansible-Project] Installation of AAP 2.3

2024-02-13 Thread Prady A
Cool 😎 exactly.. Thank you both of you. You made my day today.

Sorry my bad last time I didn’t switch to awx user. It was the same early
error.
But when I executed your given command the templates started running for
the first time.

awx@controller ~]$ podman images
ERRO[] invalid internal status, try resetting the pause process with
"podman system migrate": could not find any running process: no such
process
[awx@controller ~]$ /usr/bin/podman system migrate
stopped 07cf42c6b2c5a7ca831068a99e3e3105fff09927ce153e04fbdc73efecaebbe6
[awx@controller ~]$ podman images
REPOSITORYTAG
  IMAGE ID  CREATEDSIZE
registry.redhat.io/ansible-automation-platform-23/ee-supported-rhel8
 latest  eeb06402373b  15 months ago  1.65 GB
registry.redhat.io/ansible-automation-platform-23/ee-minimal-rhel8
 latest  c44964e880d4  15 months ago  299 MB
registry.redhat.io/ansible-automation-platform-23/ee-29-rhel8
latest  e3efe0afa65e  15 months ago  878 MB
[awx@controller ~]$

 Could you please guide what I need to mention in the
installation inventory file to install AHB . Will below settings are enough
or do I need to create a DB in AHB before executing the setup.sh.
[automationhub]
192.168.253.140

automationhub_admin_password='password'
automationhub_pg_host='192.168.253.140'
automationhub_pg_port=5432
automationhub_pg_database='automationhub'
automationhub_pg_username='automationhub'
automationhub_pg_password='password'
automationhub_pg_sslmode='prefer'

Regards


On Wed, 14 Feb 2024 at 09:57, Paul Brylinski  wrote:

> I ran into this issue last week.
>
> Like Bulent said, I first sudo into awx
>
> #su - awx
>
> and then I run the command it told me to run
>
> /usr/bin/podman system migrate
>
> Then I ran my job template.
>
> Hope this works for you.
>
> Paul
>
> On Tue, Feb 13, 2024 at 7:14 PM Prady A  wrote:
>
>> Hi
>>
>> Thank you for your kind reply.
>> I can see the default EE on AAP GUIattached).
>> But no images in CLI. I didn't install any dedicated EE server for
>> execution environment. I ve only Controller IP in the installation
>> inventory file. Please suggest.
>>
>>
>> [prady@controller ~]$ podman images
>> REPOSITORY  TAG IMAGE IDCREATED SIZE
>> [prady@controller ~]$
>>
>> Regards
>>
>>
>> On Wed, Feb 14, 2024 at 4:42 AM Bülent ŞENGÜLER 
>> wrote:
>>
>>> Hello,
>>>
>>> You need to have execution env that is container image. Can You share
>>> aap execution env list on gui and then you can check on shell;
>>> #su  - awx
>>> $podman images (you need to see a few images)
>>> $podman run -it container_image
>>>
>>> Regards
>>> Bulent
>>>
>>>
>>>
>>> 13 Şub 2024 Sal 21:27 tarihinde Prady A  şunu
>>> yazdı:
>>>
>>>> HI All,
>>>>
>>>> Facing acute challenge while running the first job in AAP 2.3.
>>>> StandAlone AAP was installed with success but when I tried to synch demo
>>>> project or my own project it keeps on saying this one line error.
>>>> No idea how to proceed from here. Kindly advise.
>>>>
>>>> ERRO[] invalid internal status, try resetting the pause process
>>>> with "/usr/bin/podman system migrate": could not find any running process:
>>>> no such process.
>>>>
>>>> Regards
>>>> PD
>>>>
>>>> --
>>>> 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 view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/ansible-project/CAEuB3Arx85DRuCxHBTp4znUv8nWgRrDThFitjJXmpQRTLtvJ2A%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/ansible-project/CAEuB3Arx85DRuCxHBTp4znUv8nWgRrDThFitjJXmpQRTLtvJ2A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/CAFqD%3DS

[ansible-project] [Ansible-Project] Installation of AAP 2.3

2024-02-13 Thread Prady A
HI All,

Facing acute challenge while running the first job in AAP 2.3. StandAlone
AAP was installed with success but when I tried to synch demo project or my
own project it keeps on saying this one line error.
No idea how to proceed from here. Kindly advise.

ERRO[] invalid internal status, try resetting the pause process with
"/usr/bin/podman system migrate": could not find any running process: no
such process.

Regards
PD

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Arx85DRuCxHBTp4znUv8nWgRrDThFitjJXmpQRTLtvJ2A%40mail.gmail.com.


Re: [ansible-project] [ansible project] VM snapshot capture using VMware

2024-01-23 Thread Prady A
Thank you so much Walter that will definitely help..

On Mon, 22 Jan 2024 at 23:29, 'Rowe, Walter P. (Fed)' via Ansible Project <
ansible-project@googlegroups.com> wrote:

> Adding to my earlier message .. we use these playbooks in a patching
> workflow. Snapshot, Patch, if patching fails, revert snapshot.
>
> Walter
> --
> Walter Rowe, Division Chief
> Infrastructure Services Division
> Mobile: 202.355.4123
>
> On Jan 22, 2024, at 7:22 AM, 'Rowe, Walter P. (Fed)' via Ansible Project <
> ansible-project@googlegroups.com> wrote:
>
> We have these playbooks we use to create a snapshot and to revert a
> snapshot. The go into an ansible automation platform workflow. The
> esx-vars.yml has a dictionary you will need to modify for your environment.
> The dictionary key is a vcenter ID you create. We pass in an extravar for
> datacenter that provides the value of that key to look up at run time. We
> have an east and west vCenter and a sandbox we call "vCloud". You will see
> vc_east, vc_west, vc_vcloud keys in the esx_vars.yml dictionary.
>
> The esx-create-snapshot.yml gets info about the existing machine, powers
> it down, creates the snapshot, then powers it back up ONLY if it was
> powered on when we started (state: "{{ snapvm.instance.hw_power_status |
> lower }}" at line 74 comes from the guest info we get at line 31). At the
> bottom of esx-snapshot-create.yml we use set_stats to artifacts so they can
> be used downstream in the AAP workflow by ex-snapshot-revert.yml including
> its powered on status.
>
>
>
> Even if you don't use these playbooks they may help you craft your own.
>
> Walter
> --
> Walter Rowe, Division Chief
> Infrastructure Services Division
> Mobile: 202.355.4123
>
> On Jan 22, 2024, at 3:36 AM, Prady A  wrote:
>
> Hi Rilindo,
>
> Thanks for your reply. That was typo error . I fixed the issue, in the
> REST api i need to pass memory flag which by default is false. This memory
> flag retains the machine power status also.
>
> Thank you for your all support.
>
> PD
>
> On Mon, 22 Jan 2024 at 13:50, Rilindo Foster  wrote:
>
> Is that a space before snapshot (right where it says “Task” in the JSON
> request)? Was that part of the request or did you insert that by mistake
> when you copied it into the email?
>
> - Rilindo
>
> On Jan 21, 2024, at 9:13 PM, Prady A  wrote:
>
> 
>
> Hi,
>
> Thank you both of you for your kind suggestions.
> We are using leap-upgrade tool to upgrade. In upgrade there is no issue.
> We have a health checkup also post upgrade.
>
> The issue is in VMware but not sure when creating manually the “*Snapshot
> the virtual machine memory*” is set to Yes but when I am creating the
> snapshot through ansible automatically it is setting as No. This is
> something with VMware maybe..
>
> - Name: Create VM snapshot
>Uri:
>   URL: https://api.xyz/virtualization/snapshot/snow
>   User: “ {{ snapshot_user }}”
>   Password: “{{ snapshot_Password }}“
>   force_basic_auth: true
>   Method: post
>   Body_format: json
>   Body: |-
>   {
>  “Hostname”: “{{ vm_hostname }}”,
>  “Task”: “ create”,
>   “Snapshot_name”: “upgrade-{{vm_hostname}} “
>}
>   Status code: 202
>Register: snapshot_result
>
>
> Regards
> PD
>
>
>
> On Sun, 21 Jan 2024 at 07:15, Nico Kadel-Garcia  wrote:
>
> On Thu, Jan 18, 2024 at 8:16 PM Prady A  wrote:
> >
> > Hi experts,
> >
> > We are doing automation to update RHEL7-> RHEL8 .
> > Before we upgrade we take the snapshot.
> > The issue is whenever there is an upgrade failure we revert the server
> to its previous state. But it seems when we revert it the machine is in
> power off state..
> > it seems when we take automatic snapshot it happens like that.. Any
> pointers pls
> >
> > Regards
> > PD
>
> That's a RHEL problem. It's not an operation supported by RHEL.
> Updating the critical system libraries, such as glibc and the python
> on which RPM is based, and RPM itself, is likely to trip over a *lot*
> of problems without quite a lot of research and debugging. From
> decades of experience with Red Hat based operating systems, I
> recommend very strongly against this approach.
>
> If I may suggest, take a disk image of the old system and build a new
> system, with content copied as needed to configure the new system.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving e

Re: [ansible-project] [ansible project] VM snapshot capture using VMware

2024-01-22 Thread Prady A
Hi Rilindo,

Thanks for your reply. That was typo error . I fixed the issue, in the REST
api i need to pass memory flag which by default is false. This memory flag
retains the machine power status also.

Thank you for your all support.

PD

On Mon, 22 Jan 2024 at 13:50, Rilindo Foster  wrote:

> Is that a space before snapshot (right where it says “Task” in the JSON
> request)? Was that part of the request or did you insert that by mistake
> when you copied it into the email?
>
> - Rilindo
>
> On Jan 21, 2024, at 9:13 PM, Prady A  wrote:
>
> 
>
> Hi,
>
> Thank you both of you for your kind suggestions.
> We are using leap-upgrade tool to upgrade. In upgrade there is no issue.
> We have a health checkup also post upgrade.
>
> The issue is in VMware but not sure when creating manually the “*Snapshot
> the virtual machine memory*” is set to Yes but when I am creating the
> snapshot through ansible automatically it is setting as No. This is
> something with VMware maybe..
>
> - Name: Create VM snapshot
>Uri:
>   URL: https://api.xyz/virtualization/snapshot/snow
>   User: “ {{ snapshot_user }}”
>   Password: “{{ snapshot_Password }}“
>   force_basic_auth: true
>   Method: post
>   Body_format: json
>   Body: |-
>   {
>  “Hostname”: “{{ vm_hostname }}”,
>  “Task”: “ create”,
>   “Snapshot_name”: “upgrade-{{vm_hostname}} “
>}
>   Status code: 202
>Register: snapshot_result
>
>
> Regards
> PD
>
>
>
> On Sun, 21 Jan 2024 at 07:15, Nico Kadel-Garcia  wrote:
>
>> On Thu, Jan 18, 2024 at 8:16 PM Prady A  wrote:
>> >
>> > Hi experts,
>> >
>> > We are doing automation to update RHEL7-> RHEL8 .
>> > Before we upgrade we take the snapshot.
>> > The issue is whenever there is an upgrade failure we revert the server
>> to its previous state. But it seems when we revert it the machine is in
>> power off state..
>> > it seems when we take automatic snapshot it happens like that.. Any
>> pointers pls
>> >
>> > Regards
>> > PD
>>
>> That's a RHEL problem. It's not an operation supported by RHEL.
>> Updating the critical system libraries, such as glibc and the python
>> on which RPM is based, and RPM itself, is likely to trip over a *lot*
>> of problems without quite a lot of research and debugging. From
>> decades of experience with Red Hat based operating systems, I
>> recommend very strongly against this approach.
>>
>> If I may suggest, take a disk image of the old system and build a new
>> system, with content copied as needed to configure the new system.
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAOCN9ry6d0wKwzJutwXDJSMH3X9vD51hLVqqtbJd9rHzRfkEKQ%40mail.gmail.com
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAEuB3AoFvdepBuNSvKHQ%3Dc_TYpwUUjrF8QYdgMd_MKb22-8v8A%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAEuB3AoFvdepBuNSvKHQ%3Dc_TYpwUUjrF8QYdgMd_MKb22-8v8A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/5C29FCDA-9E8E-43D0-B343-46D172B5EF4F%40gmail.com
> <https://groups.google.com/d/msgid/ansible-project/5C29FCDA-9E8E-43D0-B343-46D172B5EF4F%40gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Aq-wtE%2Bd73_Cj%2B-3HeBYpFO-qs5m_Q8TDA_r9FL4bO-Rw%40mail.gmail.com.


Re: [ansible-project] [ansible project] VM snapshot capture using VMware

2024-01-21 Thread Prady A
Hi,

Thank you both of you for your kind suggestions.
We are using leap-upgrade tool to upgrade. In upgrade there is no issue. We
have a health checkup also post upgrade.

The issue is in VMware but not sure when creating manually the “*Snapshot
the virtual machine memory*” is set to Yes but when I am creating the
snapshot through ansible automatically it is setting as No. This is
something with VMware maybe..

- Name: Create VM snapshot
   Uri:
  URL: https://api.xyz/virtualization/snapshot/snow
  User: “ {{ snapshot_user }}”
  Password: “{{ snapshot_Password }}“
  force_basic_auth: true
  Method: post
  Body_format: json
  Body: |-
  {
 “Hostname”: “{{ vm_hostname }}”,
 “Task”: “ create”,
  “Snapshot_name”: “upgrade-{{vm_hostname}} “
   }
  Status code: 202
   Register: snapshot_result


Regards
PD



On Sun, 21 Jan 2024 at 07:15, Nico Kadel-Garcia  wrote:

> On Thu, Jan 18, 2024 at 8:16 PM Prady A  wrote:
> >
> > Hi experts,
> >
> > We are doing automation to update RHEL7-> RHEL8 .
> > Before we upgrade we take the snapshot.
> > The issue is whenever there is an upgrade failure we revert the server
> to its previous state. But it seems when we revert it the machine is in
> power off state..
> > it seems when we take automatic snapshot it happens like that.. Any
> pointers pls
> >
> > Regards
> > PD
>
> That's a RHEL problem. It's not an operation supported by RHEL.
> Updating the critical system libraries, such as glibc and the python
> on which RPM is based, and RPM itself, is likely to trip over a *lot*
> of problems without quite a lot of research and debugging. From
> decades of experience with Red Hat based operating systems, I
> recommend very strongly against this approach.
>
> If I may suggest, take a disk image of the old system and build a new
> system, with content copied as needed to configure the new system.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAOCN9ry6d0wKwzJutwXDJSMH3X9vD51hLVqqtbJd9rHzRfkEKQ%40mail.gmail.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3AoFvdepBuNSvKHQ%3Dc_TYpwUUjrF8QYdgMd_MKb22-8v8A%40mail.gmail.com.


[ansible-project] [ansible project] VM snapshot capture using VMware

2024-01-18 Thread Prady A
Hi experts,

We are doing automation to update RHEL7-> RHEL8 .
Before we upgrade we take the snapshot.
The issue is whenever there is an upgrade failure we revert the server to
its previous state. But it seems when we revert it the machine is in power
off state..
it seems when we take automatic snapshot it happens like that.. Any
pointers pls

Regards
PD

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Ao_J9xpBd3D8pqcFdj%2B30%3DpobvtHJDbceWXbX0xh9cHWg%40mail.gmail.com.


Re: [ansible-project] error in jinja2 template

2023-12-18 Thread Prady A
Hi

Did you run your playbook or not ?
What’s the output so that it will be easy to diagnose

Thanks

On Tue, 19 Dec 2023 at 12:51, Thirumalai Raja A 
wrote:

> Hi Team,
> below is my playbook and j2 template i was failed to create a file
> actually i am not comfortable wil jinja2 if any one can guide me
>
> playbook:
> - name: read data
>   set_fact:
> vm_data: "{{ lookup('file', 'variables/vm_data.yaml') | from_yaml
> }}"
>   tags:
> - read_vm_data
>
> - name: getting IP_scope
>   getip_scope:
> csv_file: template/subnetsheet.csv
> location_network: "{{ location_network }}"
>   register: vm_data
>   tags:
> - getting_ip
>
> - name: Free Ip-address
>   script:
> cmd: ip.py "{{ vm_data.details.IP_Scope }}" "{{
> vm_data.details.IP_Gateway }}"
> executable: python
>   register: ip
>   delegate_to: "{{ delegate_host }}"
>   tags:
> - getting_ip
> - name:
>   debug:
> var: ip.stdout
>   tags:
> - getting_ip
>
> - name: set_fact
>   set_fact:
> vDS: "{{ vm_data.details.vDS }}"
> vPG_Name: "{{ vm_data.details.vPG_Name }}"
> vm_ipv4_address: "{{ ip.stdout | from_json |
> json_query('vm_ipv4_address') }}"
> vm_ipv4_netmask: "{{ ip.stdout | from_json |
> json_query('vm_ipv4_netmask') }}"
> vm_ipv4_gateway: "{{ ip.stdout | from_json |
> json_query('vm_ipv4_gateway') }}"
>   tags:
> - get_variables.tf
>
> - name: creating var.tf
>   template:
> src: template/win_variable.tf.j2
> dest: terraform_config_files/Windows/variables.tf
>   tags:
> - get_variables.tf
>
>
> jinja2 template:
>
> locals {
>   vm  = yamldecode(file("/runner/project/variables/vm_data.yaml"))
> }
>
>
> variable "vsphere_insecure" {
>   type= bool
>   default = true
> }
>
> #credentials
> variable "vsphere_username" {
>   type= string
>   sensitive = true
> }
> variable "vsphere_password" {
>   type= string
>   sensitive = true
> }
> variable "domain_admin_username" {
>   type= string
>   sensitive = true
> }
> variable "domain_admin_password" {
>   type= string
>   sensitive = true
> }
> variable "vm_admin_password" {
>   type= string
>   sensitive = true
> }
> variable "template_name" {
>   type= string
>   default = "z_Templates/{{vsphere_template}}"
> }
>
> variable "vsphere_network" {
>   type= string
>   default = "{{ansible_facts[vDS]}}/{{ansible_facts[vPG Name]}}"
> }
>
> variable "vm_ipv4_address" {
>   type= string
>   default = {{ ansible_facts['vm_ipv4_address'] }}
> }
>
> variable "vm_ipv4_netmask" {
>   type= string
>   default = {{ ansible_facts['vm_ipv4_netmask'] }}
> }
>
> variable "vm_ipv4_gateway" {
>   type= string
>   default = {{ ansible_facts['vm_ipv4_gateway'] }}
> }
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CALyK%3Dg8NAegmE5_-9QPmkzXv3RSkE1u5zkEAswyT9jc0s-pJDw%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ArLyEWbxLW3iTf1c5nsiQLvgmgKee5P5Q5Gba8ZVYoowA%40mail.gmail.com.


Re: [ansible-project] execute Synchronize module in AAP 2.3

2023-12-13 Thread Prady A
Thanks a Ton Walter and dick
Delegate option filnlally worked..
I wonder how copy module works even though the concept are same.

Regards
PD

On Thu, 14 Dec 2023 at 00:24, 'Rowe, Walter P. (Fed)' via Ansible Project <
ansible-project@googlegroups.com> wrote:

> If the files to sync are part of the project that includes the playbook
> then it is present inside the container. If the files / folder to sync
> reside elsewhere, you need to delegate that task(s) to that source system
> where they reside that you want to sync.
>
> Walter
> --
> Walter Rowe, Division Chief
> Infrastructure Services Division
> Mobile: 202.355.4123
>
> On Dec 13, 2023, at 9:19 AM, Prady A  wrote:
>
> Hi Dick
>
> Thank you for the directions. If I not wrong all AAP uses containers to
> execute the templates and this is not specific to me. I m not sure why
> ansible AAP provided which does not work in the out of box bundle. let me
> chk with RH support..
> Thank a lot again..
>
>
>
> On Wed, 13 Dec 2023 at 22:52, Dick Visser  wrote:
>
>>
>>
>> On Wed, 13 Dec 2023 at 14:43, Prady A  wrote:
>>
>>> Thank you for your direction and suggestion..
>>> actually we want to sync http folder not a file
>>> Is there any way I can sync between 2 servers.?
>>>
>>
>> You can, with the synchronize module. But as explained above, your
>> specific setup includes containers, so that needs some work. What exactly
>> depends on your setup, if you can mount volumes, etc. Something that is
>> known to you. IIRC the product you are using (AAP) includes support, so
>> that would be the most logical thing to try.
>>
>> If you folder is not too big you can still use the copy module:
>>
>>
>> https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html#parameter-src
>>
>> You should experiment a bit with that.
>>
>>
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAF8BbLY%3DHLFLXFWy4W2emk4ioWJBwgWSFOFE8ORQCWNN1VzXBA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAF8BbLY%3DHLFLXFWy4W2emk4ioWJBwgWSFOFE8ORQCWNN1VzXBA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAEuB3ApSvRPBPz-nkSefCwuYOQL%2BQQEDomEpo3xQpAPsSmdXtg%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAEuB3ApSvRPBPz-nkSefCwuYOQL%2BQQEDomEpo3xQpAPsSmdXtg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/96F718E3-53E3-46AD-AD5B-9C96243C548E%40nist.gov
> <https://groups.google.com/d/msgid/ansible-project/96F718E3-53E3-46AD-AD5B-9C96243C548E%40nist.gov?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ApDMLxu8iF_HLng%3DvE-pZVfuGO6vo%2BNtmA4nMdPPvaoAQ%40mail.gmail.com.


Re: [ansible-project] execute Synchronize module in AAP 2.3

2023-12-13 Thread Prady A
Hi Dick

Thank you for the directions. If I not wrong all AAP uses containers to
execute the templates and this is not specific to me. I m not sure why
ansible AAP provided which does not work in the out of box bundle. let me
chk with RH support..
Thank a lot again..



On Wed, 13 Dec 2023 at 22:52, Dick Visser  wrote:

>
>
> On Wed, 13 Dec 2023 at 14:43, Prady A  wrote:
>
>> Thank you for your direction and suggestion..
>> actually we want to sync http folder not a file
>> Is there any way I can sync between 2 servers.?
>>
>
> You can, with the synchronize module. But as explained above, your
> specific setup includes containers, so that needs some work. What exactly
> depends on your setup, if you can mount volumes, etc. Something that is
> known to you. IIRC the product you are using (AAP) includes support, so
> that would be the most logical thing to try.
>
> If you folder is not too big you can still use the copy module:
>
>
> https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html#parameter-src
>
> You should experiment a bit with that.
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAF8BbLY%3DHLFLXFWy4W2emk4ioWJBwgWSFOFE8ORQCWNN1VzXBA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAF8BbLY%3DHLFLXFWy4W2emk4ioWJBwgWSFOFE8ORQCWNN1VzXBA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ApSvRPBPz-nkSefCwuYOQL%2BQQEDomEpo3xQpAPsSmdXtg%40mail.gmail.com.


Re: [ansible-project] execute Synchronize module in AAP 2.3

2023-12-13 Thread Prady A
Thank you for your direction and suggestion..
actually we want to sync http folder not a file
Is there any way I can sync between 2 servers.?

Regards
Prady

On Wed, 13 Dec 2023 at 22:24, Dick Visser  wrote:

> Hii
> If it really is just one file, you can use the copy module...
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAF8BbLbFb3hmdr%2BCgycF3bwX9xyK3LmZsBXcOrOgRn8jS_rNCg%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ApUbgAd-ZyM_6A6HzTU9Nq4FN%2Banf1FzEvKkVc4Ag4dqA%40mail.gmail.com.


[ansible-project] execute Synchronize module in AAP 2.3

2023-12-13 Thread Prady A
Hello experts

I ve simple piece of below code

- Name: Install rsync on the Target
  package:
name: rsync
state: present

- Name: Synchronize file from local to remote
  synchronize:
 src: /tmp/memo.txt
 dest: /temp/test

code I can run the code using ansible-playbook command but when I am
executing it via ansible automation platform gui it is giving me the
below error
Message . No file error.

cmd": "/usr/bin/rsync --delay-updates -F --compress --archive
--rsh='/usr/bin/ssh -S none -o StrictHostKeyChecking=no -o
UserKnownHostsFile=/dev/null' --out-format='<>%i %n%L'
/tmp/memo.txt root@xyz1234:/tmp/test",  "msg": "Warning: Permanently
added 'xyz1234,148.168.65.73' (ECDSA) to the list of known
hosts.\r\nWARNING!\n  This system, owned by
the Company, may be used only by authorized personnel for authorized
purposes. All activities conducted on and communications and other
information, including personal information, accessed, processed,
stored, or transmitted using the system may be examined, recorded,
copied, used and disclosed in accordance with applicable law. The
Company monitors systems to safeguard the security of its systems and
data, to protect against policy violations and unlawful activity, to
administer working relationships, and to meet legal obligations and
promises to business partners. By proceeding, you agree to use the
system only for authorized purposes and in accordance with Company
policies that have been made available to you. For additional
information consult your local business's employee privacy notice or
contact your local Privacy Officer.\nrsync: link_stat
\"/*tmp/memo.txt\" failed: No such file or directory* (2)\nrsync
error: some files/attrs were not transferred (see previous errors)
(code 23) at main.c(1189) [sender=3.1.3]\n",


Though I kept /tmp/memo.txt in both control node and execution node
still the error persist. Kindly suggest


Thanks

pd

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3AqOxr3AbQ9k-vgCdJtgmLTm3ZvKBBD645mNW-F9F_p%2BeQ%40mail.gmail.com.


Re: [ansible-project] [ansible-projects] Ansible automation platform temol

2023-11-25 Thread Prady A
Thank you.
Playbooks are in github . I can logged into controller as LDAP user as well
as Admin user.
As per below RH support it seems it’s a bug. I corrected the
etc/pulp/settings.py file  and restarted the pulp services. But now I can’t
connect to automation hub.

~
 Failed to retrieve user data.
~


RH support
https://access.redhat.com/solutions/6981363

Regards
Prady

On Sun, 26 Nov 2023 at 04:33, Evan Hisey  wrote:

> How is your playbook handling the login? and who is it login is as?
>
> On Wed, Nov 22, 2023 at 2:26 AM Prady A  wrote:
>
>> Hi experts
>>
>> I am trying to execute my template from AAP 2.3. But getting an access
>> denied error from my private automation hub. Any suggestions pls ?
>>
>> error: initializing source docker://
>> vr4003.icici.com/icici-custom-ee-29-rhel8:latest: reading manifest
>> latest in vr4003.icici.com/icici-custom-ee-29-rhel8: requested access to
>> the resource is denied My PAH(vr4003.icici.com)
>>
>> I can login to PAH without any issue with admin user .
>>
>> Thank you
>>
>>
>>
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAEuB3ApbiB6rVf08J2HY0aipmX%3DF%2By3f8_v-a8OYn5Otj8yTXg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAEuB3ApbiB6rVf08J2HY0aipmX%3DF%2By3f8_v-a8OYn5Otj8yTXg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAEcFzYzNLXG2UOvw%3Ddin3-g3fE%3DT14xt08qQa7pBRNEYca-n8g%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAEcFzYzNLXG2UOvw%3Ddin3-g3fE%3DT14xt08qQa7pBRNEYca-n8g%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Ar21QkEce5YdZ6uev5pW91esAqBH%2Bor1dNY7CbezOPA-A%40mail.gmail.com.


[ansible-project] [ansible-projects] Ansible automation platform temol

2023-11-22 Thread Prady A
Hi experts

I am trying to execute my template from AAP 2.3. But getting an access
denied error from my private automation hub. Any suggestions pls ?

error: initializing source docker://
vr4003.icici.com/icici-custom-ee-29-rhel8:latest: reading manifest latest
in vr4003.icici.com/icici-custom-ee-29-rhel8: requested access to the
resource is denied My PAH(vr4003.icici.com)

I can login to PAH without any issue with admin user .

Thank you

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ApbiB6rVf08J2HY0aipmX%3DF%2By3f8_v-a8OYn5Otj8yTXg%40mail.gmail.com.


[ansible-project] Ansible Automation platform

2023-11-20 Thread Prady A
Hi

 I am trying to execute my template in recently built AAP 2.3 , but
eventually it is failing with the below error message. No problem in Dev
environment. Occurring in prod env. Pls help. —
Traceback (most recent call last): File "/usr/bin/ansible-runner", line 10,
in sys.exit(main()) File
"/usr/lib/python3.9/site-packages/ansible_runner/__main__.py", line 809, in
main os.makedirs(vargs.get('private_data_dir'), mode=0o700) File
"/usr/lib64/python3.9/os.py", line 215, in makedirs makedirs(head,
exist_ok=exist_ok) File "/usr/lib64/python3.9/os.py", line 215, in makedirs
makedirs(head, exist_ok=exist_ok) File "/usr/lib64/python3.9/os.py", line
225, in makedirs mkdir(name, mode) PermissionError: [Errno 13] *Permission
denied: '/opt/ansible/awx'*

*Below are folder permissions.*

root@ Production: /opt/ansible] ls -ltr | grep *awx*
drwxr-x---. 5 awx awx 53 10月 12 03:22 logs
drwxr-xr-x. 12 awx awx 4096 10月 12 07:52 *awx*
[root@ Production: /opt/ansible] cd awx/
[root@ Production: /opt/ansible/awx] ls -ltr
合計 5452
drwxr-x---. 2 awx awx 6 9月 13 07:03 job_status drwxr-xr-x. 3 awx awx 17 10月
12 04:02 venv
drwxr-xr-x. 3 awx awx 20 10月 12 04:04 public
srw-rw. 1 awx awx 0 10月 12 05:22 uwsgi.stats
drwxr-xr-x. 3 awx awx 40 10月 12 05:22
rsyslog drwxr-xr-x. 8 awx awx 4096 11月 21 10:14 projects drwxrwx--T. 2 awx
awx 6 11月 21 14:54 tmp
-rw---. 1 awx awx 5572986 11月 21 15:04
awx-external-logger-backlog.0001
[root@ Production: /opt/ansible/awx]


Regards
PD

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ApeY2%3DUfXAyd18eAH1vgyoOfg5F0VAcgrnL5KVyqavYfg%40mail.gmail.com.


Re: [ansible-project] Synchronize module failing

2023-11-16 Thread Prady A
Thank you for your guidance ..

Regards
Prady

On Thu, Nov 16, 2023 at 22:36, 'Felix Fontein' via Ansible Project <
ansible-project@googlegroups.com> wrote:

> Hi,
>
> > Thank you for your kind reply
> >
> > No some target machine don’t have rsync installed.
> > What to do in that case ?
>
> install rsync on the target machines before using the synchronize
> module. (For example using the ansible.builtin.package action:
>
> https://docs.ansible.com/ansible/latest/collections/ansible/builtin/package_module.html
> .)
>
> Best regards,
> Felix
>
>
>
> >
> > Regards
> >
> > On Thu, Nov 16, 2023 at 22:10, Dick Visser 
> > wrote:
> >
> > >
> > >
> > > On Thu, 16 Nov 2023 at 13:56, Prady A 
> > > wrote:
> > >> Hi Experts
> > >>
> > >> One doubt with synchronize module
> > >>
> > >>  - name: Unix common script deployment
> > >> synchronize:
> > >>   src: “{{ playbook_dir }}/shellscript”
> > >>   Dest: /tmp/patch_impl
> > >>  delegation_to: all
> > >>
> > >>  In this ansible code it is failing because to run synchronize we
> > >> need rsynch module in both control as well as managed nodes. But
> > >> to overcome that can we use container method? Inside the
> > >> requirement.txt can we add rsync module to build a image out it
> > >> and use in the template?
> > >
> > > You can use whatever you want, as long as there will be a working
> > > rsync command on both control and managed nodes.
> > >
> > > Dick
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/20231116143634.388fd6ce%40rovaniemi
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Argn0Yv148f0sAkDiLOwkBWHJTF0_STVKMz4ZBPzyhLVQ%40mail.gmail.com.


Re: [ansible-project] Synchronize module failing

2023-11-16 Thread Prady A
Thank you for your kind reply

No some target machine don’t have rsync installed.
What to do in that case ?

Regards

On Thu, Nov 16, 2023 at 22:10, Dick Visser  wrote:

>
>
> On Thu, 16 Nov 2023 at 13:56, Prady A  wrote:
>
>> Hi Experts
>>
>> One doubt with synchronize module
>>
>>  - name: Unix common script deployment
>> synchronize:
>>   src: “{{ playbook_dir }}/shellscript”
>>   Dest: /tmp/patch_impl
>>  delegation_to: all
>>
>>  In this ansible code it is failing because to run synchronize we need
>> rsynch module in both control as well as managed nodes. But to overcome
>> that can we use container method? Inside the requirement.txt can we add
>> rsync module to build a image out it and use in the template?
>>
>
> You can use whatever you want, as long as there will be a working rsync
> command on both control and managed nodes.
>
> Dick
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAF8BbLYPVNzo9UhHjwV_PwSZ2K2jNHN827L92-qZT6n3Wi8W2A%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAF8BbLYPVNzo9UhHjwV_PwSZ2K2jNHN827L92-qZT6n3Wi8W2A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ArvKiGF_aF1-azvTSs9uB%2Bm5sYN513Ldr1TjpvL%3D%2BVhbQ%40mail.gmail.com.


[ansible-project] Synchronize module failing

2023-11-16 Thread Prady A
Hi Experts

One doubt with synchronize module

 - name: Unix common script deployment
synchronize:
  src: “{{ playbook_dir }}/shellscript”
  Dest: /tmp/patch_impl
 delegation_to: all

 In this ansible code it is failing because to run synchronize we need
rsynch module in both control as well as managed nodes. But to overcome
that can we use container method? Inside the requirement.txt can we add
rsync module to build a image out it and use in the template?

 My container file structure
 1. _build/requirement.txt
 2. Contanerfile
 3. krb5.conf
 4. pip.conf
 5. uib.repo

Regards
Prady

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Aqrbj4rbZ4U%2Bu3CsFd5TRfgM4KtsbwiwGtup6gqw6SeYQ%40mail.gmail.com.


Re: [ansible-project] Multipathd is not enabling

2023-10-24 Thread Prady A
Thank you for your suggestion. These code are inside our Tower placed in
git.

Right now I ve no idea why they are baking a file to iso instead they could
do using template. I need to dig more ..

Thanks again for your help

On Mon, Oct 23, 2023 at 23:26, Will McDonald  wrote:

> I'd recommend looking at having your role or playbook drop in a sensible,
> templated configuration personally.
>
> Baking a static file into an ISO will almost certainly cause future pain
> unless you only ever deploy one hardware and storage combination with
> absolutely zero variation?
>
>
> On Mon, 23 Oct 2023 at 14:46, Prady A  wrote:
>
>> Thank you so much for your kind reply.
>>
>> For temporary fix I copied the  /etc/multipath.conf from other machine
>> but eventually we need to update our ISO image to include this file.
>>
>> Regards
>> PD
>>
>>
>> On Wed, Oct 18, 2023 at 18:11, Will McDonald  wrote:
>>
>>> This seems like a pretty glaring error:
>>>
>>>
>>>> ConditionPathExists=/etc/multipath.conf was not met
>>>
>>>
>>> This is likely nothing to do with Ansible. You're installing a multipath
>>> package, enabling a service, the service is failing to start automatically
>>> because it doesn't have any valid config. You should see the same problem
>>> if you perform the same steps manually. Figure out your manual process
>>> first, then automate it.
>>>
>>> Either:
>>>
>>> 1. Include a templated /etc/multipath.conf config before
>>> enabling/starting the systemd service
>>> 2. Run something like mpathconf --enable to create a default config
>>> 3. Override/replace the Condition in the systemd unit file (probably a
>>> bad idea).
>>>
>>>
>>>
>>> On Wed, 18 Oct 2023 at 07:25, Prady A  wrote:
>>>
>>>> Thank you . Due to some old iso image the multipath is not able to
>>>> enable . We have to update the iso image it seems
>>>>
>>>> Thank you
>>>>
>>>> On Wed, Oct 18, 2023 at 14:08, dulhaver via Ansible Project <
>>>> ansible-project@googlegroups.com> wrote:
>>>>
>>>>> hi,
>>>>>
>>>>> the syntax of your TASK sems not to match the docs for the service
>>>>> module
>>>>> <https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_module.html#ansible-collections-ansible-builtin-service-module>.
>>>>> Would something like ...
>>>>>
>>>>>
>>>>>- name: Enable service httpd, and not touch the state
>>>>>  ansible.builtin.service:
>>>>>name: multipathd
>>>>>state: started
>>>>>enabled: true
>>>>>
>>>>> ... work?
>>>>>
>>>>> On 10/18/2023 5:33 AM CEST Prady A  wrote:
>>>>>
>>>>>
>>>>> Hi All..
>>>>>
>>>>> I ve a very 2 very basic task of enabling multipath.
>>>>> The 2 task is failing since the first one is not enabling. But in
>>>>> ansible job it is showing as changed but when I checked multipath service
>>>>> in system it is showing as Below:
>>>>>
>>>>> Active: inactive(dead)
>>>>> Condition: start condition failed
>>>>>|- ConditionPathExists=/etc/multipath.conf was not
>>>>> met
>>>>>
>>>>> *Tasks*
>>>>> ———-
>>>>> - name: confirm multipathd is enabled
>>>>> service: multipathd
>>>>> state: started
>>>>> enable: yes
>>>>>
>>>>> - name: check default polling interval
>>>>>  shell: multipathd list config | awk ‘/defaults {/,/}’|grep -w
>>>>> polling_interval
>>>>>   register: polling_interval
>>>>>   changed_when: false
>>>>>
>>>>> Please suggest why ansible not able to enable multipath service
>>>>> correctly..
>>>>>
>>>>> Regards
>>>>>
>>>>>
>>>>> --
>>>>> 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 ans

Re: [ansible-project] Multipathd is not enabling

2023-10-23 Thread Prady A
Thank you so much for your kind reply.

For temporary fix I copied the  /etc/multipath.conf from other machine but
eventually we need to update our ISO image to include this file.

Regards
PD


On Wed, Oct 18, 2023 at 18:11, Will McDonald  wrote:

> This seems like a pretty glaring error:
>
>
>> ConditionPathExists=/etc/multipath.conf was not met
>
>
> This is likely nothing to do with Ansible. You're installing a multipath
> package, enabling a service, the service is failing to start automatically
> because it doesn't have any valid config. You should see the same problem
> if you perform the same steps manually. Figure out your manual process
> first, then automate it.
>
> Either:
>
> 1. Include a templated /etc/multipath.conf config before enabling/starting
> the systemd service
> 2. Run something like mpathconf --enable to create a default config
> 3. Override/replace the Condition in the systemd unit file (probably a bad
> idea).
>
>
>
> On Wed, 18 Oct 2023 at 07:25, Prady A  wrote:
>
>> Thank you . Due to some old iso image the multipath is not able to enable
>> . We have to update the iso image it seems
>>
>> Thank you
>>
>> On Wed, Oct 18, 2023 at 14:08, dulhaver via Ansible Project <
>> ansible-project@googlegroups.com> wrote:
>>
>>> hi,
>>>
>>> the syntax of your TASK sems not to match the docs for the service
>>> module
>>> <https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_module.html#ansible-collections-ansible-builtin-service-module>.
>>> Would something like ...
>>>
>>>
>>>    - name: Enable service httpd, and not touch the state
>>>  ansible.builtin.service:
>>>name: multipathd
>>>state: started
>>>enabled: true
>>>
>>> ... work?
>>>
>>> On 10/18/2023 5:33 AM CEST Prady A  wrote:
>>>
>>>
>>> Hi All..
>>>
>>> I ve a very 2 very basic task of enabling multipath.
>>> The 2 task is failing since the first one is not enabling. But in
>>> ansible job it is showing as changed but when I checked multipath service
>>> in system it is showing as Below:
>>>
>>> Active: inactive(dead)
>>> Condition: start condition failed
>>>|- ConditionPathExists=/etc/multipath.conf was not
>>> met
>>>
>>> *Tasks*
>>> ———-
>>> - name: confirm multipathd is enabled
>>> service: multipathd
>>> state: started
>>> enable: yes
>>>
>>> - name: check default polling interval
>>>  shell: multipathd list config | awk ‘/defaults {/,/}’|grep -w
>>> polling_interval
>>>   register: polling_interval
>>>   changed_when: false
>>>
>>> Please suggest why ansible not able to enable multipath service
>>> correctly..
>>>
>>> Regards
>>>
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/1998953809.39642.1697605729025%40office.mailbox.org
>>> <https://groups.google.com/d/msgid/ansible-project/1998953809.39642.1697605729025%40office.mailbox.org?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAEuB3Aq7dH0AB%3DMrPXBZ%3DtMbTT-uY4tfE6BMPpQEkiVMKUhXOg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAEuB3Aq7dH0AB%3DMrPXBZ%3DtMbTT-uY4tfE6BMPpQEkiVMKUhXOg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAKtKohQsrvv0O5eXWFyVWU%2B84T6SFukHoOQ8Fr4UMj50gokiCw%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAKtKohQsrvv0O5eXWFyVWU%2B84T6SFukHoOQ8Fr4UMj50gokiCw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ApbBantMgeDiBS%3DB-UG989yRxmeZtWGZuHjjcf5tYDMxA%40mail.gmail.com.


Re: [ansible-project] Multipathd is not enabling

2023-10-17 Thread Prady A
Thank you . Due to some old iso image the multipath is not able to enable .
We have to update the iso image it seems

Thank you

On Wed, Oct 18, 2023 at 14:08, dulhaver via Ansible Project <
ansible-project@googlegroups.com> wrote:

> hi,
>
> the syntax of your TASK sems not to match the docs for the service module
> <https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_module.html#ansible-collections-ansible-builtin-service-module>.
> Would something like ...
>
>
>- name: Enable service httpd, and not touch the state
>  ansible.builtin.service:
>name: multipathd
>state: started
>enabled: true
>
> ... work?
>
> On 10/18/2023 5:33 AM CEST Prady A  wrote:
>
>
> Hi All..
>
> I ve a very 2 very basic task of enabling multipath.
> The 2 task is failing since the first one is not enabling. But in ansible
> job it is showing as changed but when I checked multipath service in system
> it is showing as Below:
>
> Active: inactive(dead)
> Condition: start condition failed
>|- ConditionPathExists=/etc/multipath.conf was not met
>
> *Tasks*
> ———-
> - name: confirm multipathd is enabled
> service: multipathd
> state: started
> enable: yes
>
> - name: check default polling interval
>  shell: multipathd list config | awk ‘/defaults {/,/}’|grep -w
> polling_interval
>   register: polling_interval
>   changed_when: false
>
> Please suggest why ansible not able to enable multipath service
> correctly..
>
> Regards
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/1998953809.39642.1697605729025%40office.mailbox.org
> <https://groups.google.com/d/msgid/ansible-project/1998953809.39642.1697605729025%40office.mailbox.org?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Aq7dH0AB%3DMrPXBZ%3DtMbTT-uY4tfE6BMPpQEkiVMKUhXOg%40mail.gmail.com.


[ansible-project] Multipathd is not enabling

2023-10-17 Thread Prady A
Hi All..

I ve a very 2 very basic task of enabling multipath.
The 2 task is failing since the first one is not enabling. But in ansible
job it is showing as changed but when I checked multipath service in system
it is showing as Below:

Active: inactive(dead)
Condition: start condition failed
   |- ConditionPathExists=/etc/multipath.conf was not met

*Tasks*
———-
- name: confirm multipathd is enabled
service: multipathd
state: started
enable: yes

- name: check default polling interval
 shell: multipathd list config | awk ‘/defaults {/,/}’|grep -w
polling_interval
  register: polling_interval
  changed_when: false

Please suggest why ansible not able to enable multipath service correctly..

Regards

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Aq8yJc1%2BRic9HHEzmKYcFcfQxXQJ%2Bo-97vJ7vzMD5%3DMEQ%40mail.gmail.com.


Re: [ansible-project] [anisible]Install package

2023-08-14 Thread Prady A
Super cool . That’s what I was try in
pseudo code..

Thanks a ton

On Mon, Aug 14, 2023 at 20:07, Todd Lewis  wrote:

> Here's *my* solution. Whether you wish to go there is a different
> question.
>
> ---
> - name: Prady A example 1
>   hosts: localhost
>   vars:
> is_usa: true
>   tasks:
> - name: Install packages with logical list
>   ansible.builtin.package:
> # requires "ansible-galaxy collection install utoddl.logical"
> name: "{{ rpms | utoddl.logical.logical }}"
> state: present
>   vars:
> rpms:
>   - vim
>   - lvm2
>   - if:
>   - and:
>   - "{{ is_usa }}"
>   - "{{ ansible_distribution_major_version | int <= 9 }}"
>       - xyz
>
> See https://galaxy.ansible.com/utoddl/logical for details and examples.
>
>
> On 8/14/23 5:21 AM, Prady A wrote:
>
> Hi folks
>
> I want to optimize the code here
>
> Existing code:
> package:
>  name: “{{ item }}”
>  state: present
> with_items:
>- vim
>- lvm2
>- xyz
> when: is_USA
>
>
> Now I don’t want to install xyz PACKAGE for RHEL 9 server only then I ve
> to rewrite the separate code for xyz package like below or any optimization
> is possible in the existing code
> ———
> package:
>  name: “{{ item }}”
>  state: present
> with_items:
>- xyz
> when:
> - is_USA
> - ansible_distribution_major_version| int <=9
>
> ——-
> Regards
>
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAEuB3ApnYr7ZqRnLLCBBbnDbbTJonS90gud_GEmVp8XaQJqhng%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAEuB3ApnYr7ZqRnLLCBBbnDbbTJonS90gud_GEmVp8XaQJqhng%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
>
>
> --
> Todd
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/711653de-d6a9-9424-0492-0f2a1cdfb245%40gmail.com
> <https://groups.google.com/d/msgid/ansible-project/711653de-d6a9-9424-0492-0f2a1cdfb245%40gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ArRK6n%3DdewKOGUynDQW46pYJp8_W5RAyGD%2BJktgsO3A8Q%40mail.gmail.com.


[ansible-project] [anisible]Install package

2023-08-14 Thread Prady A
Hi folks

I want to optimize the code here

Existing code:
package:
 name: “{{ item }}”
 state: present
with_items:
   - vim
   - lvm2
   - xyz
when: is_USA


Now I don’t want to install xyz PACKAGE for RHEL 9 server only then I ve to
rewrite the separate code for xyz package like below or any optimization is
possible in the existing code
———
package:
 name: “{{ item }}”
 state: present
with_items:
   - xyz
when:
- is_USA
- ansible_distribution_major_version| int <=9

——-
Regards

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ApnYr7ZqRnLLCBBbnDbbTJonS90gud_GEmVp8XaQJqhng%40mail.gmail.com.


Re: [ansible-project] [Ansible Project ]Ansible New Automation platform

2023-08-07 Thread Prady A
Thank you Abhijeet

Yes recently in my company also they upgrading to Ansible automation
platform. Since I just started learning Tower got confused.

Can I bypass Tower to learn this(Ansible Automation platform)one quick
question?

Regards
Prady

On Tue, Aug 8, 2023 at 14:03, Abhijeet Kasurde  wrote:

> Automation controller is the control plane for  Ansible Automation
> Platform. You will upgrade Ansible Tower to automation controller when
> migrating to Ansible Automation Platform 2.
>
> Read about Red Hat Automation Platform overview -
> https://access.redhat.com/documentation/en-us/red_hat_ansible_automation_platform/2.4/html/red_hat_ansible_automation_platform_release_notes/platform-introduction
>
> On Mon, Aug 7, 2023 at 9:41 PM Prady A  wrote:
>
>> Hi folks
>>
>> Recently Redhat Automation platform has been introduced. Is it completely
>> different from Ansible Tower. The reason I am asking I got confused which
>> one to read :(
>>
>> Regards
>> PD
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAEuB3AqGd8oCBe3cd-6eCzo67vtY_1QCE%2BUDxxR_AJrUxo5X9g%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAEuB3AqGd8oCBe3cd-6eCzo67vtY_1QCE%2BUDxxR_AJrUxo5X9g%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>
>
>>
>
> --
> Thanks,
> Abhijeet Kasurde
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAFwWkHpMQ%2BGaHEv_KvJ5eeVmj-St0tkDwEm3oeNqUTw6if7nSw%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAFwWkHpMQ%2BGaHEv_KvJ5eeVmj-St0tkDwEm3oeNqUTw6if7nSw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ArD3pWNMcHk2b3kffsnhdnh3uP2fQ%2Bh%3Dh%2BAVNXfpG0RpA%40mail.gmail.com.


[ansible-project] [Ansible Project ]Ansible New Automation platform

2023-08-07 Thread Prady A
Hi folks

Recently Redhat Automation platform has been introduced. Is it completely
different from Ansible Tower. The reason I am asking I got confused which
one to read :(

Regards
PD

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3AqGd8oCBe3cd-6eCzo67vtY_1QCE%2BUDxxR_AJrUxo5X9g%40mail.gmail.com.


Re: [ansible-project] [ansible-projects] Hostname trimming help

2023-08-02 Thread Prady A
Thanks for your comment.
You mean to say that instead of sending the trimmed hostname only something
like
prefix 5 digits mac add+ last 3 digits of hostname.

Thanks again for your help

On Thu, Aug 3, 2023 at 11:01, Evan Hisey  wrote:

> Something that was done at current job was use the last 5 digits of the
> mac address was a prefix for the host names. The  mac pretty much
> guarentees a unique name with added bonus of assisting network finding on
> the network when there is a connectivity issue
>
> On Wed, Aug 2, 2023, 8:56 PM Prady A  wrote:
>
>> Hi Experts,
>>
>> Not exactly an ansible issue but any thought would be greatly appreciated.
>> We use AD for Password synchronization between different kinds of
>> systems. For password synchronization we also use mainframe system which
>> accepts only 8 charters as a hostname.
>> So now we are trimming the hostname and sending it to the mainframe
>> system.
>> Ex: *domain: ansible_hostname[:3] }}{{ ansible_hostname[-5:] }} *
>> Earlier based on the datacenter the hostnames were given(EX:VANC+1001).
>> Since the datacenter names are quite different, by trimming also there are
>> no duplicates.
>> But now the hostname will be decided on the business unit so less number
>> of combinations in hostnames.
>> For Ex: for BU's : abcd, abcf, abciq
>> hostnames will be
>> abc*d*10001
>> abc*f*10001
>> abc*iq*10001
>> For above all the hostnames the above ansible will return me the same
>> hostname. which will be duplicated in the mainframe system.
>> *domain: ansible_hostname[:3] }}{{ ansible_hostname[-5:] }} *
>> abc10001
>> abc10001
>> abc10001
>>
>> Any insight would be greatly helpful.
>>
>> Regards
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAEuB3Aq14AaNqJGGcKC%3D-C0CH4dkGRC6uOsCzFe-f4YysYyKiQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAEuB3Aq14AaNqJGGcKC%3D-C0CH4dkGRC6uOsCzFe-f4YysYyKiQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAEcFzYz5Zdb-yx3jrxLMLNKWnMBfzuqmvfASDUj8uYZqtqxeGg%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAEcFzYz5Zdb-yx3jrxLMLNKWnMBfzuqmvfASDUj8uYZqtqxeGg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3AoDRdcrm%2BUS0Zq-mt5s%3DAW-WJcGr9cyT-a%3DMcWezbsF9Q%40mail.gmail.com.


[ansible-project] [ansible-projects] Hostname trimming help

2023-08-02 Thread Prady A
Hi Experts,

Not exactly an ansible issue but any thought would be greatly appreciated.
We use AD for Password synchronization between different kinds of systems.
For password synchronization we also use mainframe system which accepts
only 8 charters as a hostname.
So now we are trimming the hostname and sending it to the mainframe system.
Ex: *domain: ansible_hostname[:3] }}{{ ansible_hostname[-5:] }} *
Earlier based on the datacenter the hostnames were given(EX:VANC+1001).
Since the datacenter names are quite different, by trimming also there are
no duplicates.
But now the hostname will be decided on the business unit so less number of
combinations in hostnames.
For Ex: for BU's : abcd, abcf, abciq
hostnames will be
abc*d*10001
abc*f*10001
abc*iq*10001
For above all the hostnames the above ansible will return me the same
hostname. which will be duplicated in the mainframe system.
*domain: ansible_hostname[:3] }}{{ ansible_hostname[-5:] }} *
abc10001
abc10001
abc10001

Any insight would be greatly helpful.

Regards

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Aq14AaNqJGGcKC%3D-C0CH4dkGRC6uOsCzFe-f4YysYyKiQ%40mail.gmail.com.


Re: [ansible-project] [Ansible Project] how to get the logged in username

2023-07-31 Thread Prady A
Thank you again.. you are so kind ..It helped a lot..yes we orchestrate
servers through Tower..Still a novice in Tower ..

I went through this link there they suggested to use
tower_user_id

https://groups.google.com/g/ansible-project/c/YQ_r9UaS-uw

Regards

On Mon, Jul 31, 2023 at 23:11, Todd Lewis  wrote:

> If users are launching this job through Ansible tower (AWX), and not from
> a schedule, then you can probably get their user name through the variable
> "awx_user_name".
> There are additional variables specific to AWX. See "{{ lookup(
> 'ansible.builtin.varnames', '^awx_.+') }}" to get their names. I'm seeing 
> "awx_inventory_id",
> "awx_inventory_name", "awx_job_id", "awx_job_launch_type",
> "awx_job_template_id", "awx_job_template_name", "awx_project_revision",
> "awx_project_scm_branch", "awx_user_email", "awx_user_first_name",
> "awx_user_id", "awx_user_last_name", and "awx_user_name".
>
> On Saturday, July 29, 2023 at 11:51:15 PM UTC-4 Prady A wrote:
>
>> Hi Todd,
>>
>> Yeah if we pass who with any arguments it remains the same. I read it
>> some other forum.
>>
>> I tried with the python code as well as ansible_user_id both returns the
>> same “root”. Since I m running the playbook from root user after su -.
>> As you suggested we need to check how we can capture the userid who run
>> the playbook from Ansible tower.
>>
>> Regards
>> Prady
>>
>> On Sun, Jul 30, 2023 at 1:23, Todd Lewis  wrote:
>>
> Without knowing your effective ansible config — i.e. the ansible.cfg it's
>>> using, the environment variables that can override those settings, and
>>> command line parameters that can override everything else — it's impossible
>>> to say. Factors include "become", "become-user", "become-method",
>>> "ask-pass", "ask-become-pass", and probably more.
>>>
>>> Are you gathering facts? Ansible does gather facts by default, so if you
>>> aren't turning that off somewhere, you can use the variables containing
>>> user related facts. For example:
>>>
>>> $ ansible localhost -m gather_facts | grep ansible_user
>>> "ansible_user_dir": "/home/utoddl",
>>> "ansible_user_gecos": "Todd Lewis",
>>> "ansible_user_gid": 12428,
>>> "ansible_user_id": "utoddl",
>>> "ansible_user_shell": "/bin/bash",
>>> "ansible_user_uid": 12428,
>>> "ansible_userspace_architecture": "x86_64",
>>> "ansible_userspace_bits": "64",
>>>
>>> Not an Ansible thing, but: Do Not Use "who am i" for this. That's the
>>> same a "who -m", which shows you the user associated with the stdin
>>> stream, but only if that user is logged in AND only if the stdin stream
>>> exists and has an associated user. There's a whole lot of subtle going on
>>> there that we don't want to get into in an Ansible forum. The reason your 
>>> "su
>>> -" followed by "who am i" is showing your id rather than root is
>>> (probably) because it's your id associated with the tty you logged
>>> into. But that's going to be different for Ansible, depending on how your
>>> controller connects to the target hosts, including localhost.
>>>
>>> I gave you the python code yesterday. It's dead simple:
>>>
>>> import os
>>> import pwd
>>> userid = pwd.getpwuid(os.getuid())[0]
>>>
>>> But if you're gathering facts, just use the ansible_user_id variable.
>>>
>>> If that's "root", and that appears to be the case, then you'll need to
>>> understand how your controller is connecting to the target hosts. My guess
>>> is you'll eventually need to pass the invoking user's id as an extra
>>> variable ("-e invoking_user=${USER}") when invoking ansible-playbook.
>>> Maybe consider a wrapper script?
>>> --
>>> Todd
>>>
>>
>>>
>>> On 7/28/23 11:03 PM, Prady A wrote:
>>>
>> Hi All,
>>>
>>> I searched a quite but could able to find what I wanted
>>> Could any pls suggest me how to get the Username in the host machine. In
>>> Linux if

Re: [ansible-project] [Ansible Project] how to get the logged in username

2023-07-29 Thread Prady A
Hi Todd,

Yeah if we pass who with any arguments it remains the same. I read it some
other forum.

I tried with the python code as well as ansible_user_id both returns the
same “root”. Since I m running the playbook from root user after su -.
As you suggested we need to check how we can capture the userid who run the
playbook from Ansible tower.

Regards
Prady

On Sun, Jul 30, 2023 at 1:23, Todd Lewis  wrote:

> Without knowing your effective ansible config — i.e. the ansible.cfg it's
> using, the environment variables that can override those settings, and
> command line parameters that can override everything else — it's impossible
> to say. Factors include "become", "become-user", "become-method",
> "ask-pass", "ask-become-pass", and probably more.
>
> Are you gathering facts? Ansible does gather facts by default, so if you
> aren't turning that off somewhere, you can use the variables containing
> user related facts. For example:
>
> $ ansible localhost -m gather_facts | grep ansible_user
> "ansible_user_dir": "/home/utoddl",
> "ansible_user_gecos": "Todd Lewis",
> "ansible_user_gid": 12428,
> "ansible_user_id": "utoddl",
> "ansible_user_shell": "/bin/bash",
> "ansible_user_uid": 12428,
> "ansible_userspace_architecture": "x86_64",
> "ansible_userspace_bits": "64",
>
> Not an Ansible thing, but: Do Not Use "who am i" for this. That's the
> same a "who -m", which shows you the user associated with the stdin
> stream, but only if that user is logged in AND only if the stdin stream
> exists and has an associated user. There's a whole lot of subtle going on
> there that we don't want to get into in an Ansible forum. The reason your "su
> -" followed by "who am i" is showing your id rather than root is
> (probably) because it's your id associated with the tty you logged into.
> But that's going to be different for Ansible, depending on how your
> controller connects to the target hosts, including localhost.
>
> I gave you the python code yesterday. It's dead simple:
>
> import os
> import pwd
> userid = pwd.getpwuid(os.getuid())[0]
>
> But if you're gathering facts, just use the ansible_user_id variable.
>
> If that's "root", and that appears to be the case, then you'll need to
> understand how your controller is connecting to the target hosts. My guess
> is you'll eventually need to pass the invoking user's id as an extra
> variable ("-e invoking_user=${USER}") when invoking ansible-playbook.
> Maybe consider a wrapper script?
> --
> Todd
>
>
> On 7/28/23 11:03 PM, Prady A wrote:
>
> Hi All,
>
> I searched a quite but could able to find what I wanted
> Could any pls suggest me how to get the Username in the host machine. In
> Linux if I run the below command I get what I suppose to get but don’t know
> how to do it ansible. Any code Ansible or python would be helpful
>
> Fin Linux:
> *X1234@hostname$*su -
> *root@hostname#*who am i
> x1234  pts/2   2023-07-29  (vxj-...@domain.com)
>
> My *getuser.yml*:
> - debug: {{ lookup(‘env’, ‘USER’) }}
>delegate_to: localhost
>
> - local_action: command whoami
>register: user_name
>
> *root@hostname#* ansible-playbook getuser.yml
> Both returning me *root*. I wanted to have *X1234* user instead. I want
> use that user ID in my from address in mail module.  Any insight would be
> very helpfu.
>
> Regards
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/5eeb8d90-f325-54b3-1032-73052fad4713%40gmail.com
> <https://groups.google.com/d/msgid/ansible-project/5eeb8d90-f325-54b3-1032-73052fad4713%40gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ArTYtf%2BCcLgdrkw_8Yrd0n7CQjpWQJOKV0Nc8z6dNipTw%40mail.gmail.com.


Re: [ansible-project] [Ansible Project] how to get the logged in username

2023-07-28 Thread Prady A
Thank you for your kind reply. Yes that’s what my guess also.
As there are many user who run the ansible so it unpractical to change it
for all the user. I wanted to get the user details in runtime ..

Regards
Prady

On Sat, Jul 29, 2023 at 12:50, Abhijeet Kasurde  wrote:

> Hi Prady,
>
> You are running the playbook as root that is why the playbook is returning
> 'root'. If you need a particular user then you may want to run the playbook
> using that user.
> For example -
>
> ```
> # whoami
> akasurde
>
> # ansible-playbook user.yml -v
> PLAY [localhost]
> *
>
> TASK [debug]
> *
> ok: [localhost] => {
> "msg": "akasurde"
> }
>
> TASK [command]
> ***
> changed: [localhost] => {"changed": true, "cmd": ["who", "am", "I"],
> "delta": "0:00:00.009702", "end": "2023-07-28 20:48:00.637555", "msg": "",
> "rc": 0, "start": "2023-07-28 20:48:00.627853", "stderr": "",
> "stderr_lines": [], "stdout": "akasurde  28 Jul 20:48
> ", "stdout_lines": ["akasurde  28 Jul 20:48 "]}
>
> PLAY RECAP
> ***
> localhost      : ok=2changed=1unreachable=0
>  failed=0skipped=0rescued=0ignored=0
> ```
>
> You can use become and become_user for escalating the privileges mentioned
> in
> https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_privilege_escalation.html#become-directives
>
> On Fri, Jul 28, 2023 at 8:04 PM Prady A  wrote:
>
>> Hi All,
>>
>> I searched a quite but could able to find what I wanted
>> Could any pls suggest me how to get the Username in the host machine. In
>> Linux if I run the below command I get what I suppose to get but don’t know
>> how to do it ansible. Any code Ansible or python would be helpful
>>
>> Fin Linux:
>> *X1234@hostname$*su -
>> *root@hostname#*who am i
>> x1234  pts/2   2023-07-29  (vxj-...@domain.com)
>>
>> My *getuser.yml*:
>> - debug: {{ lookup(‘env’, ‘USER’) }}
>>delegate_to: localhost
>>
>> - local_action: command whoami
>>register: user_name
>>
>> *root@hostname#* ansible-playbook getuser.yml
>> Both returning me *root*. I wanted to have *X1234* user instead. I want
>> use that user ID in my from address in mail module.  Any insight would be
>> very helpfu.
>>
>> Regards
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAEuB3Ao1t7Wi%3DjcoBVezKwUiz_-EyaZ6%2BF_Gjb8EYRK8PusGjg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAEuB3Ao1t7Wi%3DjcoBVezKwUiz_-EyaZ6%2BF_Gjb8EYRK8PusGjg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>
>
>>
>
> --
> Thanks,
> Abhijeet Kasurde
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAFwWkHrBZU%2B3yVhRA93vALu%2Bc7AEQbtieeWeHSfeNB0Ni_iU1A%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAFwWkHrBZU%2B3yVhRA93vALu%2Bc7AEQbtieeWeHSfeNB0Ni_iU1A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Aqvv3nnpAn6OHcoJ19UONd6Mt89b4G3iwwJwvymJT%2ByWw%40mail.gmail.com.


[ansible-project] [Ansible Project] how to get the logged in username

2023-07-28 Thread Prady A
Hi All,

I searched a quite but could able to find what I wanted
Could any pls suggest me how to get the Username in the host machine. In
Linux if I run the below command I get what I suppose to get but don’t know
how to do it ansible. Any code Ansible or python would be helpful

Fin Linux:
*X1234@hostname$*su -
*root@hostname#*who am i
x1234  pts/2   2023-07-29  (vxj-...@domain.com)

My *getuser.yml*:
- debug: {{ lookup(‘env’, ‘USER’) }}
   delegate_to: localhost

- local_action: command whoami
   register: user_name

*root@hostname#* ansible-playbook getuser.yml
Both returning me *root*. I wanted to have *X1234* user instead. I want use
that user ID in my from address in mail module.  Any insight would be
very helpfu.

Regards

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Ao1t7Wi%3DjcoBVezKwUiz_-EyaZ6%2BF_Gjb8EYRK8PusGjg%40mail.gmail.com.


Re: [ansible-project] [Ansible Project] Not able to process the shell command in control node

2023-07-28 Thread Prady A
Hi Hissy,

As I said earlier I am extracting those hostname to an excel macro file
which is done by python program and send that file to a different team. But
I will consider your mail module inside the ansible now.

Regards

On Sat, Jul 29, 2023 at 0:25, Evan Hisey  wrote:

> You could reuse the module with some thing like:
> name: send email
>   command: python3 /path/to/process_hostnames.py '{{ arg }}'
>   delegate_to: localhost
>   register: out
>   vars:
> arg: "{{ ansible_play_hosts_all | join(' ') }}"
>
> On Fri, Jul 28, 2023 at 10:21 AM Prady A  wrote:
>
>> Thank you both of you and code .
>> I ll try to simplify it. since the module is already we are using in
>> different program, i reused it.
>>
>>
>> Regards
>> Prady
>>
>> On Sat, Jul 29, 2023 at 0:18, Evan Hisey  wrote:
>>
>>> This seems massively complicated for a simple shell command to send an
>>> email. ON top of that you are attempting to break the
>>> anisble.builtin.script module by forcing it to run on the localhost
>>> (controller) rather than the target.  Better option would be to just use
>>> the either the command module and mailx or the
>>> community.general.mail.module, both options will run fine with the
>>> "delegate_to: localhost" and require much less coding to make work.
>>>
>>> A rough example base on the visible code:
>>> name: mail host list
>>> community.general.mail:
>>>   host: mail.server.com
>>>   port: 25
>>>   to: John Smith 
>>>   from: i...@domain.com
>>>   subject: Ansible-report
>>>   body: List of hosts {{ ansible_hostname }}
>>> delegate to local hostocalhost
>>> register: out
>>> vars:
>>> arg: "{{ ansible_play_hosts_all |
>>> join(' ') }}"
>>>
>>>
>>>
>>>
>>>
>>> On Fri, Jul 28, 2023 at 9:46 AM Prady A  wrote:
>>>
>>>> Hi Todd,
>>>>
>>>> Thank you so much as always.
>>>> Actually to run the ansible we switch from normal user to root user and
>>>> run the ansible.
>>>> In my case when I m running "who am i"  from Putty it is working but
>>>> when I am executing it from visual studio code using remote ssh login
>>>> plugin there it is not working.
>>>> Basically I want to send the mail from the user who logged in ex:
>>>> i...@domain.com. Even though we logged in as root when we give "who am
>>>> i" it returns the logged in user even though you su to another user. I will
>>>> try to use your code. Incase still my approach is bad please let me know.
>>>>
>>>> Ex:
>>>>
>>>> ubuntu /home/gara% who am i
>>>> gara pts/02008-06-20 11:36 (192.168.0.1)
>>>> ubuntu /home/gara% whoami
>>>> gara
>>>> ubuntu /home/gara% su -
>>>> Password:
>>>> root@ubuntu:~# who am i
>>>> gara pts/0Jun 20 11:36 (192.168.0.1)
>>>> root@ubuntu:~# whoami
>>>> root
>>>> root@ubuntu:~#
>>>>
>>>> Regarding the mailing function I am using the below. But it takes 10
>>>> min to send the mail.
>>>>
>>>> class Send_Mail:
>>>> def __init__(self, to_addrs, workbook_path):
>>>> self.to_addrs = to_addrs
>>>> self.workbook_path = workbook_path
>>>> d = self.workbook_path.rsplit("/", 3)
>>>> self.workbook_filename = d[3]
>>>>
>>>> def send_mail(self):
>>>> import smtplib
>>>> from email.mime.text import MIMEText
>>>> from email import encoders
>>>> from email.mime.base import MIMEBase
>>>> from email.mime.multipart import MIMEMultipart
>>>>
>>>> msg = MIMEMultipart()
>>>> msg['Subject'] = "Validation Result"
>>>> msg["From"] = "validation_res...@domain.com"
>>>> msg["To"] = self.to_addrs
>>>> msg.preamble = 'excel test'
>>>>
>>>> try:
>>>> file = open(self.workbook_path, 'rb')
>>>> attachment = MIMEBase('application', 'vnd.ms-excel')
>>>>  

Re: [ansible-project] [Ansible Project] Not able to process the shell command in control node

2023-07-28 Thread Prady A
Thank you both of you and code .
I ll try to simplify it. since the module is already we are using in
different program, i reused it.


Regards
Prady

On Sat, Jul 29, 2023 at 0:18, Evan Hisey  wrote:

> This seems massively complicated for a simple shell command to send an
> email. ON top of that you are attempting to break the
> anisble.builtin.script module by forcing it to run on the localhost
> (controller) rather than the target.  Better option would be to just use
> the either the command module and mailx or the
> community.general.mail.module, both options will run fine with the
> "delegate_to: localhost" and require much less coding to make work.
>
> A rough example base on the visible code:
> name: mail host list
> community.general.mail:
>   host: mail.server.com
>   port: 25
>   to: John Smith 
>   from: i...@domain.com
>   subject: Ansible-report
>   body: List of hosts {{ ansible_hostname }}
> delegate to local hostocalhost
> register: out
> vars:
> arg: "{{ ansible_play_hosts_all |
> join(' ') }}"
>
>
>
>
>
> On Fri, Jul 28, 2023 at 9:46 AM Prady A  wrote:
>
>> Hi Todd,
>>
>> Thank you so much as always.
>> Actually to run the ansible we switch from normal user to root user and
>> run the ansible.
>> In my case when I m running "who am i"  from Putty it is working but when
>> I am executing it from visual studio code using remote ssh login plugin
>> there it is not working.
>> Basically I want to send the mail from the user who logged in ex:
>> i...@domain.com. Even though we logged in as root when we give "who am i"
>> it returns the logged in user even though you su to another user. I will
>> try to use your code. Incase still my approach is bad please let me know.
>>
>> Ex:
>>
>> ubuntu /home/gara% who am i
>> gara pts/02008-06-20 11:36 (192.168.0.1)
>> ubuntu /home/gara% whoami
>> gara
>> ubuntu /home/gara% su -
>> Password:
>> root@ubuntu:~# who am i
>> gara pts/0Jun 20 11:36 (192.168.0.1)
>> root@ubuntu:~# whoami
>> root
>> root@ubuntu:~#
>>
>> Regarding the mailing function I am using the below. But it takes 10 min
>> to send the mail.
>>
>> class Send_Mail:
>> def __init__(self, to_addrs, workbook_path):
>> self.to_addrs = to_addrs
>> self.workbook_path = workbook_path
>> d = self.workbook_path.rsplit("/", 3)
>> self.workbook_filename = d[3]
>>
>> def send_mail(self):
>> import smtplib
>> from email.mime.text import MIMEText
>> from email import encoders
>> from email.mime.base import MIMEBase
>> from email.mime.multipart import MIMEMultipart
>>
>> msg = MIMEMultipart()
>> msg['Subject'] = "Validation Result"
>> msg["From"] = "validation_res...@domain.com"
>> msg["To"] = self.to_addrs
>> msg.preamble = 'excel test'
>>
>> try:
>> file = open(self.workbook_path, 'rb')
>> attachment = MIMEBase('application', 'vnd.ms-excel')
>> attachment.set_payload(file.read())
>> file.close()
>> encoders.encode_base64(attachment)
>> attachment.add_header("Content-Disposition", 'attachment',
>> filename=self.workbook_filename)
>> msg.attach(MIMEText('Attached is your validation
>> result.\n\n\n', 'plain'))
>> msg.attach(attachment)
>>
>> smtp = smtplib.SMTP('localhost')
>> smtp.send_message(msg)
>> smtp.close()
>> except IOError as e:
>> print('IOE Exception!!\n{0}'.format(e))
>> except:
>> raise RuntimeError("Sorry,email could not be sent
>> successfully."
>>"Please scp the validation result
>> yourself, "
>>"there might be something wrong with the
>> email address or something\n ")
>> else:
>> print('Validation result is now being sent as an Excel file
>> to {0}.'.format(self.to_addrs))
>> finally:
>> smtp.close()
>> file.close()
>> 
>> sendmail = Send_Mail(to_addrs, workbook_path)
>> sendmail.send_mail()
>>
>>
>

Re: [ansible-project] [Ansible Project] Not able to process the shell command in control node

2023-07-28 Thread Prady A
Hi Todd,

Thank you so much as always.
Actually to run the ansible we switch from normal user to root user and run
the ansible.
In my case when I m running "who am i"  from Putty it is working but when I
am executing it from visual studio code using remote ssh login plugin there
it is not working.
Basically I want to send the mail from the user who logged in ex:
i...@domain.com. Even though we logged in as root when we give "who am i" it
returns the logged in user even though you su to another user. I will try
to use your code. Incase still my approach is bad please let me know.

Ex:

ubuntu /home/gara% who am i
gara pts/02008-06-20 11:36 (192.168.0.1)
ubuntu /home/gara% whoami
gara
ubuntu /home/gara% su -
Password:
root@ubuntu:~# who am i
gara pts/0Jun 20 11:36 (192.168.0.1)
root@ubuntu:~# whoami
root
root@ubuntu:~#

Regarding the mailing function I am using the below. But it takes 10 min to
send the mail.

class Send_Mail:
def __init__(self, to_addrs, workbook_path):
self.to_addrs = to_addrs
self.workbook_path = workbook_path
d = self.workbook_path.rsplit("/", 3)
self.workbook_filename = d[3]

def send_mail(self):
import smtplib
from email.mime.text import MIMEText
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart

msg = MIMEMultipart()
msg['Subject'] = "Validation Result"
msg["From"] = "validation_res...@domain.com"
msg["To"] = self.to_addrs
msg.preamble = 'excel test'

try:
file = open(self.workbook_path, 'rb')
attachment = MIMEBase('application', 'vnd.ms-excel')
attachment.set_payload(file.read())
file.close()
encoders.encode_base64(attachment)
attachment.add_header("Content-Disposition", 'attachment',
filename=self.workbook_filename)
msg.attach(MIMEText('Attached is your validation
result.\n\n\n', 'plain'))
msg.attach(attachment)

smtp = smtplib.SMTP('localhost')
smtp.send_message(msg)
smtp.close()
except IOError as e:
print('IOE Exception!!\n{0}'.format(e))
except:
raise RuntimeError("Sorry,email could not be sent successfully."
   "Please scp the validation result yourself, "
   "there might be something wrong with the
email address or something\n ")
else:
print('Validation result is now being sent as an Excel file to
{0}.'.format(self.to_addrs))
finally:
smtp.close()
file.close()

sendmail = Send_Mail(to_addrs, workbook_path)
sendmail.send_mail()


--
Kind regards

On Fri, Jul 28, 2023 at 21:43, Todd Lewis  wrote:

> On my controller, `who am i` produces no output. In your python script
> running on my system, because there is no output, `output[0]` correctly
> produces the "IndexError: list index out of range" message.
>
> Having your python script go to all that trouble to run an external
> program to get the user name seems a bit much. I'd suggest doing this
> instead:
>
> import os
> import pwd
> userid = pwd.getpwuid(os.getuid())[0]
>
> Then there's the question of whether you want to roll your own email
> sending program rather than using the `community.general.notification.mail`
> module. There may be good reasons either way.
>
> Good luck,
> --
> Todd
>
>
> On 7/28/23 2:12 AM, Prady A wrote:
>
> Hi Experts,
>
> Need your suggestion pls.
>
> The below one is ansible file which calls an python file in the control
> node(localhost) and process an excel file which is also present in control
> node based on hostnames. There is no issue in processing the excel and now
> I am facing challenges while sending the file in mail.I am trying to
> extract the current logged in user in control node and send mail to that
> logged in user. But both my below command incoporated in python script are
> not working.
>  #cmd = 'echo $USER
>  #cmd = 'who am i | cut -d" " -f 1'
> output, errors, return_code = serverside_execute_command(cmd)
>
> it seems my *serverside_execute_command(cmd):*
> I executed the python program standalone it is working as expected in the
> control node.But when it is called from Ansible code it is throwing the
> below error. Any insight would be greatly helpful.
>
> *Error:*
> fatal: [jp1ld100 -> localhost]: FAILED! => {"changed": true, "msg":
>

[ansible-project] [Ansible Project] Not able to process the shell command in control node

2023-07-27 Thread Prady A
Hi Experts,

Need your suggestion pls.

The below one is ansible file which calls an python file in the control
node(localhost) and process an excel file which is also present in control
node based on hostnames. There is no issue in processing the excel and now
I am facing challenges while sending the file in mail.I am trying to
extract the current logged in user in control node and send mail to that
logged in user. But both my below command incoporated in python script are
not working.
 #cmd = 'echo $USER
 #cmd = 'who am i | cut -d" " -f 1'
output, errors, return_code = serverside_execute_command(cmd)

it seems my *serverside_execute_command(cmd):*
I executed the python program standalone it is working as expected in the
control node.But when it is called from Ansible code it is throwing the
below error. Any insight would be greatly helpful.

*Error:*
fatal: [jp1ld100 -> localhost]: FAILED! => {"changed": true, "msg":
"non-zero return code", "rc": 1, "stderr": "Traceback (most recent call
last):\n  File
\"/root/.ansible/tmp/ansible-tmp-1690520194.14-32141-129555701534658/process_hostnames_v3.py\",
line 213, in \nmail(filename)\n  File
\"/root/.ansible/tmp/ansible-tmp-1690520194.14-32141-129555701534658/process_hostnames_v3.py\",
line 168, in mail\nif not re.match('x', output[0]):\nIndexError: list
index out of range\n", "stderr_lines": ["Traceback (most recent call
last):", "  File
\"/root/.ansible/tmp/ansible-tmp-1690520194.14-32141-129555701534658/process_hostnames_v3.py\",
line 213, in ", "mail(dest_filename)", "  File
\"/root/.ansible/tmp/ansible-tmp-1690520194.14-32141-129555701534658/process_hostnames_v3.py\",
line 168, in mail", "if not re.match('x', output[0]):", "IndexError:
list index out of range"], "stdout": "Test.xltm\nFile [Test.xltm] has been
updated and sent to mail\nDEBUG  cmd: who am i | cut -d\" \" -f 1\nDEBUG
return_code: 0\n", "stdout_lines": ["Test.xltm", "File [Test.xltm] has been
updated and sent to mail", "DEBUG  cmd: who am i | cut -d\" \" -f 1",
"DEBUG   return_code: 0"]}


*Process.yml:*
name: Collect host
  hosts: all
  tasks:
- block:
- name: python
  script: "process_hostnames.py '{{ arg }}'"
  args:
executable: python3
  delegate_to: localhost
  register: out
  vars:
arg: "{{ ansible_play_hosts_all | join(' ') }}"
- debug:
var: out.stdout_lines
  run_once: true


*process_hostnames.py*

def *serverside_execute_command(cmd):*
import subprocess
try:
result = subprocess.run(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
check=True, shell=True,
universal_newlines=True)
except subprocess.CalledProcessError:
print('{0}'.format(result.stdout))
sys.exit(1)

output = []
errors = []
stdout = result.stdout.splitlines()
try:
for line in stdout:
if line.strip() == "":
   pass
else:
output.append(line.strip())
except UnicodeDecodeError:
output = [ "OUTPUT UNREADABLE" ]
try:
errors.append(result.stderr.strip())
except UnicodeDecodeError:
errors = [" ERRORS UNREADABLE" ]
return_code = result.returncode

print("DEBUG  cmd: {0}".format(cmd))
print("DEBUG   return_code: {0}".format(str(return_code)))

return (output, errors, return_code)

def mail(dest_filename):
#cmd = 'echo $USER'
cmd = 'who am i | cut -d" " -f 1'
output, errors, return_code = *serverside_execute_command(cmd)*
if not re.match('x', output[0]):
   raise RuntimeError("You are {0}.Please login as xID. Then try
again.".format(result.stdout))
   sys.exit(1)
xid = output[0].rstrip('\n')


if __name__ == "__main__":
file_name= "Template.xltm"
mail(file_name)

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Ap-FZjBzOTE7_anWYyhY0u43JiDBCyOPWoMKuokkt0BEQ%40mail.gmail.com.


Re: [ansible-project] Ssh connectivity issues from a Debian core server to a remote Windows 10 Pro host.

2023-06-26 Thread Prady A
Hi

Login to your control machine with the user you control.
1 . Generate the ssh key using ssh keygen.
 # ssh keygen
2. Copy the pub key to the same user where you created the key.
Ex : #ssh-copy-id admistrator@
3. Try the adhoc command
 Ex: #ansible -i inventory -m ping

Read the ansible doc carefully again.



On Mon, Jun 26, 2023 at 22:06, gonzalo diaz larenas <
gonzalodiazlare...@gmail.com> wrote:

> Dear, thank you for answering, I already did all those steps, and it keeps
> throwing me the same error.
> Using the ssh command administrator@192.168.x.x I can connect directly
> without any problem, I have it configured so that it does not ask me for a
> password when making the ssh connection, the problem happens when I apply
> any ansible ad-hoc command For example ansible -i inventory -m ping all, or
> when I apply a playbook, I attach a file with the ssh connection directly
> to the Windows 10 machine from a centralized Debian server, I would
> appreciate your guidance.
>
>
> El jue, 22 jun 2023 a las 18:34, Brian Coca () escribió:
>
>> Did you follow
>> https://docs.ansible.com/ansible/latest/os_guide/windows_setup.html#windows-ssh-setup
>> ?
>>
>>
>> --
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CACVha7dqnVE%3DYod5aujn8eTN4AEV25-T-EEqG6J%2Bkc-sVHP-qg%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAF-YWcbCkbuMChQNxSPQ7zq%2BLB4TUF9M97ggKQtjAxtRKn4vzw%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3AqfzuyCkb74ra24%3DiKm585bj2t3VfBUZ1pr3%2BMAeoGYZA%40mail.gmail.com.


Re: [ansible-project] passing arguments to python script

2023-06-21 Thread Prady A
Hi again. Sorry if I am spamming.

I tried with below 2 option it is passing the argument as expected. I
changed from double quotes to single quote now it is working.
*{{ ansible_play_hosts_all | join('  ') }}*
*{{ groups['all'] | join(' ') }}*

*Thank you so much again*

On Wed, Jun 21, 2023 at 11:53 PM Prady A  wrote:

> Thank you both for your kind help.
> my python script expects a list. I am expecting something like  below list
> data= [["1ld501"], ["1ld994"]]
>
> This is working for me when I hardcoded inside python script. I am
> expecting similar list from ansible script.
> with the above join command all the hostname concatenates to one string
> which I am not anticipating. Kindly help.
>
> Regards
>
>
> On Wed, Jun 21, 2023 at 11:35 PM Brian Coca  wrote:
>
>> The difference between a 'python list' ( [item, item2] ) and a 'shell
>> list' `item item2`, as @Dick Visser shows a simple join can translate
>> one to the other.
>>
>> --
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CACVha7fKhVM-0ym6fMnCgMex74kdnim6xa34jbiLC9tz1UrYaA%40mail.gmail.com
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Aq7Fu_95EiZ-Y9AhUWSQX%3DJh9w_NRVJvnsZZv_OWOt8NQ%40mail.gmail.com.


Re: [ansible-project] passing arguments to python script

2023-06-21 Thread Prady A
Thank you both for your kind help.
my python script expects a list. I am expecting something like  below list
data= [["1ld501"], ["1ld994"]]

This is working for me when I hardcoded inside python script. I am
expecting similar list from ansible script.
with the above join command all the hostname concatenates to one string
which I am not anticipating. Kindly help.

Regards


On Wed, Jun 21, 2023 at 11:35 PM Brian Coca  wrote:

> The difference between a 'python list' ( [item, item2] ) and a 'shell
> list' `item item2`, as @Dick Visser shows a simple join can translate
> one to the other.
>
> --
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CACVha7fKhVM-0ym6fMnCgMex74kdnim6xa34jbiLC9tz1UrYaA%40mail.gmail.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Aoay4h1qiuT0oR5oDc8fzqfSEREjp7TAnMj94p4NrpS0g%40mail.gmail.com.


[ansible-project] passing arguments to python script

2023-06-21 Thread Prady A
Hi all

I am trying to pass the ansible hostnames as an array list to python script
but could not figure out where the extra characters are coming from. I am
passing with ansible_play_hosts_all variable.
In my host file there are 2 hoosts 1ld501 and 1ld994. but it is passing
some unexpected character marked in red.

*Playbook:*
---
- name: Execute writetoexcel python
  script: ./roles/writetoexcel.py *{{ ansible_play_hosts_all }}*
  args:
executable: python3
  delegate_to: localhost

*Output:*
 EXEC /bin/sh -c ' python3
/root/.ansible/tmp/ansible-tmp-1687354259.71-24015-237464957552077/writetoexcel.py
[*u'"'"'*1ld501*'"'"'*,* u'"'"*'1ld994*'"'"'*] && sleep 0'

changed: [1ld501 -> localhost] => {
"changed": true,
"rc": 0,
"stderr": "",
"stderr_lines": [],
"stdout": "[['[u1ld501,', 'u1ld994]']]\nData written to Excel
successfully!\n",
"stdout_lines": [
"[['[u1ld501,', 'u1ld994]']]",
"Data written to Excel successfully!"
]
}

Tried with Ansible_hostname no extra characters are there. It is as
expected. Please suggest.

*Playbook:*
 ---
- name: Execute writetoexcel python
  script: ./roles/writetoexcel.py* {{ ansible_hostname }}*
  args:
executable: python3
  delegate_to: localhost

*Output:*
 EXEC /bin/sh -c ' python3
/root/.ansible/tmp/ansible-tmp-1687354332.97-25377-185430066289739/writetoexcel.py
*1ld994* && sleep 0'
 EXEC /bin/sh -c 'rm -f -r
/root/.ansible/tmp/ansible-tmp-1687354332.95-25376-35834468227973/ >
/dev/null 2>&1 && sleep 0'
changed: [jp1ld501 -> localhost] => {
"changed": true,
"rc": 0,
"stderr": "",
"stderr_lines": [],
"stdout": "[['1ld994']]\nData written to Excel successfully!\n",
"stdout_lines": [
"[['1ld994']]",
"Data written to Excel successfully!"
]
}

Regards
PD

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ApSzymExcc7Auzp7P-v%2BxqYWiRp9GyWF%3Dzt2mQrC14Y%2BQ%40mail.gmail.com.


Re: [ansible-project]Collect hostnames in an array

2023-06-20 Thread Prady A
Thank you Abhijeet..
Actually I ve to add one role which can create an excel to automate with
the hostnames in it..
so what I thought to gather all the hostnames and process them using a
python script to update the excel and send the excel in mail.

Regards

On Wed, Jun 21, 2023 at 12:35, Abhijeet Kasurde  wrote:

> I would write an Ansible module from the Python script and do the rest in
> Ansible. Anyways, check
> https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html#magic-variables
> for ansible_play_hosts and ansible_play_hosts_all
>
> On Tue, Jun 20, 2023 at 8:25 PM Prady A  wrote:
>
>> Thank Dick..Thank you for your kindness..
>> Sorry if I confused. My intention is to run the playbook and get all the
>> hostnames in a variable .
>>
>> Like :
>> var=hostvars[ansible_hostname][‘ansible_hostname’]
>>
>> With the above command I can fetch the hostname but how to append all the
>> hostnames in an array so that finally I can pass that array to python
>> script.
>>
>> Regards
>>
>> On Wed, Jun 21, 2023 at 12:18, Dick Visser  wrote:
>>
>>> https://docs.ansible.com/ansible/latest/cli/ansible-inventory.html
>>>
>>>
>>> On Wed, 21 Jun 2023 at 04:49, Prady A  wrote:
>>>
>>>> Hi all
>>>>
>>>> Pls help.. need to collect all the hostnames in an array and pass that
>>>> are art finally to an python script as an argument..so that I can process
>>>> that python file with all hostname in a loop.
>>>>
>>>> If any other way to doing it that would be certainly great..
>>>>
>>>> Regards..
>>>> Prady
>>>>
>>>> --
>>>> 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 view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/ansible-project/CAEuB3ApQPotWX84oyr57a7qkE6B43yaKPxbCfP5Prw5kVvTwMQ%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/ansible-project/CAEuB3ApQPotWX84oyr57a7qkE6B43yaKPxbCfP5Prw5kVvTwMQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>
>>>
>>>> --
>>> Sent from Gmail Mobile
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/CAF8BbLbz0ostA9w48RkWLVaSZzF0phz6mzpqQaS1FiTy1cfCeQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/ansible-project/CAF8BbLbz0ostA9w48RkWLVaSZzF0phz6mzpqQaS1FiTy1cfCeQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAEuB3Ap82Q%2BJyoaQpBTbE5O7OF3pDP2EVH%2BR181gpYM-_dThyQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAEuB3Ap82Q%2BJyoaQpBTbE5O7OF3pDP2EVH%2BR181gpYM-_dThyQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> Thanks,
> Abhijeet Kasurde
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAFwWkHoLMCmi30mutdBD9b7c4iq2nT4UoAZAc%2BebW5Y5O%3DLRGA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAFwWkHoLMCmi30mutdBD9b7c4iq2nT4UoAZAc%2BebW5Y5O%3DLRGA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3AoSRpRiWwzABbzbtSDdfjEML7PPNPUP6tYOG6h2Td%3DGVA%40mail.gmail.com.


Re: [ansible-project]Collect hostnames in an array

2023-06-20 Thread Prady A
Thank Dick..Thank you for your kindness..
Sorry if I confused. My intention is to run the playbook and get all the
hostnames in a variable .

Like :
var=hostvars[ansible_hostname][‘ansible_hostname’]

With the above command I can fetch the hostname but how to append all the
hostnames in an array so that finally I can pass that array to python
script.

Regards

On Wed, Jun 21, 2023 at 12:18, Dick Visser  wrote:

> https://docs.ansible.com/ansible/latest/cli/ansible-inventory.html
>
>
> On Wed, 21 Jun 2023 at 04:49, Prady A  wrote:
>
>> Hi all
>>
>> Pls help.. need to collect all the hostnames in an array and pass that
>> are art finally to an python script as an argument..so that I can process
>> that python file with all hostname in a loop.
>>
>> If any other way to doing it that would be certainly great..
>>
>> Regards..
>> Prady
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAEuB3ApQPotWX84oyr57a7qkE6B43yaKPxbCfP5Prw5kVvTwMQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAEuB3ApQPotWX84oyr57a7qkE6B43yaKPxbCfP5Prw5kVvTwMQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>
>
>> --
> Sent from Gmail Mobile
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAF8BbLbz0ostA9w48RkWLVaSZzF0phz6mzpqQaS1FiTy1cfCeQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAF8BbLbz0ostA9w48RkWLVaSZzF0phz6mzpqQaS1FiTy1cfCeQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Ap82Q%2BJyoaQpBTbE5O7OF3pDP2EVH%2BR181gpYM-_dThyQ%40mail.gmail.com.


[ansible-project]Collect hostnames in an array

2023-06-20 Thread Prady A
Hi all

Pls help.. need to collect all the hostnames in an array and pass that are
art finally to an python script as an argument..so that I can process that
python file with all hostname in a loop.

If any other way to doing it that would be certainly great..

Regards..
Prady

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3ApQPotWX84oyr57a7qkE6B43yaKPxbCfP5Prw5kVvTwMQ%40mail.gmail.com.


[ansible-project] Re: Need help with executing a python script automation

2023-06-20 Thread Prady A
I found one solution to with delegate_to option to run on the task on
particular server.

Regards

On Wed, Jun 21, 2023 at 10:23, Prady A  wrote:

> Hi all
>
> I want to execute a python script which is available in control node. And
> the python script uses the ansible_hostname variable and update in an excel
> template available in the control node.
>
>
> My role is very simple:
> - name: execute python script
>script: ./roles/writetoexcel.py {{ ansible_hostname }}
>args:
> executable: python3
>
> Since this role executes the python file in the remote node it is failing.
> Python3 command not found.. my intention is to run this python script in
> the control node for all the hosts and just use the ansible_hostname
> variable from ansible to update the excel which is also available in local.
>
> Regards
> Prady
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3AqeXO%2Bjk4-QaQCCa7h3xz3AK9O9f5zPonRoaaqE4%3DqVpA%40mail.gmail.com.


[ansible-project] Need help with executing a python script automation

2023-06-20 Thread Prady A
Hi all

I want to execute a python script which is available in control node. And
the python script uses the ansible_hostname variable and update in an excel
template available in the control node.


My role is very simple:
- name: execute python script
   script: ./roles/writetoexcel.py {{ ansible_hostname }}
   args:
executable: python3

Since this role executes the python file in the remote node it is failing.
Python3 command not found.. my intention is to run this python script in
the control node for all the hosts and just use the ansible_hostname
variable from ansible to update the excel which is also available in local.

Regards
Prady

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Ap5uF35U1Y0KApx5k0N4Rj%3DX-BcwXKf_pW7XAc8WbR7Cw%40mail.gmail.com.


Re: [ansible-project] Ssh connectivity issues with ad-hoc commands, playbooks.yml, Ansible.

2023-06-14 Thread Prady A
 in ansible.cfg configuration file you can specify
Remote_user = administrator

On Thu, Jun 15, 2023 at 15:36, Thanh Nguyen Duc 
wrote:

> Need to specify your target ssh user.
>
> On 15 Jun 2023, at 12:30, Prady A  wrote:
>
> 
> You are running the script from root user. So it is trying to connect
> root@ip not administrator@ip
>
>
> On Thu, Jun 15, 2023 at 0:58, gonzalo diaz larenas <
> gonzalodiazlare...@gmail.com> wrote:
>
>> Dear
>> Good afternoon, sorry for the inconvenience, I'm just getting started
>> with what Ansible is, specifically learning how to optimize daily tasks in
>> laboratories. I set up a virtualized network with a central ansible server,
>> from where I apply ad-hoc commands and automated playbooks.yml files that
>> point to remote hosts, I managed to configure three machines with different
>> Debian distributions, I can connect via ssh without any problem, each
>> machine has the corresponding public key, which I copied from the central
>> server, that is, every time I connect via ssh it does not ask me for a
>> password, this is a fundamental requirement when applying ad-hoc or
>> playbook commands, with these machines I have no problems of ssh
>> connectivity. I wanted to expand the network by adding a group called
>> ClientWindows to the inventory file, which will host computers with
>> Microsoft Windows 10 Pro, via ssh I can connect directly to this type of
>> machine without any problem, I also configure them so that they do not ask
>> me for the password when applying ad-hoc or playbook.yml commands, but here
>> comes a problem, every time I apply an ad-hoc or playbook.yml command it
>> gives me connectivity problems via ssh (Permission denied), when I see the
>> connectivity error I deduce that by default ssh points to the root user,
>> but it turns out that I am trying to connect to a machine with Windows 10
>> Pro that has the administrator username, the strange thing about all this
>> is that when I connect via ssh directly (ssh administrator@x.x.x.x ) I
>> have no problem, in fact I have configured the ssh connection so that it
>> does not ask me for a password, I am attaching a file with the details of
>> what I mentioned earlier, I would appreciate your guidance, regards.
>>
>> 
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/7d00c709-bc7b-4e50-8269-937c3a572ba3n%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/7d00c709-bc7b-4e50-8269-937c3a572ba3n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAEuB3Ap9oc5GCEF-S%2B4rWJt3Uj1S7tpgcpirRP9B%3DSw%2BnD%2B7iw%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAEuB3Ap9oc5GCEF-S%2B4rWJt3Uj1S7tpgcpirRP9B%3DSw%2BnD%2B7iw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/792C4FEB-3C2E-4F71-9938-B2EC2456728C%40gmail.com
> <https://groups.google.com/d/msgid/ansible-project/792C4FEB-3C2E-4F71-9938-B2EC2456728C%40gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Ar1zDnhxi7iQLQ7SBJHV5qaba8PO319t1Y5LVQEKYr-0Q%40mail.gmail.com.


Re: [ansible-project] Ssh connectivity issues with ad-hoc commands, playbooks.yml, Ansible.

2023-06-14 Thread Prady A
You are running the script from root user. So it is trying to connect
root@ip not administrator@ip


On Thu, Jun 15, 2023 at 0:58, gonzalo diaz larenas <
gonzalodiazlare...@gmail.com> wrote:

> Dear
> Good afternoon, sorry for the inconvenience, I'm just getting started with
> what Ansible is, specifically learning how to optimize daily tasks in
> laboratories. I set up a virtualized network with a central ansible server,
> from where I apply ad-hoc commands and automated playbooks.yml files that
> point to remote hosts, I managed to configure three machines with different
> Debian distributions, I can connect via ssh without any problem, each
> machine has the corresponding public key, which I copied from the central
> server, that is, every time I connect via ssh it does not ask me for a
> password, this is a fundamental requirement when applying ad-hoc or
> playbook commands, with these machines I have no problems of ssh
> connectivity. I wanted to expand the network by adding a group called
> ClientWindows to the inventory file, which will host computers with
> Microsoft Windows 10 Pro, via ssh I can connect directly to this type of
> machine without any problem, I also configure them so that they do not ask
> me for the password when applying ad-hoc or playbook.yml commands, but here
> comes a problem, every time I apply an ad-hoc or playbook.yml command it
> gives me connectivity problems via ssh (Permission denied), when I see the
> connectivity error I deduce that by default ssh points to the root user,
> but it turns out that I am trying to connect to a machine with Windows 10
> Pro that has the administrator username, the strange thing about all this
> is that when I connect via ssh directly (ssh administrator@x.x.x.x ) I
> have no problem, in fact I have configured the ssh connection so that it
> does not ask me for a password, I am attaching a file with the details of
> what I mentioned earlier, I would appreciate your guidance, regards.
>
> [image: Problemas de conectividad ssh Windows.JPG]
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/7d00c709-bc7b-4e50-8269-937c3a572ba3n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Ap9oc5GCEF-S%2B4rWJt3Uj1S7tpgcpirRP9B%3DSw%2BnD%2B7iw%40mail.gmail.com.


[ansible-project] firewalld not found

2023-06-14 Thread Prady A
This is regarding firewalld collection

I installed Rhel-system-roles now I copied firewalld.yml to my local
collection(./collections) folder and when I am executing ansible-doc
firewalld it cannot be found.
Though if I am executing being inside the folder no issue. I want to use
this firewalld from my own configuration file.

My ansible.cfg
collections_path=./collections

Please suggest

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Aqsweo7XTHCTwqZB4ihQFezY8yxKGVBqxWTeQra%2BzQ3pQ%40mail.gmail.com.


Re: [ansible-project] ansible cannot log into server, yet I can ssh in manually

2023-06-12 Thread Prady A
I suspect your ssh public key is not copied properly to those managed
nodes. need to check config file. Check in the managed node whether the ssh
public key is copied or not if you are using password less authentication.


On Mon, Jun 12, 2023 at 22:12, Thanh Nguyen Duc 
wrote:

> Seem like it still using default configuration of ansible. Can show -
> and your config?
>
> On 12 Jun 2023, at 18:12, Kathy L  wrote:
>
> 
>
> I am not using key authentication - userid and password.  I've checked
> multiple times to ensure it is the correct userid and password.  I've tried
> using --ask-pass as well as entering the user name and password in the
> hosts file.
>
> I'm using ansible version. 2.14.4 against CentOS 7 and Debian hosts.
>
> My secure log says it is looking for a public key, which I do not have set
> up.  The sshd_config file clearly states "PasswordAuthentication yes".
>
> I use the same user in my ansible hosts file as when I ssh in.
>
>
> On Monday, June 12, 2023 at 6:23:23 AM UTC-4 Thanh Nguyen Duc wrote:
>
>> Are you using key authentication or password authentication? what is the
>> secure log in your target machine? how did you configure it?
>>
>> Vào Th 2, 12 thg 6, 2023 vào lúc 18:17 Kathy L  đã
>> viết:
>>
>>> As the title says, I am trying to run an ansible playbook against 10
>>> hosts.  All 10 fail stating they cannot connect to the host via ssh.  The
>>> error sent back from ansible is:
>>>
>>> "Failed to connect to the host va ssh Received disconnect.. Too many
>>> authentication failures."
>>>
>>> Yet if I ssh into the host manually with the same account I can get into
>>> the host fine.
>>>
>>> I've run the setup module against these hosts with the same issue.  When
>>> I run ansible with -vvv the only thing I see is ssh trying 3 times and
>>> failing...
>>>
>>> Any ideas on what else I can try?
>>>
>>> --
>>>
>> 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.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/9f897f2f-8c17-4678-8d97-1d45ad159982n%40googlegroups.com
>>> 
>>> .
>>>
>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f66bb50c-8270-414d-b24a-1ed83b783748n%40googlegroups.com
> 
> .
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/44149AC6-B728-4165-8111-9E185ADFB389%40gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3AqCWKyP2XWqhqjAWa8A%3D4ASoXYY8yso9Y99LkaXSB8f6w%40mail.gmail.com.


Re: [ansible-project] ansible cannot log into server, yet I can ssh in manually

2023-06-12 Thread Prady A
Give some details about below:
from which user you are trying to connect to.
>From which user your ssh is configured.
And from which user you are ruining your ansible script..

On Mon, Jun 12, 2023 at 19:17, Kathy L  wrote:

> As the title says, I am trying to run an ansible playbook against 10
> hosts.  All 10 fail stating they cannot connect to the host via ssh.  The
> error sent back from ansible is:
>
> "Failed to connect to the host va ssh Received disconnect.. Too many
> authentication failures."
>
> Yet if I ssh into the host manually with the same account I can get into
> the host fine.
>
> I've run the setup module against these hosts with the same issue.  When I
> run ansible with -vvv the only thing I see is ssh trying 3 times and
> failing...
>
> Any ideas on what else I can try?
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/9f897f2f-8c17-4678-8d97-1d45ad159982n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Aq-ksxtauKpWSvCbc7DvpNZsCNECQnB%2BR91-v8ieD2HWQ%40mail.gmail.com.


[ansible-project] ssh-key exchange and root password set

2023-03-29 Thread Prady A
Hello folks

As a new learner, I am trying to copy the ssh pub key to the managed node
as below.

ssh_install.yml
===
tasks:
- name: Exchange the pub key
  authorized_key:
user: root
state: present
key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
===

Running with below  command
#ansible-playbook -i inventory ssh_install.yml *-k*
It is running without any issue but is there any way to avoid the -k
option? I dont want to provide the password for each managed node in the
command prompt.

Secondly using below task for changing the root password. I will use vault
to store PLAIN_PASSWORD. Is there any better method to do it? Kindly advice.
- name: passwd change
user:
name: root
password: "{{ 'PLAIN_PASSWORD' | password_hash('sha512') }}"

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3AqUA3ME-PdwKi_ugERPPp5OifysPB_UjMGAfpw1Y6eUrA%40mail.gmail.com.


Re: [ansible-project] Re: Based on Variable defined template should behave

2023-03-07 Thread Prady A
Hi Lewis

Your advice worked like a charm. Thank u again . I replaced this piece of
code with yours.

{% if variable is defined %}
value of variable: {{ variable }}
{% else %}
variable is not defined
{% endif %}

But can we extend you piece of code to take the default value except for
Amazon servers.
Amazon servers = ansible_local.bu
!Amazon servers = ansible_local.lob

Regards
PD

On Mon, Mar 6, 2023 at 21:40, Todd Lewis  wrote:

> *Template: *etc-motd.j1
> REMINDER: This is {{ ansible_hostname }}, a {{ ansible_local.function }}
> server of {{ ansible_local.project }}, owned by {{ ansible_local.lob |
> default(ansible_local.bu) }}
>
>
> On Monday, March 6, 2023 at 2:29:18 AM UTC-5 Prady A wrote:
>
>> Hello experts,
>>
>> Need one little suggestion on below ..
>> Below is my current code .
>>
>> - name: set /etc/motd for abcd servers
>>   template:
>> src: etc-motd.j1
>> dest: /etc/motd
>> owner: root
>> group: root
>> mode: 0644
>> backup: yes
>>   when:
>>- is_us
>>
>> *Template: *etc-motd.j1
>> REMINDER: This is {{ ansible_hostname }}, a {{ ansible_local.function }}
>> server of {{ ansible_local.project }}, owned by {{ ansible_local.*bu* }}
>>
>> Now the problem is when ansible_local.*lob is *defined then the above
>> ansible_local.*bu* should be replaced by ansible_local.*lob* but if not
>> defined then it should use ansible_local.*bu. *
>>
>> I know if I write two templates one is for *bu* and one is for *lob* the
>> it might solve.  Like below . But it will too much change for this
>> requirement I guess . Any better idea will be appreciated.
>>
>> *- *name: set /etc/motd for abcd servers
>>   template:
>> src: etc-motd.j1
>> dest: /etc/motd
>> owner: root
>> group: root
>> mode: 0644
>> backup: yes
>>   when:
>>- is_us
>>- ansible_local.*lob* is *defined*
>>
>> *template1*: etc-motd.j1
>> REMINDER: This is {{ ansible_hostname }}, a {{ ansible_local.function }}
>> server of {{ ansible_local.project }}, owned by {{ ansible_local.*lob* }}
>>
>>
>> ===
>> - name: set /etc/motd for abcd servers
>>   template:
>> src: etc-motd.j2
>> dest: /etc/motd
>> owner: root
>> group: root
>> mode: 0644
>> backup: yes
>>   when:
>>- is_us
>>- ansible_local.*lob is not *defined
>>
>> *Template*: etc-motd.j2
>> REMINDER: This is {{ ansible_hostname }}, a {{ ansible_local.function }}
>> server of {{ ansible_local.project }}, owned by {{ ansible_local.*bu* }}
>>
>> Regards
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f0b3e3b0-89c7-4033-b07d-14243352ffd1n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/f0b3e3b0-89c7-4033-b07d-14243352ffd1n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Ap4F0CW6qZxTvEnjmsphawgn-V5-MUTa2vzTUARhr4Chg%40mail.gmail.com.


Re: [ansible-project] Re: Based on Variable defined template should behave

2023-03-06 Thread Prady A
Thank you Lewis.. I ll try ..

Regards

On Mon, Mar 6, 2023 at 21:40, Todd Lewis  wrote:

> *Template: *etc-motd.j1
> REMINDER: This is {{ ansible_hostname }}, a {{ ansible_local.function }}
> server of {{ ansible_local.project }}, owned by {{ ansible_local.lob |
> default(ansible_local.bu) }}
>
>
> On Monday, March 6, 2023 at 2:29:18 AM UTC-5 Prady A wrote:
>
>> Hello experts,
>>
>> Need one little suggestion on below ..
>> Below is my current code .
>>
>> - name: set /etc/motd for abcd servers
>>   template:
>> src: etc-motd.j1
>> dest: /etc/motd
>> owner: root
>> group: root
>> mode: 0644
>> backup: yes
>>   when:
>>- is_us
>>
>> *Template: *etc-motd.j1
>> REMINDER: This is {{ ansible_hostname }}, a {{ ansible_local.function }}
>> server of {{ ansible_local.project }}, owned by {{ ansible_local.*bu* }}
>>
>> Now the problem is when ansible_local.*lob is *defined then the above
>> ansible_local.*bu* should be replaced by ansible_local.*lob* but if not
>> defined then it should use ansible_local.*bu. *
>>
>> I know if I write two templates one is for *bu* and one is for *lob* the
>> it might solve.  Like below . But it will too much change for this
>> requirement I guess . Any better idea will be appreciated.
>>
>> *- *name: set /etc/motd for abcd servers
>>   template:
>> src: etc-motd.j1
>> dest: /etc/motd
>> owner: root
>> group: root
>> mode: 0644
>> backup: yes
>>   when:
>>- is_us
>>- ansible_local.*lob* is *defined*
>>
>> *template1*: etc-motd.j1
>> REMINDER: This is {{ ansible_hostname }}, a {{ ansible_local.function }}
>> server of {{ ansible_local.project }}, owned by {{ ansible_local.*lob* }}
>>
>>
>> ===
>> - name: set /etc/motd for abcd servers
>>   template:
>> src: etc-motd.j2
>> dest: /etc/motd
>> owner: root
>> group: root
>> mode: 0644
>> backup: yes
>>   when:
>>- is_us
>>- ansible_local.*lob is not *defined
>>
>> *Template*: etc-motd.j2
>> REMINDER: This is {{ ansible_hostname }}, a {{ ansible_local.function }}
>> server of {{ ansible_local.project }}, owned by {{ ansible_local.*bu* }}
>>
>> Regards
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f0b3e3b0-89c7-4033-b07d-14243352ffd1n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/f0b3e3b0-89c7-4033-b07d-14243352ffd1n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3AojQLPVFtNw4YuUywXAQnsvepXw2wtXujiAVhwiP9PMyw%40mail.gmail.com.


[ansible-project] Based on Variable defined template should behave

2023-03-05 Thread Prady A
Hello experts,

Need one little suggestion on below ..
Below is my current code .

- name: set /etc/motd for abcd servers
  template:
src: etc-motd.j1
dest: /etc/motd
owner: root
group: root
mode: 0644
backup: yes
  when:
   - is_us

*Template: *etc-motd.j1
REMINDER: This is {{ ansible_hostname }}, a {{ ansible_local.function }}
server of {{ ansible_local.project }}, owned by {{ ansible_local.*bu* }}

Now the problem is when ansible_local.*lob is *defined then the above
ansible_local.*bu* should be replaced by ansible_local.*lob* but if not
defined then it should use ansible_local.*bu. *

I know if I write two templates one is for *bu* and one is for *lob* the it
might solve.  Like below . But it will too much change for this requirement
I guess . Any better idea will be appreciated.

*- *name: set /etc/motd for abcd servers
  template:
src: etc-motd.j1
dest: /etc/motd
owner: root
group: root
mode: 0644
backup: yes
  when:
   - is_us
   - ansible_local.*lob* is *defined*

*template1*: etc-motd.j1
REMINDER: This is {{ ansible_hostname }}, a {{ ansible_local.function }}
server of {{ ansible_local.project }}, owned by {{ ansible_local.*lob* }}


===
- name: set /etc/motd for abcd servers
  template:
src: etc-motd.j2
dest: /etc/motd
owner: root
group: root
mode: 0644
backup: yes
  when:
   - is_us
   - ansible_local.*lob is not *defined

*Template*: etc-motd.j2
REMINDER: This is {{ ansible_hostname }}, a {{ ansible_local.function }}
server of {{ ansible_local.project }}, owned by {{ ansible_local.*bu* }}

Regards

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Ar7Fx6k89M9ue2YL6j4a%3DWQzAsrvkgr30q3harm0vvCLA%40mail.gmail.com.


Re: [ansible-project] Key Update depending on the OS version

2022-07-11 Thread Prady A
Thank you for all your help always .. I found the solution for the above

   {% if ansible_distribution_major_version == "8"}
   {{  RHEL8_KEY }}
   {% if ansible_distribution_major_version == "7"}
   {{  RHEL7_KEY }}
   {% if ansible_distribution == "Amazon" }
   {{  AMZN_KEY }}
   {% endif %}

On Tue, Jul 12, 2022 at 1:12 PM Prady A  wrote:

> Hello Folk,
>
> Need one help in updating the key to sshd_config file depending on the OS
> version.
>
> I ve folder structure like below
>  - roles
> - sshd
>  - tasks
> main.yml
>  - vars
> main.yml
>  - template
> main.yml
>
> I want to update */template/main.yml* like
>
>{% if ansible_distribution_major_version == "8"}
>Insert   RHEL8 KEY  etc/ssh/sshd_config
>{% if ansible_distribution_major_version == "7"}
>Inset  RHEL7 KEY to etc/ssh/sshd_config
>{% if ansible_distribution == "Amazon" }
>   Inset  Amazon KEY to etc/ssh/sshd_config
>{% endif %}
>
> my *tasks/main.yml *
>
> - name : Update the key in sshd_config
>  template:
>  src: template/sshd.conf.j2
>  dest: /etc/ssh/sshd_config
>
> Can I write KEY in Vars/main.yml and update the /etc/ssh/sshd_config file.
> The above is my approach till now but please somebody help me how can I
> update the sshd_config file with the key.
>
> Like in */vars/main.yml*
>
>  RHEL8_KEY = xyz
>  RHEL7_KEY = abc
>  RHEL6_KEY = mno
>  AMAZON_KEY = amazon
>
> Regards
>
>
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3AoYxMXLFRdVAxg4-tOG-%2B4UN%2B6fjOtiD6CFdeKXcu%2B0bg%40mail.gmail.com.


[ansible-project] Key Update depending on the OS version

2022-07-11 Thread Prady A
Hello Folk,

Need one help in updating the key to sshd_config file depending on the OS
version.

I ve folder structure like below
 - roles
- sshd
 - tasks
main.yml
 - vars
main.yml
 - template
main.yml

I want to update */template/main.yml* like

   {% if ansible_distribution_major_version == "8"}
   Insert   RHEL8 KEY  etc/ssh/sshd_config
   {% if ansible_distribution_major_version == "7"}
   Inset  RHEL7 KEY to etc/ssh/sshd_config
   {% if ansible_distribution == "Amazon" }
  Inset  Amazon KEY to etc/ssh/sshd_config
   {% endif %}

my *tasks/main.yml *

- name : Update the key in sshd_config
 template:
 src: template/sshd.conf.j2
 dest: /etc/ssh/sshd_config

Can I write KEY in Vars/main.yml and update the /etc/ssh/sshd_config file.
The above is my approach till now but please somebody help me how can I
update the sshd_config file with the key.

Like in */vars/main.yml*

 RHEL8_KEY = xyz
 RHEL7_KEY = abc
 RHEL6_KEY = mno
 AMAZON_KEY = amazon

Regards

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Ar4NR0qzNU7kH_H_dBUsaEc9KsPDBZw2O1ON4DY-MNKVA%40mail.gmail.com.


Re: [ansible-project] Need help on ansible code from shell script

2022-07-09 Thread Prady A
Hi

I  created the ansible code to create the log directory and file and the
next thing I got stuck in the below code . I did not find any solution for
if else condition in ansible .

My folder structure is like below

Under roles
- tasks
- vars
- template

Regards

As of now I created files in tasks

On Sun, Jul 10, 2022 at 1:44, Dick Visser  wrote:

> What did you try already?
> How does your playbook look like?
>
>
> On Sat, 9 Jul 2022 at 13:01, Prady A  wrote:
>
>> Hi Experts,
>>
>> Just started learning ansible few weeks back. want to automate a shell
>> script. Need your help badly. Any jinja template or any help would be
>> greatly appreciated.
>>
>> Here is the pseudocode for the shell script
>>
>> RHEL7_ENTRY1 -= "Algorithim-abc-xyz"
>> RHEL7_ENTRY2 -= "Cipher- cxyx-dfas"
>> MULTIPLE_ENTRY1= `grep -i  Cipher /etc/ssh/sshd_config | wc -l`
>> $SSHD_FILE  = /etc/ssh/sshd_config
>>
>> If (OS== RHEL7)
>> Print (Redhat 7 >> to the logfile)
>> If $RHEL7_ENTRY1 found in /etc/ssh/sshd_config file
>>  print ( "Entry 1 found Ifgnoring changes " >> to the logfile)
>>  if($MULTIPLE_ENTRY -gt 1)
>>1. Delete the old/duplicate entry of *"Algorithm"* from
>> sshd_config file
>>   sed -i '/Algothims/d' $SSHD_FILE
>>   sed -i '/Ciphers/d' $SSHD_FILE
>>2. Add the new key(RHEL7_ENTRY1 & RHEL_ENTRY2) to the
>> sshd_cofig file
>>   sed -i "$a $RHEL7_ENTRY1" $SSHD FILE
>>   sed -i "$a $RHEL7_ENTRY2" $SSHD_FILE
>>  else
>>  1. Print First entry does not match >> logfile
>>  2. remove any line if match to the string "Cipher"
>>  3. Add RHEL7_ENTRY1 to sshd_config file
>>   if (RHEL7_ENTRY2) found in sshd_config file
>>Print  Entry2 found Ignoring changes >> logfile
>>else
>>print "2nd Entry not an exact match updating the file >>
>> logfile
>>remove the line containing the string *"Cipher"*
>>Add the new key(RHEL_ENTRY2) to the sshd_cofig file
>>   fi
>>
>> And I ve to run the same for RHEL6, 7, 8 and Amazon Linux
>>
>> Regards
>>
>>
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAEuB3Ao3%3DcqX7mHUSXeEFWowveUHT80%2BLK%3D0ayPEZwm6R8A3jg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAEuB3Ao3%3DcqX7mHUSXeEFWowveUHT80%2BLK%3D0ayPEZwm6R8A3jg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>
>
>> --
> Sent from Gmail Mobile
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAF8BbLZeFvbkbUw8u3wyAq1iB6NRdT6E9MXA5GQcNZJfP%2B24LA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAF8BbLZeFvbkbUw8u3wyAq1iB6NRdT6E9MXA5GQcNZJfP%2B24LA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Arv3-0PxirhQ6-BJWo36Y0WSADozfzkHUzQsk--Lc_5wA%40mail.gmail.com.


[ansible-project] Need help on ansible code from shell script

2022-07-09 Thread Prady A
Hi Experts,

Just started learning ansible few weeks back. want to automate a shell
script. Need your help badly. Any jinja template or any help would be
greatly appreciated.

Here is the pseudocode for the shell script

RHEL7_ENTRY1 -= "Algorithim-abc-xyz"
RHEL7_ENTRY2 -= "Cipher- cxyx-dfas"
MULTIPLE_ENTRY1= `grep -i  Cipher /etc/ssh/sshd_config | wc -l`
$SSHD_FILE  = /etc/ssh/sshd_config

If (OS== RHEL7)
Print (Redhat 7 >> to the logfile)
If $RHEL7_ENTRY1 found in /etc/ssh/sshd_config file
 print ( "Entry 1 found Ifgnoring changes " >> to the logfile)
 if($MULTIPLE_ENTRY -gt 1)
   1. Delete the old/duplicate entry of *"Algorithm"* from
sshd_config file
  sed -i '/Algothims/d' $SSHD_FILE
  sed -i '/Ciphers/d' $SSHD_FILE
   2. Add the new key(RHEL7_ENTRY1 & RHEL_ENTRY2) to the
sshd_cofig file
  sed -i "$a $RHEL7_ENTRY1" $SSHD FILE
  sed -i "$a $RHEL7_ENTRY2" $SSHD_FILE
 else
 1. Print First entry does not match >> logfile
 2. remove any line if match to the string "Cipher"
 3. Add RHEL7_ENTRY1 to sshd_config file
  if (RHEL7_ENTRY2) found in sshd_config file
   Print  Entry2 found Ignoring changes >> logfile
   else
   print "2nd Entry not an exact match updating the file >>
logfile
   remove the line containing the string *"Cipher"*
   Add the new key(RHEL_ENTRY2) to the sshd_cofig file
  fi

And I ve to run the same for RHEL6, 7, 8 and Amazon Linux

Regards

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Ao3%3DcqX7mHUSXeEFWowveUHT80%2BLK%3D0ayPEZwm6R8A3jg%40mail.gmail.com.


Re: [ansible-project] Unable to execute ansible playbook

2022-07-06 Thread Prady A
While executing the command provide -k option and provide the root password
or
Authenticate your localhost.


On Thu, Jul 7, 2022 at 14:44, Ashok Reddy  wrote:

> Hi all,
>
> I got the following error, while trying to execute ansible playbook:
>
> TASK [Gathering Facts]
> 
>
> fatal: [localhost]: UNREACHABLE! => {"changed": false, "msg": "Failed to
> create temporary directory.In some cases, you may have been able to
> authenticate and did not have permissions on the target directory. Consider
> changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\",
> for more error information use -vvv. Failed command was: ( umask 77 &&
> mkdir -p \"` echo /var/tmp `\"&& mkdir \"` echo
> /var/tmp/ansible-tmp-1657172514.8192306-2106-9375282374437 `\" && echo
> ansible-tmp-1657172514.8192306-2106-9375282374437=\"` echo
> /var/tmp/ansible-tmp-1657172514.8192306-2106-9375282374437 `\" ), exited
> with result 142, stdout output: Please login as the user \"cloud-user\"
> rather than the user \"root\".\n\n", "unreachable": true}
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f2a0e03c-b35f-47ee-afa6-0a1f8b907005n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3Ap8rvefKQxLXiKkWLSJ2%2BNj%2Brk1SjZ%2Bx6SDFJMy%2Bc2Gqw%40mail.gmail.com.