Re: [ansible-project] Process Monitoring in Ansible

2020-05-21 Thread Vladimir Botka
On Thu, 21 May 2020 17:59:15 -0700 (PDT)
Jenisha T  wrote:

> Is there a way in Ansible to find if process complete. I m running an 
> os-copy process. How to check if the process completed. The hard way is to 
> wait  for 2hrs and read logs to find the word in the log is there a 
> sentence "OS copy success".

There is only hard way "Asynchronous Actions and Polling"
https://docs.ansible.com/ansible/latest/user_guide/playbooks_async.html

> Is there any elegant way to do it in ansible check if 
> the process completes go to the next task instead of waiting for 2 hrs and 
> then checking logs. 

AFAIK, there is no distributed interprocess communication. Probably because
of the large variety of supported platforms. Instead, the process might
trigger ansible-pull when ready
https://docs.ansible.com/ansible/latest/cli/ansible-pull.html

HTH,

-vlado

-- 
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/20200522073936.2d749d9d%40gmail.com.


pgpOP2FEt0Mrq.pgp
Description: OpenPGP digital signature


Re: [ansible-project] how to run specific task locally on ansible ?

2020-05-21 Thread vinod devops
Thank you!

On Thursday, May 21, 2020 at 10:07:43 AM UTC-5, Stefan Hornburg (Racke) 
wrote:
>
> On 5/21/20 5:00 PM, vinod devops wrote: 
> > there are no of tasks in play book,  
> >
> > all tasks are running remotely on  host. I want to run only one task 
> locally. 
> > 
> > 
> > How do I do that ? Thanks 
> > 
>
> - name: ... 
>    
>   delegate_to: localhost 
>
> You may also add the following: 
>
>   run_once: true 
>
> Regards 
>   Racke 
>
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Ansible Project" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to 
> > ansible...@googlegroups.com   ansible-project+unsubscr...@googlegroups.com >. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/ansible-project/c19122b7-5f83-48b0-b51d-eba574d62d7a%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/ansible-project/c19122b7-5f83-48b0-b51d-eba574d62d7a%40googlegroups.com?utm_medium=email_source=footer>.
>  
>
>
>
> -- 
> Ecommerce and Linux consulting + Perl and web application programming. 
> Debian and Sympa administration. Provisioning with Ansible. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b886d160-aaba-4b80-9c51-54da062897c2%40googlegroups.com.


Re: [ansible-project] how to run specific task locally on ansible ?

2020-05-21 Thread vinod devops
Thank you.

On Thursday, May 21, 2020 at 10:36:47 AM UTC-5, gali.suneel wrote:
>
> You can use:
>
>
> local_action or delegate_to: localhost  at task level.
>
> -Suneel
>
>
> Sent from my Samsung Galaxy smartphone.
>
>
>  Original message 
> From: Vivek Kothawale > 
> Date: 21/05/2020 20:35 (GMT+05:30) 
> To: ansible...@googlegroups.com  
> Subject: Re: [ansible-project] how to run specific task locally on ansible 
> ? 
>
> Hi
>
> Use tags to achieve this.
>
> Thanks,
> Vivek
>
> On Thu, May 21, 2020, 8:30 PM vinod devops  > wrote:
>
>> there are no of tasks in play book, 
>>   
>> all tasks are running remotely on  host. I want to run only one task 
>> locally.
>>
>>
>> How do I do that ? Thanks
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ansible...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/c19122b7-5f83-48b0-b51d-eba574d62d7a%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...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/CAA420E_2mgz%3Db-AF9LZQfpXuK6NECNJ3UE%3DALiTTW7GyuPh_9w%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/b336e882-3062-4c44-8cfd-d6242b29e140%40googlegroups.com.


Re: [ansible-project] win_domain_computer module

2020-05-21 Thread Jordan Borean
> The documentation page for this module only says name is mandatory 
parameter, rest is optional.

There is only 1 option that is always required 'name', but if you read the 
description you can see that there are multiple others that are required 
when 'state=present'.

> I want to retrieve it’s OU location

The module doesn't look like it will do what you want, it's designed to 
enforce a state which requires input. If you want to get the status/info of 
an existing resource you will have to develop your own 
win_domain_computer_info module or just use 'win_shell: Get-ADComputer' as 
you've already pointed out only requires the identity.

-- 
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/f59e5a0a-825b-4416-b0f7-9804a7b5e9f0%40googlegroups.com.


Re: [ansible-project] Comparing two files registering the difference

2020-05-21 Thread Sivakumar Saravanamuthu
I resolved it

 tasks:
  - name: copy hosts for validation file
copy:
  src: ./templates/hosts
  dest: /tmp/hosts
  owner: root
  group: root
  mode: '0644'
  backup: yes

  - name: compare md5 local copy host file
stat:
  path: /tmp/hosts
  checksum_algorithm: md5
  get_checksum: yes
register: originalfile

  - name: compare md5 remote hosts file
stat:
  path: /etc/hosts
  checksum_algorithm: md5
  get_checksum: yes
register: remotefile

  - name: Verify host files md5 value
debug:
  msg:
"File Compare hash value of {{ remotefile.stat.checksum }} is same as
{{ originalfile.stat.checksum }}."
failed_when: remotefile.stat.checksum != originalfile.stat.checksum
Thank you.
Regards,
Siva


On Thu, 21 May 2020 at 18:32, Stefan Hornburg (Racke) 
wrote:

> On 5/21/20 9:01 AM, Sivakumar Saravanamuthu wrote:
> > hi
> >
> > I have requirement to compare local file with remote file. Example I
> have a copy of standard /etc/hosts  file and I need
> > to compare that file with remote host /etc/hosts file to check the
> difference. If there is difference it should register
> > it and proceed with next task. I tried various option like diff and stat
> but unable to get expected result.
> >
> > Is there any way I can execute that.
>
> With the stat module you should be able to establish whether the files
> have different checksums. What did you try
> exactly?
>
> Regards
> Racke
>
> >
> > Regards,
> > Siva
> >
> > --
> > 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/469d7a64-a6be-427f-9de9-539ce5ee09f1%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/ansible-project/469d7a64-a6be-427f-9de9-539ce5ee09f1%40googlegroups.com?utm_medium=email_source=footer
> >.
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/dc439995-263e-3795-6cf9-1682dfc85be6%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/CANnu9FH2ut01EYdhPmhXRLzh-kk%3D8QpiKkRTc168mSH3McKwdA%40mail.gmail.com.


[ansible-project] Re: WINRM CONNECTION ERROR: function takes at most 2 arguments (3 given)

2020-05-21 Thread Kiran Kumar
I used a fresh box & finally did below & wored

yum install -y  python3-devel
pip install pykerberos

Thanks @Jordan 



On Thursday, May 21, 2020 at 5:37:40 PM UTC-7, Jordan Borean wrote:
>
> The issue here is the kerberos library you have installed is either too 
> old or incompatible with what requests-kerberos requires. Uninstall both 
> kerberos and pykerberos and install just pykerberos. You may want to update 
> requests-kerberos as well as 0.7.0 is quite old.
>

-- 
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/24efbffb-08c7-4c69-bbc4-6e55e84af57d%40googlegroups.com.


Re: [ansible-project] win_domain_computer module

2020-05-21 Thread Ramakrishnan M
I tried that too, if I put State present, it’s asking for ou parameter is 
required. I want to retrieve it’s OU location. It just keep on asking one by 
one parameters as required. The documentation page for this module only says 
name is mandatory parameter, rest is optional.

Get-ADConputer will just work with identity as only parameter required.

Rama

Sent from my iPhone

> On May 21, 2020, at 19:40, Jordan Borean  wrote:
> 
> 
> According to the docs, dns_hostname is
> 
>> Required when state=present.
> 
> So you need to have this set for the module to work.
> 
> Thanks
> 
> Jordan
> 
> 
> -- 
> 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/f363da27-26f8-41c7-8675-d45fa82bfcdf%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/48E865AE-4321-4CB1-B000-9DEE9ECD72BA%40gmail.com.


[ansible-project] Process Monitoring in Ansible

2020-05-21 Thread Jenisha T
Is there a way in Ansible to find if process complete. I m running an 
os-copy process. How to check if the process completed. The hard way is to 
wait  for 2hrs and read logs to find the word in the log is there a 
sentence 
"OS copy success". Is there any elegant way to do it in ansible check if 
the process completes go to the next task instead of waiting for 2 hrs and 
then checking logs. 

-- 
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/be671f78-0692-460c-bb49-deb36da8b311%40googlegroups.com.


