I'm installing packages from the control machine, but it's a bit of work 
(so it probably won't be worth it for just a few packages), and I'm still 
figuring out the details.

Basically, I create a local yum repository, then temporarily run an HTTP 
server on the control machine (maybe with Ansible 2.0 I can reliably start 
and kill it as part of the playbook, but right now it's a manual process); 
for example using "python -m SimpleHTTPServer 8000"

I set the host to the control server using the SSH_CLIENT environment 
variable (if there's a better way to access that, I'd like to know):

yum_local_host: "{{ (ansible_connection is defined and ansible_connection 
== 'local') | ternary('localhost', ansible_env.SSH_CLIENT.split()[0]) }}"
yum_local_port: 8000
yum_repo_base: "http://{{ yum_local_host }}:{{ yum_local_port }}"

Then I use templates to set up the repositories on the remote side. 
Currently I'm looking at using a custom yum.conf so that it doesn't 
interfere with the normal configuration.

If anyone wants more details, or has suggestions for how to improve this 
setup, let me know.


On Monday, May 4, 2015 at 3:55:50 AM UTC-4, satheesh kumar wrote:
>
> I tried to install rpm in ansible control machine to target machines using 
> playbook
>
> - name: Install local rpm in server
>   yum: pkg=files/mod_jk-1.2.40-5.el6.x86_64.rpm state=present
>   when: ansible_os_family == 'RedHat'
>
>
> I got error :
> failed: [xyz.cloudapp.net] => {"changed": false, "failed": true, "rc": 0, 
> "results": []}
> msg: No Package file matching 'files/mod_jk-1.2.40-5.el6.x86_64.rpm' found 
> on system
>
> When I copied the same file in server and installed as local installation 
> it works.
>
>
>       - name: copy mod_jk rpm to server
>         copy: src=files/mod_jk-1.2.40-5.el6.x86_64.rpm 
> dest=/home/user/mod_jk-1.2.40-5.el6.x86_64.rpm owner=user group=azureuser 
> mode=755
>         when: ansible_os_family == 'RedHat'
>
>       - name: Install mod_jk local rpm in server
>         yum: name=/home/user/mod_jk-1.2.40-5.el6.x86_64.rpm state=present
>         when: ansible_os_family == 'RedHat'
>
>
> Is there a way to directly install from control machine without copying 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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1341719b-4362-439c-8c38-53b7d86fd7b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to