[ansible-project] Re: Ansible Module to look up variables

2017-06-19 Thread rup
Not sure if this is exactly what you want to do, but have you tried using 
variables in your play using register?  I.e.

- name: Get python version
  shell: python -V
  register: python_version

- name: Show python version
  debug:
msg: "{{ python_version }}"

This will return the version on each host modified.  Sorry if this isn't 
related to your question, but seems like that was what you're looking for.

-- 
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/3764628a-c835-40ee-9024-3315ecbc9dfe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Question about organizing roles and playbooks

2016-10-26 Thread rup
We implemented this by having host files specific to an environment, so for 
example, a QA host file, a Prod host file, a Dev host file, etc.  Then the 
groupings within the host file would be based off what they were used for, 
for example:

[wildfly_servers]
HostA
HostB

[activemq_servers]
HostB

[db_servers]
HostA

[akka_servers]
HostB

[php_servers]
HostA

[php_innovations_servers]
HostA

Then when calling the playbook, we just pull in the appropriate host file 
for the environment we want to have updated.  Is this what you were talking 
about?

-- 
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/92a9d9eb-edda-4870-aa41-18922173731c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Which of .bashrc, .profile, .bash_profile, .bash_login or .login is used?

2016-09-22 Thread rup

>
> I ran into the same issue and spent many hours trying to find out why it 
> wasn't using the profiles.  I like your LAST test to see which profile was 
> being used, very clever.
>

I solved it by simply sourcing each profile I needed prior to the step I 
wanted to execute.  For example:

- name: Run some step
  shell: . /pathtobashrc/.bashrc && . /pathtoprofile/profile && step I 
wanted to execute
 

-- 
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/5cc3f93b-57d3-4196-bf37-a9ec58799921%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Spin Up Jenkins on AWS instance

2016-09-08 Thread rup
Sometimes it's a matter of timing.  If it's sporadically happening, perhaps 
the ssh connection isn't happening within the 10 second default used by 
Ansible.  To override this default you need to specify in your config file.

