[ansible-project] Ansible Fails to Restart Jetty on a remote host

2019-09-25 Thread Madushan Chathuranga
Hi All,

I'm trying to restart jetty using an ansible script

bellow is a snippet from my script

---
  - hosts: all
tasks:


 - name: start jetty
   command: sh jetty.sh restart
   args:
 chdir: /apps/servers/jetty/bin

my inventory file is 
10.0.18.225 ansible_user=appusr ansible_ssh_private_key_file=/home/ec2-user/
key


What happens is ansible is able to restart the jetty server as expected. 
but once ansible script done it's execution jetty server stops.
Any Ideas why this would happen. I don't have the luxury to start jetty as 
a service here 'jetty start'. There are no error or sigkills in the jetty 
logs. ansible also shows Jetty Start : OK in it's stdrr output. Would be 
great if anyone could help me with this.

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/ad1172d1-4cc0-4435-98e0-697fad20bfcb%40googlegroups.com.


[ansible-project] Ansible AWS Modules for CloudWatch

2018-10-17 Thread Madushan Chathuranga
Hi All,

Is there an ansible module available to search aws cloud watch logs and 
events.
https://docs.ansible.com/ansible/2.5/modules/cloudwatchlogs_log_group_facts_module.html#cloudwatchlogs-log-group-facts-module
 This 
module can return log group details. What i'm looking is to search logs in 
a log_stream in a log_group. 

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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/eac0671b-6544-4bd9-8559-baee182349f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Difference in ec2 module and ec2_instance module.

2018-10-15 Thread Madushan Chathuranga
Hi All,

What is the difference between ec2 module and ec2_instance module. Why 
there are two modules to create an ec2. 

https://docs.ansible.com/ansible/2.5/modules/ec2_instance_module.html
https://docs.ansible.com/ansible/2.5/modules/ec2_module.html  


I see pretty much all the module args are same except for some.

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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/69f758b1-5a7b-406d-8b55-bd9d2fb5f4b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Use password protected private key for an ansible script

2018-09-12 Thread Madushan Chathuranga
Hi,

This is to connect to the remote host. I'm aware that we can do something 
similar to this,
ansible-playbook -i hosts.yml --private-key=private_key_path ansible_script.
yml

also, I know we can use the private key in the inventory host_vars as 
ansible_ssh_private_key
but why ansible doesn't provide a option to manage private_key's password 
if it allows to use a private_key. 

On Wednesday, September 12, 2018 at 6:09:55 PM UTC+5:30, Dick Visser wrote:
>
> Is this private key supposed to be used for connecting to a host 
> you're configuring (i.e. the password to a protected SSH key)? 
> Or is it used inside a task, to executed on a remote host (i.e. 
> *after* you've connected to it)? 
>
> Dick 
>
> On 12 September 2018 at 12:57, Madushan Chathuranga 
> > wrote: 
> > Hi All, 
> > 
> > Is it possible to provide the password of the private key on the command 
> > line extra vars or using the inventory. In the inventory we can provide 
> the 
> > private key but not the password? can not use --ask-pass in the command 
> > since it would prompt for the password to be user provided. Needs to 
> pass 
> > this password along with the private key. using this to execute an 
> ansible 
> > script on a remote host. 
> > 
> > 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-proje...@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/4b9e126e-1cc2-4cf9-8767-b5b32e041c8b%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6080620a-dd25-49e4-a18d-1cd7868156ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Use password protected private key for an ansible script

2018-09-12 Thread Madushan Chathuranga
Hi All,

Is it possible to provide the password of the private key on the command 
line extra vars or using the inventory. In the inventory we can provide the 
private key but not the password? can not use --ask-pass in the command 
since it would prompt for the password to be user provided. Needs to pass 
this password along with the private key. using this to execute an ansible 
script on a remote host. 

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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4b9e126e-1cc2-4cf9-8767-b5b32e041c8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible Do Until Loop

2018-05-22 Thread Madushan Chathuranga
Hi All, 

I'm using ansible version 2.5.0 I'm trying execute a task with an Do Until 
Loop. 
http://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#do-until-loops

Is it possible to run this task with an infinite number of retries ?  with 
out defying the number of retries.
e.g:

until: result.stdout.find("all systems go") != -1delay: 10 

task will finish only when the condition is success not when number of 
retries exceeds.

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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1ba11e2f-72de-4bda-829f-204cdc842e74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Convert an XML to JSON using ansible

2018-05-09 Thread Madushan Chathuranga
Thanks this solution works perfectly well. Just for the record this piece of 
code needs python package python-xmltodict installed. 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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/08109f86-f6e6-4f5c-8382-5b19039c2228%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Convert an XML to JSON using ansible

2018-05-08 Thread Madushan Chathuranga
Hi,

Thank you very much for the response. First let me explain what I'm trying to 
do here and then what I have done so far. 
I'm trying to call and rest api which I'm using URI module to do that. Success 
response of this api returns a xml response not json. But my end user needs the 
output from my ansible playbook to be json so others can consume it for other 
processes. This xml response comes in the content of the response. E.g. 
return_content : yes . So this content is a string which is in xml format. I 
need to sanitize it to remove characters like \n (new line). That's been done 
using regex_replace. So then we get the plain xml. Now this xml output needs to 
be shown in json manner. 
What i have been thinking and trying to do so far is create a python scrip 
which does the job. Then call the method in python script as a filter e.g. "{{ 
xml_response | xml_to_json}}". But stucked here on implementing this. Are there 
any easier work around for this? 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4d0c1c1f-ca37-49b4-9402-b73ff9f1db28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Convert an XML to JSON using ansible

2018-05-08 Thread Madushan Chathuranga
Hi,

Is there a filter or any work around to convert an XML to JSON using 
ansible?

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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4d2a1316-e4bb-4447-b84a-4df5a518d30f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible regex filter along with_items

2018-05-02 Thread Madushan Chathuranga
 

*Hi,*


*I'm kinda new to ansible seeking helop with below scenario. what I'm 
trying to do is iterate over the array '*access_key_ids*' and run 
regex_search filter. for the regex_search filter argument is 'item' which 
is the variable from with_items. It does not work this way below is what 
I'm trying.  *


*name: *Set Fatcs

  

*block:*

*# extract access key ids from get event response*- 

*set_fact:   event_response_access_key_ids: 
*"{{event_response_access_key_ids}} 
+ [{{event_response.content | regex_search(item)}}]"

 *with_items: *"{{access_key_ids}}"

   

*# check if the response contains access key id for the license*- 

*set_fact:   scwx_output: *"{{ (event_response_access_key_ids | length 
> 0 ) | ternary(event_response, 'License Key does not match with available 
sensors')}}"

  *when: *event_response.json is undefined 



*It gives* *event_response_access_key_ids as empty. but when I **hard code** a 
value instead of 'item' it works*


*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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/31f195f7-fe1e-4423-90f0-396d3b114fb7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible include tasks and get response.

2018-05-01 Thread Madushan Chathuranga
Hi,

Is it possible to execute a another yaml file with in a yaml file (import 
or include) passing arguments and register its output? Or else return it's 
output and assign to a variable 

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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d9fb6e58-142f-4baf-b28f-a2d0697a5f6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.