[ansible-project] Re: WINRM CONNECTION ERROR: function takes at most 2 arguments (3 given)

2020-05-21 Thread Kiran Kumar
Anyways i did below 

 1017  21/05/20 17:47:19 yum remove python-kerberos-1.1-15.el7.x86_64
 1018  21/05/20 17:49:29 rpm -qa|grep -i kerb
 1019  21/05/20 17:49:43 pip install pykerberos
 1020  21/05/20 17:49:55 pip install requests-kerberos
 1021  21/05/20 17:50:05 ansible windows -m win_ping -vv
 1022  21/05/20 17:50:30 yum install -y python-kerberos
 1023  21/05/20 17:50:38 ansible windows -m win_ping -vv


Still no luck 

On Thursday, May 21, 2020 at 5:37:40 PM UTC-7, Jordan Borean wrote:
>
> The issue here is the kerberos library you have installed is either too 
> old or incompatible with what requests-kerberos requires. Uninstall both 
> kerberos and pykerberos and install just pykerberos. You may want to update 
> requests-kerberos as well as 0.7.0 is quite old.
>

-- 
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/c17f0ce7-e187-41d4-9437-a5db3afe56bf%40googlegroups.com.


[ansible-project] Re: WINRM CONNECTION ERROR: function takes at most 2 arguments (3 given)

2020-05-21 Thread Kiran Kumar
Shall i do below 

yum remove python-kerberos-1.1-15.el7.x86_64


=
 Package Arch  
Version
  Repository  Size
=
Removing:
 python-kerberos x86_64
1.1-15.el7  
 @base   53 k
Removing for dependencies:
 kojinoarch
1.15.1-1.el7.centos
  @extras410 k
 python-requests-kerberosnoarch
0.7.0-2.el7
  @extras 34 k
 python2-kojinoarch
1.15.1-1.el7.centos
  @extras1.4 M
 python2-koji-cli-pluginsnoarch
1.15.1-1.el7.centos
  @extras 17 k


BTW 

pip install requests-kerberos
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. 
Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 
will drop support for Python 2.7 in January 2021. More details about Python 
2 support in pip, can be found at 
https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Requirement already satisfied: requests-kerberos in 
/usr/lib/python2.7/site-packages (0.7.0)
Requirement already satisfied: requests>=1.1.0 in 
/usr/lib/python2.7/site-packages (from requests-kerberos) (2.23.0)
Requirement already satisfied: kerberos in 
/usr/lib64/python2.7/site-packages (from requests-kerberos) (1.1)
Requirement already satisfied: certifi>=2017.4.17 in 
/usr/lib/python2.7/site-packages (from requests>=1.1.0->requests-kerberos) 
(2020.4.5.1)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in 
/usr/lib/python2.7/site-packages (from requests>=1.1.0->requests-kerberos) 
(1.25.9)
Requirement already satisfied: idna<3,>=2.5 in 
/usr/lib/python2.7/site-packages (from requests>=1.1.0->requests-kerberos) 
(2.9)
Requirement already satisfied: chardet<4,>=3.0.2 in 
/usr/lib/python2.7/site-packages (from requests>=1.1.0->requests-kerberos) 
(3.0.4)

Please suggest 

On Thursday, May 21, 2020 at 5:37:40 PM UTC-7, Jordan Borean wrote:
>
> The issue here is the kerberos library you have installed is either too 
> old or incompatible with what requests-kerberos requires. Uninstall both 
> kerberos and pykerberos and install just pykerberos. You may want to update 
> requests-kerberos as well as 0.7.0 is quite old.
>

-- 
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/5ad58620-9122-48cd-a7d8-c598169e6d65%40googlegroups.com.


[ansible-project] Re: WINRM CONNECTION ERROR: function takes at most 2 arguments (3 given)

2020-05-21 Thread Kiran Kumar
Thanks for the reply 

You mean : 

yum remove -y krb5-devel krb5-libs krb5-workstation 

And 

re-run 

*pip install pykerberos* 



On Thursday, May 21, 2020 at 5:37:40 PM UTC-7, Jordan Borean wrote:
>
> The issue here is the kerberos library you have installed is either too 
> old or incompatible with what requests-kerberos requires. Uninstall both 
> kerberos and pykerberos and install just pykerberos. You may want to update 
> requests-kerberos as well as 0.7.0 is quite old.
>

-- 
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/1575caa5-2722-4c7b-b215-142c50fb5234%40googlegroups.com.


Re: [ansible-project] win_domain_computer module

2020-05-21 Thread Jordan Borean
According to the docs, dns_hostname is

Required when *state=present*.
>

So you need to have this set for the module to work.

Thanks

Jordan


-- 
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/f363da27-26f8-41c7-8675-d45fa82bfcdf%40googlegroups.com.


[ansible-project] Re: WINRM CONNECTION ERROR: function takes at most 2 arguments (3 given)

2020-05-21 Thread Jordan Borean
The issue here is the kerberos library you have installed is either too old 
or incompatible with what requests-kerberos requires. Uninstall both 
kerberos and pykerberos and install just pykerberos. You may want to update 
requests-kerberos as well as 0.7.0 is quite old.

-- 
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/904f0877-7350-4675-8bec-d5077b056ecd%40googlegroups.com.


[ansible-project] WINRM CONNECTION ERROR: function takes at most 2 arguments (3 given)

2020-05-21 Thread Kiran Kumar
Hi,



Goal : Use Linux centos 7.8 server with ansible version 2.9.7 to manage 
windows 2019 server

Error :  WINRM CONNECTION ERROR: function takes at most 2 
arguments (3 given)
###

Ansible Version :
ansible 2.9.7
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', 
u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.5 (default, Apr  2 2020, 13:16:51) [GCC 4.8.5 
20150623 (Red Hat 4.8.5-39)]

###

Linux OS
CentOS 7.8
###

No linux Firewall

No network Firewall between Linux & Windows

###
 pip install "pywinrm>=0.3.0"
 ###



cat /etc/krb5.conf

# Configuration snippets may be placed in this directory as well
includedir /etc/krb5.conf.d/

includedir /var/lib/sss/pubconf/krb5.include.d/
[logging]
 default = FILE:/var/log/krb5libs.log
 kdc = FILE:/var/log/krb5kdc.log
 admin_server = FILE:/var/log/kadmind.log

[libdefaults]
# dns_lookup_realm = false
 ticket_lifetime = 2400h
 renew_lifetime = 777d
 forwardable = true
 rdns = false
 pkinit_anchors = /etc/pki/tls/certs/ca-bundle.crt
# default_realm = EXAMPLE.COM
 default_ccache_name = KEYRING:persistent:%{uid}

default_realm = TEST.COM

[realms]
TEST.COM = {
  kdc = x2.TEST.COM
  kdc = x1.TEST.COM
}

[domain_realm]
.TEST.COM = TEST.COM
TEST.COM = TEST.COM


###

kinit -C us...@test.com

###

ansible windows -m win_ping -vv
Shows :

Using module file 
/usr/lib/python2.7/site-packages/ansible/modules/windows/win_ping.ps1
Pipelining is enabled.
 ESTABLISH WINRM CONNECTION FOR USER: us...@test.com on PORT 5986 
TO ServerX
 WINRM CONNECT: transport=kerberos 
endpoint=https://ServerX:5986/wsman
 WINRM CONNECTION ERROR: function takes at most 2 arguments (3 
given)


###

Ansible host file

[windows]
ServerX
[windows:vars]
ansible_user=us...@test.com
ansible_passwordi='xx'
ansible_port=5986
ansible_connection=winrm
ansible_winrm_scheme=https
ansible_winrm_server_cert_validation=ignore
ansible_winrm_transport=kerberos

###



Windows OS side :

Ran

https://github.com/jborean93/ansible-windows/blob/master/scripts/Upgrade-PowerShell.ps1
###


###
winrm  works well ...

Invoke-Command -ComputerName ServerX   -ScriptBlock { Get-ChildItem C:\ }

###

So doc - 
https://argonsys.com/microsoft-cloud/articles/configuring-ansible-manage-windows-servers-step-step/
 
was followed in short

I also went through some google links & did below

Windows Firewall : checked firewall port - was allowed - 5986 is secure 
https winrm traffic
nc -zv ServerX  5986  - was ok

winrm configSDDL default - added the user

###

Is it possible the account password has simply expired? No - Yeah but 
checked the user account's properties... box is checked 'Password never 
expires'
###

tried below no luck :
In my case, a just add this line on [libdefaults] in my krb5.conf:

