How to install a custom software package using a script

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.

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 and
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
   tasks:

    # Copy remote file (host.example.com:/tmp/hyperic_agent.tar) into
    # /home/hyperic/hyperic_agent.tar on local machine

    -fetch:
     src: /tmp/hyperic_agent.tar
     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.

   -name: Extract hyperic_agent.tar into /home/hyperic
unarchive:
    src:/home/hyperic/hyperic_agent.tar
  dst:/home/hyperic/
  remote_src: yes

- name: Install Hyperic
  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.