On Wednesday, September 7, 2016 at 2:33:54 PM UTC-6, Liora Milbaum wrote:
>
> I can provision the ec2 instance but the setup task fails with the message:
> fatal: [54.166.83.128]: UNREACHABLE! => {"changed": false, "msg": "Failed 
> to connect to the host via ssh.", "unreachable": true}
>
> Any idea how to fix/troubleshoot this issue?
>
> I am newbie to Ansible.
>
> Thanks,
> Liora
>

-- 
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/dba6fdc6-d228-48ab-8013-0afe30aaa8ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: What I supposed to do with a long time no response Ansible playbook process?

2016-07-21 Thread rup
To find current process, run this to get PID to kill:

 ps -ef|grep ansible

A command I use to watch Ansible processes as they are running is:

 watch -n 3 'netstat -ta | egrep ":ssh +EST"'

So I can follow along with what's being run.

Kim

-- 
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/37d0a237-92d6-4448-9f0e-ceed209913ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Trying to copy a directories contents but not the other directories with in. Any help is appreciated

2016-07-19 Thread rup
Perhaps you can try something a bit simpler?  Note, not tested...

- name: Copy cert files to backup
shell:  cp /var/certs/certbkup{*.crt *.cer *.jks *.p12} /var/certs/certbkup/

Kim

On Tuesday, July 19, 2016 at 9:57:44 AM UTC-6, Alan Harkleroad wrote:
>
> I am currently trying to copy a directories contents to a new directory so 
> we can do our SHA-384 and TLS upgrades to the system. When I have to copy 
> the variable list results to the new folder is where I am confusing my self 
> as to how that should look
>
> My playbook likes like this.
>
> ---
> - hosts: some-server-name
>   become: true
>   become_method: sudo
>   tasks:
>   
>   - name: Create backup directory on remote server/servers
> file: path=/var/certs/certbkup
>   state=present
>   owner=root
>   group=some-group
>   mode=744
>
>   - name: list directory specific contents
> shell: ls *.crt *.cer *.jks *.p12 /var/certs
> register: cert_results
>
>   - name: copy list results to new folder
> command: cp {{item}} /var/certs/certbkup
> with_items: cert_results.stdout_lines
>

-- 
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/f98f921a-39ee-4515-957a-8fca007d1b32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Module ping: One host fails with "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh"

2016-07-19 Thread rup
We also have a similar issue when the ssh times out.  We've been having 
that occur occasionally lately, randomly to servers, and are considering 
setting up a config file to override the 10 second timeout default.  Just a 
thought anyway.

On Friday, July 15, 2016 at 1:55:01 AM UTC-6, Jörg Kastning wrote:
>
> Hello there,
>
> before executing the following commands I started a ssh-agent bash and 
> added my private key.
>
> Running the command "ansible all -m ping" checks succeeded but one. For 
> one host I got the following error:
> host1.example.com | UNREACHABLE! => {
> "changed": false,
> "msg": "SSH Error: data could not be sent to the remote host. Make 
> sure this host can be reached over ssh",
> "unreachable": true
> }
>
> But when I run the following command in the same shell, the connection is 
> successful:
> ssh r...@host1.example.com
>
> The section in my inventory file looks like:
> [host-group]
> host[1:2].example.com
> host-test.example.com
>
> Only host1 fails, the other two are checkt successfully.
>
> I use ansible 2.1.0.0  from EPEL-Repo with RHEL 7.2.
>
> Could someone explain to me what's wrong here?
>
> Kind regards,
> Joerg
>

-- 
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/2f54d0d1-ccb8-4e13-b270-3c94260de460%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: jenkins+Ansible

2016-06-27 Thread rup
We use Jenkins but don't bother with the plugin.  I simply create an 
Execute Shell step at the end of my Jenkins project (earlier steps involve 
staging code files, etc.) with an entry like this:

ssh ansible_user@ansible.server -C "cd 
~ansible_user/playbooks;ansible-playbook -i hostfile play.yml -vv"

On Monday, June 27, 2016 at 4:26:53 AM UTC-6, imed khaskhoussi wrote:
>
> Hello , 
> i want to execute a playbook from jenkins ,so i installed ansible plugin 
> .but when i try to execute the playbook i got a problem of permission 
> denied .
> is there some roles to attribute to jenkins ? 
> need some help please .
> thank you in advance .
>

-- 
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/8eafdd30-f492-4862-9712-bf89ebe4b916%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Using playbook to start, stop or restart a service

2016-05-03 Thread rup
But using the service module isn't quite that simple, right?  You have to 
set up your init script to identify the services that the module would 
call.  That's where I'm at currently.

On Sunday, May 1, 2016 at 2:49:44 PM UTC-6, Rick O'Shea wrote:
>
> We have host groups whose service states we wish to automate.  
>
> - name manage service
>   service: name=foo state={{state}}
>
> As near as we can tell this is the only way to automate a playbook to 
> start, stop, restart, enable, disable or status a service is to pass a 
> variable on the command line:
>
> ansible-playbook foo-service.yml -e state=started
>
> Is this best practice?
>
>
>
>

-- 
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/fcac4a90-1072-49d8-b9b4-afab5656cec8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: How to run ansible playbook with Bamboo or jenkins

2016-04-12 Thread rup
We have ssh keys established between our Jenkins server and our Ansible 
server.  Then in the Jenkins job, we have an Execute Shell command with an 
entry like so...

ssh ansible@ansible_server_address -C "cd 
~ansible/playbooks;ansible-playbook -i hostsfile site.yml --extra-vars 
"whatever vars you want to pass" -vv"

We have the Jenkins job set to run periodically (i.e. cron'd)

On Tuesday, April 12, 2016 at 8:49:35 AM UTC-6, mondher khas wrote:
>
> I want to execute an ansible playbook using Bamboo or jenkins.  
> However the build failed because  i can't pass the ssh password .
>  Have you any idea please ?
>

-- 
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/a0c61850-9122-495e-bf43-d1e6462e7d7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ERROR! Specified hosts options do not match any hosts

2016-03-28 Thread rup
How are you running your playbook?  I.e. what is your command?

-- 
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/9bb69dd2-09ca-4cd8-af0f-5be8bcaae0b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Using ansible to call python script with subprocess module to run sqlplus script, Ansible shows missing sqlplus...?

2016-02-12 Thread rup
Without looking too closely at your code/error I ran into what may be a 
related issue.  It's because the shell is not sourcing the profiles of the 
SSH user.  I had to update my shell command to source my bashrc and 
primarily my profile first before executing my command like so:

shell: . /path to home/.bashrc && . /path to profile/profile && [command to 
run here]

Hope that helps, it was a very hard journey to figure this out for my 
installation.

Kim

On Thursday, February 11, 2016 at 12:04:47 PM UTC-7, 
brya...@santecapital.com wrote:
>
> Hello all,
>
> I am using ansible to deploy and provision some instances then runs a 
> python script at the very end. The python script uses the subprocess 
> module 
>  to 
> call a sql script and generate flat text files. When I directly ssh into 
> the instances and run remotely, everything works. However when I use 
> ansible to call the python script it looks like commands don't get passed 
> to the Popen construct OR sqlplus is not installed??? Which is weird cause 
> it definitely is installed. This may be a more python oriented question but 
> since I only have the issue when using Ansible to run the python program... 
> I'm posting here. 
>
> Ansible: 
> ansible webservers -i inventory --vault-password-file ~/.vault_pass.txt -u 
> ec2-user -m command -a "python script.py chdir=dir/dir1/dir2"
>
> Python:
> connect_string=username/password@connectionObject
> sql_command=@sql_script.sql
>
> def run_sql_query(sql_command, connect_string):
>   """
>   Run sqlCommand and return query result and error Message
>   """
>   session = Popen(['sqlplus', '-S', connect_string], stdin=PIPE, 
> stdout=PIPE, stderr=PIPE)
>   session.stdin.write(sql_command)
>   return session.communicate()
>
> Error:
>   File "/usr/lib64/python2.7/subprocess.py", line 710, in __init__
> errread, errwrite)
>   File "/usr/lib64/python2.7/subprocess.py", line 1335, in _execute_child
> raise child_exception
> OSError: [Errno 2] No such file or directory
>
> A closer look shows that one of the following is happening:
>
> 1) /bin/bash: sqlplus: command not found
>  
> HOW???
>