allow_weak_crypto = true
###

pip list | grep -i kerberos
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. 
Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 
will drop support for Python 2.7 in January 2021. More details about Python 
2 support in pip, can be found at 
https://pip.pypa.io/en/latest/development/release-process/#python-2-support
kerberos1.1
pykerberos  1.2.1
requests-kerberos   0.7.0

###

python --version
Python 2.7.5

###

just to be sure, please check you have a kerberos ticket which has not 
expired before running  - its is not

ie tried all things in github.com/ansible/ansible/issues/16478
###
PS C:\WINDOWS\system32> winrm quickconfig
WinRM service is already running on this machine.
WinRM is already set up for remote management on this computer.
PS C:\WINDOWS\system32>
PS C:\WINDOWS\system32>
###


PS C:\WINDOWS\system32> winrm get winrm/config/service
Service
RootSDDL = 
O:NSG:BAD:P(A;;GXGR;;;...)(A;;GA;;;BA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
MaxConcurrentOperations = 4294967295
MaxConcurrentOperationsPerUser = 1500
EnumerationTimeoutms = 24
MaxConnections = 300
MaxPacketRetrievalTimeSeconds = 120
AllowUnencrypted = false
Auth
Basic 

Re: [ansible-project] How to check process running time

2020-05-21 Thread T. JENISHA
It worked . Thankyou
Best Regards
Jenisha T






On Wed, 20 May 2020 at 13:56, Vladimir Botka  wrote:

> On Wed, 20 May 2020 00:29:19 -0700 (PDT)
> Jenisha T  wrote:
>
> > I need to kill a process if its older than 1 hour.  I have process id
> how
> > to check if its older than 1 hour
>
> There is no such Ansible module. It'll be necessary to use 'command'. For
> example, in Linux or *BSD, get elapsed time of the process in seconds
>
> - command: 'ps -o etimes -p {{ my_pid }}'
>   register: result
> - debug:
> var: result.stdout_lines
>
> and kill the process if it's older than 1 hour
>
> - command: 'kill {{ my_pid }}'
>   when: result.stdout_lines.1|int > 3600
>
> HTH,
>
> -vlado
>

-- 
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/CAAGhZYj2RhnuSoGpqEVizkKbHsBWkPCfP%2BxoJ0ZrYbFGJTnSeg%40mail.gmail.com.


Re: [ansible-project] expected , but found '-'

2020-05-21 Thread thomas okonkwo
I ran into this error earlier today and i found the easiest way to fix 
problems like these and other indentation problem in yaml config file. 
check out www.yamllint.com
**How it works**Open the URL and copy your yaml configuration file into the 
blank page and paste (of course, you can tweak your sensitive information 
so you don't leak them). What this does is, fix the indentations issues and 
point out the exact location and by how much space you need to adjust.
To read more indepth documentations about Yaml Lint, click 
https://yamllint.readthedocs.io/en/stable


On Thursday, September 21, 2017 at 9:44:13 PM UTC+1, Matt Martz wrote:
>
> I didn't go look at the authors page.  Based on what you provided, the 
> first play is missing `tasks:`
>
> On Thu, Sep 21, 2017 at 3:41 PM, Bob Tanner  > wrote:
>
>>
>>
>> On Thursday, September 21, 2017 at 3:11:41 PM UTC-5, Matt Martz wrote:
>>>
>>> You seem to be missing `tasks:` in your first play.  As such YAML wasn't 
>>> expecting you to start a list there.
>>>
>>>
>> So the original authors Listing 11 is wrong?
>>
>>  
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ansible...@googlegroups.com .
>> To post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/d40736c8-b394-4ab4-8d10-b48e53e1ea6b%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/77769b33-0767-4921-9e11-41ada5c550a5%40googlegroups.com.


Re: [ansible-project] win_domain_computer module

2020-05-21 Thread Ramakrishnan M
All I need is to get properties of a domain computer- Get-ADComputer. Ansible 
equivalent win_domain_computer.

Sent from my iPhone

> On May 21, 2020, at 17:09, David Foley  wrote:
> 
> If your looking at doing work on Active Directory; you may need to switch 
> over to "win_domain_membership"
> 
> -- 
> 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/4264a2b3-c0ef-4c3d-96c3-ea621ee0bb3a%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/5054054A-B0E8-49C9-901D-69F605AD836B%40gmail.com.


[ansible-project] win_domain_computer module

2020-05-21 Thread David Foley
If your looking at doing work on Active Directory; you may need to switch over 
to "win_domain_membership"

-- 
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/4264a2b3-c0ef-4c3d-96c3-ea621ee0bb3a%40googlegroups.com.


[ansible-project] win_domain_computer module

2020-05-21 Thread Ramakrishnan M
Hi Guys,

Why would I get missing parameter error when I use win_domain_computer
module when the parameter is set as optional.

  win_domain_computer:
  name: '{{ hostname }}'
  register: computer_account

Errors as...

FAILED! => {
"changed": false,
"msg": "Get-AnsibleParam: Missing required argument: dns_hostname"
}

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BNR4K%2BRFcPuxsq9fohtttiwKcdpoDt7iwN3%3DVJk%2B61T2%2Buxhg%40mail.gmail.com.


[ansible-project] Re: Handling password prompt -- IOS_command module

2020-05-21 Thread rajthecomputerguy
Any help would be appreciated.

On Thursday, May 21, 2020 at 1:36:15 PM UTC+5:30, rajthecomputerguy wrote:
>
> Hi Team,
>
> How to handle password prompt when doing scp file transfer.  Actually 
> server is generating banner message along with password prompt. Please help 
> how to resolve the issue.
>
> - name:  transfer the image
>   ios_command:
> commands:
>   - command: 'copy scp://{{ ansible_user }}@{{ ip_address }}/{{ 
> new_system_image }} flash:'
> prompt: 
> - 'Destination filename \[{{ new_system_image }}\]'
> - 'Password'
> answer: 
> - "\r"
> - "{{ password }}"
>
>
>

-- 
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/0bca812d-cc0d-4d5b-91ca-589c5192ff62%40googlegroups.com.


Re: [ansible-project] Re: problem passing var between tasks.

2020-05-21 Thread Jeremy Hobbs
Suneel,  I attempted your solution, but it didn't work with the way I was 
setting up the workflow.  Dick,  I tried the Dummy host and it worked 
perfectly.  Thank you for your responses.  


Jeremy


On Thursday, May 21, 2020 at 11:12:22 AM UTC-5, Dick Visser wrote:
>
> Not tried yet, but this describes a dummy host: 
> https://stackoverflow.com/a/47811099/12731515 
>
> On Thu, 21 May 2020 at 17:56, Jeremy Hobbs > 
> wrote: 
> > 
> > I simplified the playbook for the post.  But, this specific call is used 
> by many different playbooks.  So instead of having to update each playbook 
> if it changes, I want to abstract it out.  Writing to a file seems a pretty 
> crappy workaround.  Is there not a way to pass variables between the 
> playbooks directly? 
> > 
> > 
> > 
> > On Thursday, May 21, 2020 at 10:49:04 AM UTC-5, David Foley wrote: 
> >> 
> >> Why two Playbook ? 
> >> 
> >> But either way, Copy the Reg to a Local Json File 
> >> 
> >> Then in your Second Playbook Just read in the JSON File 
> >> 
> >>  name: Read Json File 
> >> shell: cat Info.json 
> >> register: json_file 
> >> 
> >> 
> >> (json_file.stdout | from_json).VALUE 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Ansible Project" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to ansible...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/51b1da39-f24c-454d-8f93-eb332c8c4b23%40googlegroups.com.
>  
>
>
>
>
> -- 
> Dick Visser 
> Trust & Identity Service Operations Manager 
> GÉANT 
>

-- 
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/3e0c6879-f1c2-409c-a037-8423b633a8ca%40googlegroups.com.


Re: [ansible-project] Comparing two files registering the difference

2020-05-21 Thread Brian Coca
If you want to 'see the diff' , just use copy in check and diff mode



-- 
--
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/CACVha7ew1XM2iRDyyc-C4hUTPzcSs26k-EvP1qtjVhUgKNZCfg%40mail.gmail.com.


Re: [ansible-project] Re: ERROR! 'retries' is not a valid attribute for a TaskInclude

2020-05-21 Thread Suneel Gali
 " ERROR! 'retries' is not a valid attribute for a TaskInclude"
Can we use "until" against include_tasks?

Its like we are inserting the same tasks multiple times in the  playbook
...

Can you use until condition with the actual task itself and check?

