# How to install a custom software package using a script

**URL:** <https://forum.ansible.com/t/how-to-install-a-custom-software-package-using-a-script/25723>\
**Category:** Ansible Project\
**Created:** [October 12, 2017, 12:09am UTC](https://forum.ansible.com/t/how-to-install-a-custom-software-package-using-a-script/25723 "2017-10-12T00:09:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iyyappan\_V](https://avatars.discourse-cdn.com/v4/letter/i/b19c9b/32.png) [@Iyyappan\_V](https://forum.ansible.com/u/Iyyappan_V)\
**Post date:** [October 12, 2017, 12:09am UTC](https://forum.ansible.com/t/how-to-install-a-custom-software-package-using-a-script/25723/1 "2017-10-12T00:09:21Z")

</div>

Hi All,

I am new to Ansible and in learning phase. have a query like how to install a custom software package (hyperic agent) using ansible…

i need to install a software around 3000 servers in one shot from ansible server

I have two things to do,

1. copy package to the server
2. untar the package
3. install the package

Generally that software can be installed manually like below

#/home/hyperic/hyperic-agent/bin/script.sh start

Will the below playbook work? Unfortunately I am not in a network to connect and test it out by myself.

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [October 12, 2017, 8:11am UTC](https://forum.ansible.com/t/how-to-install-a-custom-software-package-using-a-script/25723/2 "2017-10-12T08:11:40Z")

</div>

> Hi All,
> 
> I am new to Ansible and in learning phase. have a query like how to install  
> a custom software package (hyperic agent) using ansible..
> 
> i need to install a software around 3000 servers in one shot from ansible  
> server
> 
> I have two things to do,
> 
> 1. copy package to the server  
> 2. untar the package  
> 3. install the package
> 
> Generally that software can be installed manually like below
> 
> #/home/hyperic/hyperic-agent/bin/script.sh start
> 
> Will the below playbook work? Unfortunately I am not in a network to  
> connect and test it out by myself.

You have a lot of indentation error in you code, I suggest reading  
[http://docs.ansible.com/ansible/latest/YAMLSyntax.html](http://docs.ansible.com/ansible/latest/YAMLSyntax.html) and  
[http://docs.ansible.com/ansible/latest/playbooks.html](http://docs.ansible.com/ansible/latest/playbooks.html)

Pay attention to indentation, it must be space and you need to be consistent of how many spaces.

To check the syntax you don't need a network to test, ansible-playbook has option --syntax-check.  
So run you code and fix everything "ansible-playbook --syntax-check your.yml" complains about, you only need ansible installed to do this.

Since you have so many indentation errors in you code I'm not going to address them in comment below, only the functionality.

> ======  
> - hosts: all  
> remote\_user: hyperic  
> become\_user: root  
> become\_method: su  
> &nbsp;&nbsp;&nbsp;tasks:
> 
> &nbsp;&nbsp;&nbsp;&nbsp;# Copy remote file (host.example.com:/tmp/hyperic\_agent.tar) into  
> &nbsp;&nbsp;&nbsp;&nbsp;# /home/hyperic/hyperic\_agent.tar on local machine
> 
> &nbsp;&nbsp;&nbsp;&nbsp;-fetch:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;src: /tmp/hyperic\_agent.tar  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dst: /home/hyperic

Fetch module copies/fetch the file from remote host to the Ansible controller.  
So your choices are fetch against host.example.com with a delegate\_to and then do a copy to remote host, use the get\_url or the synchronize module.

> &nbsp;&nbsp;&nbsp;-name: Extract hyperic\_agent.tar into /home/hyperic  
> unarchive:  
> &nbsp;&nbsp;&nbsp;&nbsp;src:/home/hyperic/hyperic\_agent.tar  
> &nbsp;&nbsp;dst:/home/hyperic/  
> &nbsp;&nbsp;remote\_src: yes
> 
> - name: Install Hyperic  
> &nbsp;&nbsp;package: name='hyperic\_agent" state=started

package will install software from the repository, you will need to use the command module to run the script as you would when installing it manually.