-- 
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/4a3b410b-bc4b-4eae-bce6-8f8da98ed391%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Reusing a set of taks across many roles

2015-12-03 Thread rup
Where would you "store" such a file?  At what point in your directory 
structure?

On Saturday, November 21, 2015 at 11:01:49 AM UTC-7, Markus Ellers wrote:
>
> hi,
>
> you could put these tasks in a separate yml file and include this file 
> whereever you need it.
>

-- 
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/b2266158-45c5-4a0c-8fcb-026c358e045f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: checking java process

2015-12-03 Thread rup
We did it like this:

- name: Check for previous running Wildfly instances
  shell: ps -ef | grep jboss | grep java | grep -v activemq | grep -v 
/bin/sh | grep -v grep | awk '{print $2}'
  register: ps_result

- debug: msg="{{ps_result.stdout}}"
- debug: msg="{{ps_result.stderr}}"


We are also running activemq which uses java processes, so we have to 
exclude that from our grep results.

-- 
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/15e22a28-4d6c-4a4e-9680-9b35ea9b64fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ansible installation: no /etc/ansible/hosts file

2015-11-30 Thread rup
We don't bother with the /etc/ansible/hosts file because we installed 
ansible in a different directory.  So we always specify which host file to 
use in our run.  I.e. when in the ansible directory I execute:

ansible-playbook -i  site.yml -vv

-- 
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/56813efb-7e68-4f03-a25b-4c3b67c84385%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.