On Thu, May 21, 2020 at 6:22 PM Dick Visser  wrote:

> This sounds all very much like pushing a round peg into a square hole.
> I would focus on fine tuning some systemd unit files and their
> dependencies, instead of the carpet stopping/starting approach.
>
>
> On Thu, 21 May 2020 at 14:46, Shifa Shaikh  wrote:
>
>> @Stefan Our service involves a set of processes thus, the start script
>> invokes those several processes and hence the need to count the number of
>> processes using `wc -l` to determine if the service (not the process) is
>> running or not.
>>
>>
>> On Thursday, May 21, 2020 at 8:18:56 AM UTC+5:30, Shifa Shaikh wrote:
>>>
>>> My requirement is to run the script stop-all as many times (5 retries)
>>> until the output of ps -fu user1 |wc -l becomes less than 2.
>>>
>>> I wrote the below ansible playbook for the same:
>>>
>>> cat stop.yml
>>>
>>>   - hosts: dest_nodes
>>> tasks:
>>>   - name: Start service
>>> include_tasks: "{{ playbook-dir }}/inner.yml"
>>> retries: 5
>>> delay: 4
>>> until: stopprocesscount.stdout is version('2', '<')
>>>
>>> cat inner.yml
>>>
>>> - name: Start service
>>>   shell: ~/stop-all
>>>   register: stopprocess
>>>
>>>
>>> - name: Start service
>>>   shell: ps -fu user1 |wc -l
>>>   register: stopprocesscount
>>>
>>>
>>> However, I get the below error running the playbook.
>>>
>>> ERROR! 'retries' is not a valid attribute for a TaskInclude
>>>
>>>
>>> The error appears to be in '/app/playbook/stop.yml': line 19, column 9,
>>> but may
>>> be elsewhere in the file depending on the exact syntax problem.
>>>
>>>
>>> The offending line appears to be:
>>>
>>>
>>> - name: Start service
>>>   ^ here
>>>
>>> Can you 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/4a53d56d-3e8a-4929-9cbd-b4b3d67b8237%40googlegroups.com
>> 
>> .
>>
> --
> Sent from a mobile device - please excuse the brevity, spelling and
> punctuation.
>
> --
> 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/CAL8fbwPz1t-6KsQa%2BN9VEU937a17pk3i9AZTP%2BhONu9om_aZQQ%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/CAKH5KHLp8%3DqUkqkQU%2BfS00B8cjvRgmkqxC4dyeQKPodzgbmgEQ%40mail.gmail.com.


Re: [ansible-project] Re: problem passing var between tasks.

2020-05-21 Thread Dick Visser
Not tried yet, but this describes a dummy host:
https://stackoverflow.com/a/47811099/12731515

On Thu, 21 May 2020 at 17:56, Jeremy Hobbs  wrote:
>
> I simplified the playbook for the post.  But, this specific call is used by 
> many different playbooks.  So instead of having to update each playbook if it 
> changes, I want to abstract it out.  Writing to a file seems a pretty crappy 
> workaround.  Is there not a way to pass variables between the playbooks 
> directly?
>
>
>
> On Thursday, May 21, 2020 at 10:49:04 AM UTC-5, David Foley wrote:
>>
>> Why two Playbook ?
>>
>> But either way, Copy the Reg to a Local Json File
>>
>> Then in your Second Playbook Just read in the JSON File
>>
>>  name: Read Json File
>> shell: cat Info.json
>> register: json_file
>>
>>
>> (json_file.stdout | from_json).VALUE
>
> --
> 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/51b1da39-f24c-454d-8f93-eb332c8c4b23%40googlegroups.com.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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/CAL8fbwNmUvq6YrnGE4%2B%3DxvsV%2Bi8FW6Z1MnVVQ0pZUHV7NRtJow%40mail.gmail.com.


Re: [ansible-project] Re: problem passing var between tasks.

2020-05-21 Thread Suneel Gali
can you try to pass the variable to include_tasks?

*Reference*:
https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_2.7.html#include-tasks-import-tasks-inline-variables

-Suneel

On Thu, May 21, 2020 at 9:26 PM Jeremy Hobbs  wrote:

> I simplified the playbook for the post.  But, this specific call is used
> by many different playbooks.  So instead of having to update each playbook
> if it changes, I want to abstract it out.  Writing to a file seems a pretty
> crappy workaround.  Is there not a way to pass variables between the
> playbooks directly?
>
>
>
> On Thursday, May 21, 2020 at 10:49:04 AM UTC-5, David Foley wrote:
>>
>> Why two Playbook ?
>>
>> But either way, Copy the Reg to a Local Json File
>>
>> Then in your Second Playbook Just read in the JSON File
>>
>>  name: Read Json File
>> shell: cat Info.json
>> register: json_file
>>
>>
>> (json_file.stdout | from_json).VALUE
>>
> --
> 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/51b1da39-f24c-454d-8f93-eb332c8c4b23%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/CAKH5KHLqU8ZiX%3DqpJcaQJOkH%3DAayTpUj%2Brrd8Rr9Nf%2BW2Ka3YQ%40mail.gmail.com.


[ansible-project] Re: problem passing var between tasks.

2020-05-21 Thread David Foley
Another way I know is to send the reg to the stdout and cat that stdout 
into the other playbook.
similar to outputting to the File, but if the API Value is big you may be 
better off with the Text File.


 register: test
   - debug: msg="{{test.stdout}}"

 


  tasks:
   - shell: cat "{{test.stdout}}"

-- 
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/bef73289-d9ca-43be-bfba-9dcd0514ab08%40googlegroups.com.


[ansible-project] Re: problem passing var between tasks.

2020-05-21 Thread Jeremy Hobbs
I simplified the playbook for the post.  But, this specific call is used by 
many different playbooks.  So instead of having to update each playbook if 
it changes, I want to abstract it out.  Writing to a file seems a pretty 
crappy workaround.  Is there not a way to pass variables between the 
playbooks directly?



On Thursday, May 21, 2020 at 10:49:04 AM UTC-5, David Foley wrote:
>
> Why two Playbook ? 
>
> But either way, Copy the Reg to a Local Json File
>
> Then in your Second Playbook Just read in the JSON File 
>
>  name: Read Json File
> shell: cat Info.json
> register: json_file
>
>
> (json_file.stdout | from_json).VALUE
>

-- 
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/51b1da39-f24c-454d-8f93-eb332c8c4b23%40googlegroups.com.


[ansible-project] Re: problem passing var between tasks.

2020-05-21 Thread David Foley
Why two Playbook ? 

But either way, Copy the Reg to a Local Json File

Then in your Second Playbook Just read in the JSON File 

 name: Read Json File
shell: cat Info.json
register: json_file


(json_file.stdout | from_json).VALUE

-- 
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/d5ceca07-32d7-4a76-8079-984ee24d26b9%40googlegroups.com.


[ansible-project] problem passing var between tasks.

2020-05-21 Thread Jeremy Hobbs
I have a problem passing a variable between playbooks that are chained 
together. Any thoughts?

Playbook - audit_hardware_inventory.yml
---
- name: "Compare API to actual"
hosts: "all"
gather_facts: "no"
connection: "local"

tasks:
- name: "INCLUDE TASK: GET JSON WEB TOKEN FROM API"
include_tasks: "generate_api_data.yml"

- name: "INCLUDE TASK: HARDWARE CHECK"
include_tasks: "hardware_check_tasks.yml"

Playbook - generate_api_data.yml
---
- name: "Get JSON DATA"
uri:
url: "http://localhost.com/v1/id/x;
method: "POST"
return_content: "yes"
validate_certs: "no"
body_format: "json"
delegate_to: "localhost"
register: "api_data"



The first task pulls the data from the api and registers it as "api_data" 
however when the second playbook ("hardware_check_tasks.yml") I'm not able 
to call that variable. How do I pass "api_data" between tasks? 

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4cfab90c-2c36-4a5b-aa7d-75de0681f9e8%40googlegroups.com.


Re: [ansible-project] how to run specific task locally on ansible ?

2020-05-21 Thread gali.suneel
You can use:local_action or delegate_to: localhost  at task level.-SuneelSent 
from my Samsung Galaxy smartphone.
 Original message From: Vivek Kothawale  
Date: 21/05/2020  20:35  (GMT+05:30) To: ansible-project@googlegroups.com 
Subject: Re: [ansible-project] how to run specific task locally on ansible ? 
HiUse tags to achieve this.Thanks,VivekOn Thu, May 21, 2020, 8:30 PM vinod 
devops  wrote:there are no of tasks in play book, 
  all tasks are running remotely on  host. I want to run only one task 
locally.How do I do that ? Thanks



-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c19122b7-5f83-48b0-b51d-eba574d62d7a%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/CAA420E_2mgz%3Db-AF9LZQfpXuK6NECNJ3UE%3DALiTTW7GyuPh_9w%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/5ec69ff5.1c69fb81.a942e.30c9%40mx.google.com.


Re: [ansible-project] how to run specific task locally on ansible ?

2020-05-21 Thread Stefan Hornburg (Racke)
On 5/21/20 5:00 PM, vinod devops wrote:
> there are no of tasks in play book, 
>   
> all tasks are running remotely on  host. I want to run only one task locally.
> 
> 
> How do I do that ? Thanks
> 

- name: ...
  
  delegate_to: localhost

You may also add the following:

  run_once: true

Regards
  Racke

> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to
> ansible-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/c19122b7-5f83-48b0-b51d-eba574d62d7a%40googlegroups.com
> .


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

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e6adafe1-6bf1-c784-2204-a4f0bb9c7053%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


Re: [ansible-project] how to run specific task locally on ansible ?

2020-05-21 Thread Vivek Kothawale
Hi

Use tags to achieve this.

Thanks,
Vivek

On Thu, May 21, 2020, 8:30 PM vinod devops 
wrote:

> there are no of tasks in play book,
>
> all tasks are running remotely on  host. I want to run only one task
> locally.
>
>
> How do I do that ? Thanks
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/c19122b7-5f83-48b0-b51d-eba574d62d7a%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/CAA420E_2mgz%3Db-AF9LZQfpXuK6NECNJ3UE%3DALiTTW7GyuPh_9w%40mail.gmail.com.


[ansible-project] how to run specific task locally on ansible ?

2020-05-21 Thread vinod devops
there are no of tasks in play book, 
  
all tasks are running remotely on  host. I want to run only one task 
locally.


How do I do that ? Thanks


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c19122b7-5f83-48b0-b51d-eba574d62d7a%40googlegroups.com.


[ansible-project] Re: Passing data from ansible to service now table

2020-05-21 Thread David Foley
Is the Body Correct ? and that you aren't missing any JSON values? 

-- 
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/9191ee55-8d85-432e-937e-93d8bf7a995f%40googlegroups.com.


Re: [ansible-project] Re: ERROR! 'retries' is not a valid attribute for a TaskInclude

2020-05-21 Thread Dick Visser
This sounds all very much like pushing a round peg into a square hole.
I would focus on fine tuning some systemd unit files and their
dependencies, instead of the carpet stopping/starting approach.


On Thu, 21 May 2020 at 14:46, Shifa Shaikh  wrote:

> @Stefan Our service involves a set of processes thus, the start script
> invokes those several processes and hence the need to count the number of
> processes using `wc -l` to determine if the service (not the process) is
> running or not.
>
>
> On Thursday, May 21, 2020 at 8:18:56 AM UTC+5:30, Shifa Shaikh wrote:
>>
>> My requirement is to run the script stop-all as many times (5 retries)
>> until the output of ps -fu user1 |wc -l becomes less than 2.
>>
>> I wrote the below ansible playbook for the same:
>>
>> cat stop.yml
>>
>>   - hosts: dest_nodes
>> tasks:
>>   - name: Start service
>> include_tasks: "{{ playbook-dir }}/inner.yml"
>> retries: 5
>> delay: 4
>> until: stopprocesscount.stdout is version('2', '<')
>>
>> cat inner.yml
>>
>> - name: Start service
>>   shell: ~/stop-all
>>   register: stopprocess
>>
>>
>> - name: Start service
>>   shell: ps -fu user1 |wc -l
>>   register: stopprocesscount
>>
>>
>> However, I get the below error running the playbook.
>>
>> ERROR! 'retries' is not a valid attribute for a TaskInclude
>>
>>
>> The error appears to be in '/app/playbook/stop.yml': line 19, column 9,
>> but may
>> be elsewhere in the file depending on the exact syntax problem.
>>
>>
>> The offending line appears to be:
>>
>>
>> - name: Start service
>>   ^ here
>>
>> Can you 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/4a53d56d-3e8a-4929-9cbd-b4b3d67b8237%40googlegroups.com
> 
> .
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
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/CAL8fbwPz1t-6KsQa%2BN9VEU937a17pk3i9AZTP%2BhONu9om_aZQQ%40mail.gmail.com.


[ansible-project] Re: ERROR! 'retries' is not a valid attribute for a TaskInclude

2020-05-21 Thread Shifa Shaikh
@Stefan Our service involves a set of processes thus, the start script 
invokes those several processes and hence the need to count the number of 
processes using `wc -l` to determine if the service (not the process) is 
running or not. 

On Thursday, May 21, 2020 at 8:18:56 AM UTC+5:30, Shifa Shaikh wrote:
>
> My requirement is to run the script stop-all as many times (5 retries) 
> until the output of ps -fu user1 |wc -l becomes less than 2.
>
> I wrote the below ansible playbook for the same:
>
> cat stop.yml
>
>   - hosts: dest_nodes
> tasks:
>   - name: Start service
> include_tasks: "{{ playbook-dir }}/inner.yml"
> retries: 5
> delay: 4
> until: stopprocesscount.stdout is version('2', '<')
>
> cat inner.yml
>
> - name: Start service
>   shell: ~/stop-all
>   register: stopprocess
>
>
> - name: Start service
>   shell: ps -fu user1 |wc -l
>   register: stopprocesscount
>
>
> However, I get the below error running the playbook.
>
> ERROR! 'retries' is not a valid attribute for a TaskInclude
>
>
> The error appears to be in '/app/playbook/stop.yml': line 19, column 9, 
> but may
> be elsewhere in the file depending on the exact syntax problem.
>
>
> The offending line appears to be:
>
>
> - name: Start service
>   ^ here
>
> Can you 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/4a53d56d-3e8a-4929-9cbd-b4b3d67b8237%40googlegroups.com.


[ansible-project] Re: Exit with_items loop after first success?

2020-05-21 Thread Harshavardhan Reddy A
Here you go...
https://www.reddit.com/r/ansible/comments/di4o6h/how_to_break_the_loop/



On Thursday, December 11, 2014 at 10:41:55 AM UTC-5, Hugh Saunders wrote:
>
> Hi All, 
> I've been asking on IRC,  twitter 
> , and github 
>  about this and was asked 
> to post to the ML as well so here goes :)
>
> I would like to be able to exit a with_items loop based on the result of 
> the previous iteration. Think of it as a generalisation of 
> with_first_found. 
>
> Two use cases: 
>
>1. I have a list of mirrors known to host file, I want to iterate over 
>that list until I successfully retrieve the file, then stop iterating. No 
>point in downloading the file multiple times.
>2. I have a git ref (branch/tag) and a list of mirrors of that repo (
>git.openstack.org, github.com), I want to resolve that ref to a SHA 
>without cloning the repo. Run git ls-remote via shell passing in each 
>remote url in turn until the ref is successfully resolved. No point in 
>resolving it twice. Note that for this use case I do not want to clone the 
>repo. 
>
> I'm sure there are other situations where it would be useful to break out 
> of a loop. 
>
> As explained in the issue, I can think of two ways of doing this, both 
> would require modifications to ansible: 
>
>1. Add previous_iteration variable for use in when clause, eg when: 
>previous_iteration | failed
>2. Allow registered variable to be used within a loop, eg when: 
>shell_result['results'][-1].rc != 0
>
>
> Thanks for any insight. 
>
> --
> Hugh Saunders
>

-- 
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/a15f0310-08e0-4805-a593-b90115b67a4b%40googlegroups.com.


Re: [ansible-project] Passing data from ansible to service now table

2020-05-21 Thread Diyawary
Thanks Racke for you help.

On Thursday, 21 May 2020 05:33:22 UTC-5, Stefan Hornburg (Racke) wrote:
>
> On 5/21/20 12:20 PM, Diyawary wrote: 
> > thanks Rack one more thing I have observed sometimes i am getting  belwo 
> connection failure and some time  Read 
> > operation timeout error. 
> > Status code was -1 and not [200]: Connection failure: connection was 
> closed before a valid response was received: ''" 
> > 
> > could you please suggest what the possible reason of this two errors.? 
> and in my ansible  script has no issue. 
>
> For the third and last time: most likely reason is the *API itself*. 
>
> Regards 
>  Racke 
>
> > 
> > On Thursday, 21 May 2020 04:44:49 UTC-5, Stefan Hornburg (Racke) wrote: 
> > 
> > On 5/21/20 11:41 AM, Diyawary wrote: 
> > > Hi Rack, 
> > > 
> > > As you suggested I have increased the timeout to 20 min but still 
> getting the same error and task stops before the 
> > > timeout value. 
> > > 
> > 
> > So it is most likely that the API causes your problems. Please 
> investigate at that end. 
> > 
> > Regards 
> >  Racke 
> > 
> > > 
> > > On Wednesday, 20 May 2020 10:08:16 UTC-5, Stefan Hornburg (Racke) 
> wrote: 
> > > 
> > > On 5/20/20 3:52 PM, Diyawary wrote: 
> > > > Please find the complete tasks out put- 
> > > > { 
> > > > "status": -1, 
> > > > "_ansible_no_log": false, 
> > > > "url": "
> https://test.service-now.com/api/eplc/table_update_integration/create 
> > <
> https://test.service-now.com/api/eplc/table_update_integration/create> 
> > > <
> https://test.service-now.com/api/eplc/table_update_integration/create 
> > <
> https://test.service-now.com/api/eplc/table_update_integration/create>>", 
> > > > "changed": false, 
> > > > "elapsed": 10, 
> > > > "content": "", 
> > > > "invocation": { 
> > > > "module_args": { 
> > > > "directory_mode": null, 
> > > > "force": false, 
> > > > "remote_src": null, 
> > > > "status_code": [ 
> > > > "200" 
> > > > ], 
> > > > "follow": false, 
> > > > "owner": null, 
> > > > "body_format": "json", 
> > > > "client_key": null, 
> > > > "group": null, 
> > > > "use_proxy": true, 
> > > > "unix_socket": null, 
> > > > "unsafe_writes": null, 
> > > > "serole": null, 
> > > > "content": null, 
> > > > "setype": null, 
> > > > "follow_redirects": "safe", 
> > > > "return_content": false, 
> > > > "method": "POST", 
> > > > "body": { 
> > > > "Region": "NA - Prod", 
> > > > "List": [ 
> > > >data 
> > > > }, 
> > > > "url_username": "", 
> > > > "src": null, 
> > > > "dest": null, 
> > > > "selevel": null, 
> > > > "force_basic_auth": true, 
> > > > "removes": null, 
> > > > "http_agent": "ansible-httpget", 
> > > > "user": "", 
> > > > "regexp": null, 
> > > > "password": "***", 
> > > > "url_password": "***", 
> > > > "url": "
> https://test.service-now.com/api/eplc/table_update_integration/create 
> > <
> https://test.service-now.com/api/eplc/table_update_integration/create> 
> > > <
> https://test.service-now.com/api/eplc/table_update_integration/create 
> > <
> https://test.service-now.com/api/eplc/table_update_integration/create>>", 
> > > > "backup": null, 
> > > > "seuser": null, 
> > > > "client_cert": null, 
> > > > "creates": null, 
> > > > "headers": { 
> > > > "Content-Type": "application/json" 
> > > > }, 
> > > > "delimiter": null, 
> > > > "mode": null, 
> > > > "timeout": 100, 
> > > > "attributes": null, 
> > > > "validate_certs": true 
> > > > } 
> > > > }, 
> > > > "redirected": false, 
> > > > "msg": "Status code was -1 and not [200]: 'The read 
> operation timed out'" 
> > > > } 
> > > > 
> > > 
> > > I would increase the timeout to a ridiculous value like 20 
> minutes and test if it: 
> > > 
> > > * 

Re: [ansible-project] Passing data from ansible to service now table

2020-05-21 Thread Stefan Hornburg (Racke)
On 5/21/20 12:20 PM, Diyawary wrote:
> thanks Rack one more thing I have observed sometimes i am getting  belwo 
> connection failure and some time  Read
> operation timeout error.
> Status code was -1 and not [200]: Connection failure: connection was closed 
> before a valid response was received: ''"
> 
> could you please suggest what the possible reason of this two errors.? and in 
> my ansible  script has no issue.

For the third and last time: most likely reason is the *API itself*.

Regards
 Racke

> 
> On Thursday, 21 May 2020 04:44:49 UTC-5, Stefan Hornburg (Racke) wrote:
> 
> On 5/21/20 11:41 AM, Diyawary wrote:
> > Hi Rack,
> >
> > As you suggested I have increased the timeout to 20 min but still 
> getting the same error and task stops before the
> > timeout value.
> >
> 
> So it is most likely that the API causes your problems. Please 
> investigate at that end.
> 
> Regards
>          Racke
> 
> >
> > On Wednesday, 20 May 2020 10:08:16 UTC-5, Stefan Hornburg (Racke) wrote:
> >
> >     On 5/20/20 3:52 PM, Diyawary wrote:
> >     > Please find the complete tasks out put-
> >     > {
> >     >     "status": -1,
> >     >     "_ansible_no_log": false,
> >     >     "url": 
> "https://test.service-now.com/api/eplc/table_update_integration/create
> 
> >     
>  >",
> >     >     "changed": false,
> >     >     "elapsed": 10,
> >     >     "content": "",
> >     >     "invocation": {
> >     >         "module_args": {
> >     >             "directory_mode": null,
> >     >             "force": false,
> >     >             "remote_src": null,
> >     >             "status_code": [
> >     >                 "200"
> >     >             ],
> >     >             "follow": false,
> >     >             "owner": null,
> >     >             "body_format": "json",
> >     >             "client_key": null,
> >     >             "group": null,
> >     >             "use_proxy": true,
> >     >             "unix_socket": null,
> >     >             "unsafe_writes": null,
> >     >             "serole": null,
> >     >             "content": null,
> >     >             "setype": null,
> >     >             "follow_redirects": "safe",
> >     >             "return_content": false,
> >     >             "method": "POST",
> >     >             "body": {
> >     >                 "Region": "NA - Prod",
> >     >                 "List": [
> >     >                    data
> >     >             },
> >     >             "url_username": "",
> >     >             "src": null,
> >     >             "dest": null,
> >     >             "selevel": null,
> >     >             "force_basic_auth": true,
> >     >             "removes": null,
> >     >             "http_agent": "ansible-httpget",
> >     >             "user": "",
> >     >             "regexp": null,
> >     >             "password": "***",
> >     >             "url_password": "***",
> >     >             "url": 
> "https://test.service-now.com/api/eplc/table_update_integration/create
> 
> >     
>  >",
> >     >             "backup": null,
> >     >             "seuser": null,
> >     >             "client_cert": null,
> >     >             "creates": null,
> >     >             "headers": {
> >     >                 "Content-Type": "application/json"
> >     >             },
> >     >             "delimiter": null,
> >     >             "mode": null,
> >     >             "timeout": 100,
> >     >             "attributes": null,
> >     >             "validate_certs": true
> >     >         }
> >     >     },
> >     >     "redirected": false,
> >     >     "msg": "Status code was -1 and not [200]: 'The read operation 
> timed out'"
> >     > }
> >     >
> >
> >     I would increase the timeout to a ridiculous value like 20 minutes 
> and test if it:
> >
> >     * succeeds
> >     * stops before the timeout exceeded
> >     * stops after the timeout exceeded
> >
> >     Regards
> >              Racke
> >
> >     > On Wednesday, 20 May 2020 08:43:46 UTC-5, Diyawary wrote:
> >     >
> >     >     Hi Racke,
> >     >
> >     >     I have already increase the timeout but  still getting the 
> same error.
> >     >     "Status code was -1 

[ansible-project] Re: bad PATH when running "apt" module

2020-05-21 Thread Karol Szczeciński
Try using:

ssh user@host -t "sudo bash -l -c 'echo \$PATH'"


As per:
https://superuser.com/questions/306530/run-remote-ssh-command-with-full-login-shell

-- 
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/190be06b-3fe1-4d06-968c-212a1bcccd8a%40googlegroups.com.


Re: [ansible-project] Passing data from ansible to service now table

2020-05-21 Thread Diyawary
thanks Rack one more thing I have observed sometimes i am getting  belwo 
connection failure and some time  Read operation timeout error.
Status code was -1 and not [200]: Connection failure: connection was closed 
before a valid response was received: ''"

could you please suggest what the possible reason of this two errors.? and 
in my ansible  script has no issue.

On Thursday, 21 May 2020 04:44:49 UTC-5, Stefan Hornburg (Racke) wrote:
>
> On 5/21/20 11:41 AM, Diyawary wrote: 
> > Hi Rack, 
> > 
> > As you suggested I have increased the timeout to 20 min but still 
> getting the same error and task stops before the 
> > timeout value. 
> > 
>
> So it is most likely that the API causes your problems. Please investigate 
> at that end. 
>
> Regards 
>  Racke 
>
> > 
> > On Wednesday, 20 May 2020 10:08:16 UTC-5, Stefan Hornburg (Racke) wrote: 
> > 
> > On 5/20/20 3:52 PM, Diyawary wrote: 
> > > Please find the complete tasks out put- 
> > > { 
> > > "status": -1, 
> > > "_ansible_no_log": false, 
> > > "url": "
> https://test.service-now.com/api/eplc/table_update_integration/create 
> > <
> https://test.service-now.com/api/eplc/table_update_integration/create>", 
> > > "changed": false, 
> > > "elapsed": 10, 
> > > "content": "", 
> > > "invocation": { 
> > > "module_args": { 
> > > "directory_mode": null, 
> > > "force": false, 
> > > "remote_src": null, 
> > > "status_code": [ 
> > > "200" 
> > > ], 
> > > "follow": false, 
> > > "owner": null, 
> > > "body_format": "json", 
> > > "client_key": null, 
> > > "group": null, 
> > > "use_proxy": true, 
> > > "unix_socket": null, 
> > > "unsafe_writes": null, 
> > > "serole": null, 
> > > "content": null, 
> > > "setype": null, 
> > > "follow_redirects": "safe", 
> > > "return_content": false, 
> > > "method": "POST", 
> > > "body": { 
> > > "Region": "NA - Prod", 
> > > "List": [ 
> > >data 
> > > }, 
> > > "url_username": "", 
> > > "src": null, 
> > > "dest": null, 
> > > "selevel": null, 
> > > "force_basic_auth": true, 
> > > "removes": null, 
> > > "http_agent": "ansible-httpget", 
> > > "user": "", 
> > > "regexp": null, 
> > > "password": "***", 
> > > "url_password": "***", 
> > > "url": "
> https://test.service-now.com/api/eplc/table_update_integration/create 
> > <
> https://test.service-now.com/api/eplc/table_update_integration/create>", 
> > > "backup": null, 
> > > "seuser": null, 
> > > "client_cert": null, 
> > > "creates": null, 
> > > "headers": { 
> > > "Content-Type": "application/json" 
> > > }, 
> > > "delimiter": null, 
> > > "mode": null, 
> > > "timeout": 100, 
> > > "attributes": null, 
> > > "validate_certs": true 
> > > } 
> > > }, 
> > > "redirected": false, 
> > > "msg": "Status code was -1 and not [200]: 'The read operation 
> timed out'" 
> > > } 
> > > 
> > 
> > I would increase the timeout to a ridiculous value like 20 minutes 
> and test if it: 
> > 
> > * succeeds 
> > * stops before the timeout exceeded 
> > * stops after the timeout exceeded 
> > 
> > Regards 
> >  Racke 
> > 
> > > On Wednesday, 20 May 2020 08:43:46 UTC-5, Diyawary wrote: 
> > > 
> > > Hi Racke, 
> > > 
> > > I have already increase the timeout but  still getting the 
> same error. 
> > > "Status code was -1 and not [200]: 'The read operation timed 
> out'" 
> > > 
> > > On Wednesday, 20 May 2020 07:35:52 UTC-5, Stefan Hornburg 
> (Racke) wrote: 
> > > 
> > > On 5/20/20 9:57 AM, Diyawary wrote: 
> > > > Hi Team, 
> > > > 
> > > > I am sending data from ansible to service now using uri, 
> data is passing to snow table but job status is 
> > not 
> > > showing 
> > > > successful. 
> > > > I am getting "The read operation timed out" error 
> ,Please suggest me how this can be resolved 
> > > > - name: Passing Data to Snow 
> > > >   uri: 
> > > > url: "
> 

Re: [ansible-project] Passing data from ansible to service now table

2020-05-21 Thread Stefan Hornburg (Racke)
On 5/21/20 11:41 AM, Diyawary wrote:
> Hi Rack,
> 
> As you suggested I have increased the timeout to 20 min but still getting the 
> same error and task stops before the
> timeout value.
> 

So it is most likely that the API causes your problems. Please investigate at 
that end.

Regards
 Racke

> 
> On Wednesday, 20 May 2020 10:08:16 UTC-5, Stefan Hornburg (Racke) wrote:
> 
> On 5/20/20 3:52 PM, Diyawary wrote:
> > Please find the complete tasks out put-
> > {
> >     "status": -1,
> >     "_ansible_no_log": false,
> >     "url": 
> "https://test.service-now.com/api/eplc/table_update_integration/create
> ",
> >     "changed": false,
> >     "elapsed": 10,
> >     "content": "",
> >     "invocation": {
> >         "module_args": {
> >             "directory_mode": null,
> >             "force": false,
> >             "remote_src": null,
> >             "status_code": [
> >                 "200"
> >             ],
> >             "follow": false,
> >             "owner": null,
> >             "body_format": "json",
> >             "client_key": null,
> >             "group": null,
> >             "use_proxy": true,
> >             "unix_socket": null,
> >             "unsafe_writes": null,
> >             "serole": null,
> >             "content": null,
> >             "setype": null,
> >             "follow_redirects": "safe",
> >             "return_content": false,
> >             "method": "POST",
> >             "body": {
> >                 "Region": "NA - Prod",
> >                 "List": [
> >                    data
> >             },
> >             "url_username": "",
> >             "src": null,
> >             "dest": null,
> >             "selevel": null,
> >             "force_basic_auth": true,
> >             "removes": null,
> >             "http_agent": "ansible-httpget",
> >             "user": "",
> >             "regexp": null,
> >             "password": "***",
> >             "url_password": "***",
> >             "url": 
> "https://test.service-now.com/api/eplc/table_update_integration/create
> ",
> >             "backup": null,
> >             "seuser": null,
> >             "client_cert": null,
> >             "creates": null,
> >             "headers": {
> >                 "Content-Type": "application/json"
> >             },
> >             "delimiter": null,
> >             "mode": null,
> >             "timeout": 100,
> >             "attributes": null,
> >             "validate_certs": true
> >         }
> >     },
> >     "redirected": false,
> >     "msg": "Status code was -1 and not [200]: 'The read operation timed 
> out'"
> > }
> >
> 
> I would increase the timeout to a ridiculous value like 20 minutes and 
> test if it:
> 
> * succeeds
> * stops before the timeout exceeded
> * stops after the timeout exceeded
> 
> Regards
>          Racke
> 
> > On Wednesday, 20 May 2020 08:43:46 UTC-5, Diyawary wrote:
> >
> >     Hi Racke,
> >
> >     I have already increase the timeout but  still getting the same 
> error.
> >     "Status code was -1 and not [200]: 'The read operation timed out'"
> >
> >     On Wednesday, 20 May 2020 07:35:52 UTC-5, Stefan Hornburg (Racke) 
> wrote:
> >
> >         On 5/20/20 9:57 AM, Diyawary wrote:
> >         > Hi Team,
> >         >
> >         > I am sending data from ansible to service now using uri, data 
> is passing to snow table but job status is
> not
> >         showing
> >         > successful.
> >         > I am getting "The read operation timed out" error ,Please 
> suggest me how this can be resolved
> >         > - name: Passing Data to Snow
> >         >       uri:
> >         >         url: 
> "https://test.service-now.com/api/eplc/table_update_integration/create
> 
> >         
>  >"
> >         >         method: POST
> >         >         Headers: "application/json"
> >         >         body: '{"List":{{EPG_all}}, "Region":"NA " }'
> >         >         body_format: json
> >         >         user: "{{ snow_username }}"
> >         >         password: "{{ snow_password }}"
> >         >         force_basic_auth: yes
> >         >         status_code: 200
> >         >         timeout: 10
> >         >
> >
> >         It certainly doesn't 

Re: [ansible-project] Passing data from ansible to service now table

2020-05-21 Thread Diyawary
Hi Rack,

As you suggested I have increased the timeout to 20 min but still getting 
the same error and task stops before the timeout value.


On Wednesday, 20 May 2020 10:08:16 UTC-5, Stefan Hornburg (Racke) wrote:
>
> On 5/20/20 3:52 PM, Diyawary wrote: 
> > Please find the complete tasks out put- 
> > { 
> > "status": -1, 
> > "_ansible_no_log": false, 
> > "url": "
> https://test.service-now.com/api/eplc/table_update_integration/create;, 
> > "changed": false, 
> > "elapsed": 10, 
> > "content": "", 
> > "invocation": { 
> > "module_args": { 
> > "directory_mode": null, 
> > "force": false, 
> > "remote_src": null, 
> > "status_code": [ 
> > "200" 
> > ], 
> > "follow": false, 
> > "owner": null, 
> > "body_format": "json", 
> > "client_key": null, 
> > "group": null, 
> > "use_proxy": true, 
> > "unix_socket": null, 
> > "unsafe_writes": null, 
> > "serole": null, 
> > "content": null, 
> > "setype": null, 
> > "follow_redirects": "safe", 
> > "return_content": false, 
> > "method": "POST", 
> > "body": { 
> > "Region": "NA - Prod", 
> > "List": [ 
> >data 
> > }, 
> > "url_username": "", 
> > "src": null, 
> > "dest": null, 
> > "selevel": null, 
> > "force_basic_auth": true, 
> > "removes": null, 
> > "http_agent": "ansible-httpget", 
> > "user": "", 
> > "regexp": null, 
> > "password": "***", 
> > "url_password": "***", 
> > "url": "
> https://test.service-now.com/api/eplc/table_update_integration/create;, 
> > "backup": null, 
> > "seuser": null, 
> > "client_cert": null, 
> > "creates": null, 
> > "headers": { 
> > "Content-Type": "application/json" 
> > }, 
> > "delimiter": null, 
> > "mode": null, 
> > "timeout": 100, 
> > "attributes": null, 
> > "validate_certs": true 
> > } 
> > }, 
> > "redirected": false, 
> > "msg": "Status code was -1 and not [200]: 'The read operation timed 
> out'" 
> > } 
> > 
>
> I would increase the timeout to a ridiculous value like 20 minutes and 
> test if it: 
>
> * succeeds 
> * stops before the timeout exceeded 
> * stops after the timeout exceeded 
>
> Regards 
>  Racke 
>
> > On Wednesday, 20 May 2020 08:43:46 UTC-5, Diyawary wrote: 
> > 
> > Hi Racke, 
> > 
> > I have already increase the timeout but  still getting the same 
> error. 
> > "Status code was -1 and not [200]: 'The read operation timed out'" 
> > 
> > On Wednesday, 20 May 2020 07:35:52 UTC-5, Stefan Hornburg (Racke) 
> wrote: 
> > 
> > On 5/20/20 9:57 AM, Diyawary wrote: 
> > > Hi Team, 
> > > 
> > > I am sending data from ansible to service now using uri, data 
> is passing to snow table but job status is not 
> > showing 
> > > successful. 
> > > I am getting "The read operation timed out" error ,Please 
> suggest me how this can be resolved 
> > > - name: Passing Data to Snow 
> > >   uri: 
> > > url: "
> https://test.service-now.com/api/eplc/table_update_integration/create 
> > <
> https://test.service-now.com/api/eplc/table_update_integration/create>" 
> > > method: POST 
> > > Headers: "application/json" 
> > > body: '{"List":{{EPG_all}}, "Region":"NA " }' 
> > > body_format: json 
> > > user: "{{ snow_username }}" 
> > > password: "{{ snow_password }}" 
> > > force_basic_auth: yes 
> > > status_code: 200 
> > > timeout: 10 
> > > 
> > 
> > It certainly doesn't help that you reduce the timeout to 10 
> seconds. Also please post complete error message 
> > (without 
> > the credentials). 
> > 
> > Regards 
> > Racke 
> > 
> > > -- 
> > > You received this message because you are subscribed to the 
> Google Groups "Ansible Project" group. 
> > > To unsubscribe from this group and stop receiving emails from 
> it, send an email to 
> > > ansible...@googlegroups.com  ansible-project+unsubscr...@googlegroups.com >. 
> > > To view this discussion on the web visit 
> > > 
> https://groups.google.com/d/msgid/ansible-project/eca3e85e-fbd2-4375-8a80-0649e4aa7103%40googlegroups.com
>  
> > <
> 

Re: [ansible-project] Comparing two files registering the difference

2020-05-21 Thread Stefan Hornburg (Racke)
On 5/21/20 9:01 AM, Sivakumar Saravanamuthu wrote:
> hi
> 
> I have requirement to compare local file with remote file. Example I have a 
> copy of standard /etc/hosts  file and I need
> to compare that file with remote host /etc/hosts file to check the 
> difference. If there is difference it should register
> it and proceed with next task. I tried various option like diff and stat but 
> unable to get expected result. 
> 
> Is there any way I can execute that.

With the stat module you should be able to establish whether the files have 
different checksums. What did you try
exactly?

Regards
Racke

> 
> Regards,
> Siva
> 
> -- 
> 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/469d7a64-a6be-427f-9de9-539ce5ee09f1%40googlegroups.com
> .


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

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/dc439995-263e-3795-6cf9-1682dfc85be6%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


[ansible-project] Handling password prompt -- IOS_command module

2020-05-21 Thread rajthecomputerguy
Hi Team,

How to handle password prompt when doing scp file transfer.  Actually 
server is generating banner message along with password prompt. Please help 
how to resolve the issue.

- name:  transfer the image
  ios_command:
commands:
  - command: 'copy scp://{{ ansible_user }}@{{ ip_address }}/{{ 
new_system_image }} flash:'
prompt: 
- 'Destination filename \[{{ new_system_image }}\]'
- 'Password'
answer: 
- "\r"
- "{{ password }}"


-- 
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/d749e376-3bbf-4ba5-8e14-1739e5f772d2%40googlegroups.com.


Re: [ansible-project] Response' object has no attribute '__getitem__ while running the lookup plugin 'hashi_vault'

2020-05-21 Thread Asmitha j.s
I'm refering to 
https://docs.ansible.com/ansible/latest/plugins/lookup/hashi_vault.html 
document. 
It requires hvac (python library). and i have already installed it. Im 
trying connect by github token.

On Thursday, May 21, 2020 at 12:00:05 AM UTC+5:30, vinoth kumar wrote:
>
>
> Have you installed pip hashi vault module . I think you have to install 
> the pip module for this connection. Check in hashi vault module page in 
> official ansible document . In first few line you can see the requirements. 
> Fix that it will work .
>
> On Wed 20. May 2020 at 12:02, Asmitha j.s > 
> wrote:
>
>> I'm using hashi_vault to retrieve secrets from HashiCorp’s vault in 
>> ansible playbook.
>>
>>   - name: Return all secrets from a path
>> set_fact:
>>vault_result: "{{ lookup('hashi_vault', 'secret=secret/key:value 
>> token=token url=
>> https://vaultaddress/ui/vault/secrets/secret/list/folder/subfolder/environment/')}
>> }"
>>
>>
>> tags:
>>- vault
>>
>>  
>> command i'm using to run pl is ansible-playbook -v plybook.yml --tags 
>> vault 
>>
>> I'm getting following error:
>> fatal: [server_addr]: FAILED! => {
>> "msg": "An unhandled exception occurred while running the lookup 
>> plugin 'hashi_vault'. Error was a , original 
>> message: 'Response' object has no attribute '__getitem__'"
>> }
>>
>>
>> My python version is Python 2.7.5
>> My pip versin is pip 20.1 
>> My Ansible version is 
>>  ansible 2.9.3
>>   config file = /etc/ansible/ansible.cfg
>>   configured module search path = [u
>> '/home/asmithas/.ansible/plugins/modules', u
>> '/usr/share/ansible/plugins/modules']
>>   ansible python module location = /usr/lib/python2.7/site-packages/
>> ansible
>>   executable location = /usr/bin/ansible
>>   python version = 2.7.5 (default, Aug  7 2019, 00:51:29) [GCC 4.8.5 
>> 20150623 (Red Hat 4.8.5-39)]
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ansible...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/a0a2b672-80ad-4066-8be4-7218788d2611%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/0081d5c3-fb51-43cc-b5e4-66b35bf7024c%40googlegroups.com.


[ansible-project] Comparing two files registering the difference

2020-05-21 Thread Sivakumar Saravanamuthu
hi

I have requirement to compare local file with remote file. Example I have a 
copy of standard /etc/hosts  file and I need to compare that file with 
remote host /etc/hosts file to check the difference. If there is difference 
it should register it and proceed with next task. I tried various option 
like diff and stat but unable to get expected result. 

Is there any way I can execute that.

Regards,
Siva

-- 
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/469d7a64-a6be-427f-9de9-539ce5ee09f1%40googlegroups.com.