# Install nagios on a remote maschine | execute a command like you would be connected via ssh

**URL:** <https://forum.ansible.com/t/install-nagios-on-a-remote-maschine-execute-a-command-like-you-would-be-connected-via-ssh/26428>\
**Category:** AWX Project\
**Created:** [January 6, 2018, 11:33am UTC](https://forum.ansible.com/t/install-nagios-on-a-remote-maschine-execute-a-command-like-you-would-be-connected-via-ssh/26428 "2018-01-06T11:33:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jan\_Vermaeten](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@Jan\_Vermaeten](https://forum.ansible.com/u/Jan_Vermaeten)\
**Post date:** [January 6, 2018, 11:33am UTC](https://forum.ansible.com/t/install-nagios-on-a-remote-maschine-execute-a-command-like-you-would-be-connected-via-ssh/26428/1 "2018-01-06T11:33:35Z")

</div>

Hello Everybody,

I am relatively new to Ansible and working on Student’s project with it, so please be patient.

As the subject says I would like install nagios on a remote instance. If I connect via ssh everything works just fine, but of course I would like to automate that. In general I need to translate these commands in an ansible-playbook:

cd /tmp  
wget [http://assets.nagios.com/downloads/nagiosxi/xi-latest.tar.gz](http://assets.nagios.com/downloads/nagiosxi/xi-latest.tar.gz)  
tar xzf xi-latest.tar.gz  
cd nagiosxi

[![](https://lh3.googleusercontent.com/-c_hbE9ivfrE/WlCzyXzXswI/AAAAAAAAmAo/BsdHW5XtyzQAD5ysPJc3nDB0h28AM2q2gCLcBGAs/s320/Capture.JPG)](https://lh3.googleusercontent.com/-c_hbE9ivfrE/WlCzyXzXswI/AAAAAAAAmAo/BsdHW5XtyzQAD5ysPJc3nDB0h28AM2q2gCLcBGAs/s1600/Capture.JPG)

./fullinstall

This is how my playbook looks like right now. The Copy part ist just because I copy a modified “fullinstall” file without the promt for “Do you really want to install”. Everything works fine so far but the last task.

- name: Install nagios server  
hosts: nagioss  
become: yes  
become\_method: sudo

tasks:

- name: download  
get\_url:  
url: [https://assets.nagios.com/downloads/nagiosxi/xi-latest.tar.gz](https://assets.nagios.com/downloads/nagiosxi/xi-latest.tar.gz)  
dest: /tmp
- name: Unzip  
unarchive:  
src: /tmp/xi-latest.tar.gz  
dest: /tmp  
remote\_src: yes
- name: copy modified script  
copy:  
src: NAGIOS/fullinstall  
dest: /tmp/nagiosxi/fullinstall
- name: Install  
command: ./fullinstall  
args:  
chdir: /tmp/nagiosxi

I am receiving this error:

[![](https://lh3.googleusercontent.com/-c_hbE9ivfrE/WlCzyXzXswI/AAAAAAAAmAo/BsdHW5XtyzQAD5ysPJc3nDB0h28AM2q2gCLcBGAs/s400/Capture.JPG)](https://lh3.googleusercontent.com/-c_hbE9ivfrE/WlCzyXzXswI/AAAAAAAAmAo/BsdHW5XtyzQAD5ysPJc3nDB0h28AM2q2gCLcBGAs/s1600/Capture.JPG)  
On the remote server is CentOS 6 installed.

Kind regards,  
Jan

---

<div class="post-metadata">

**Author:** ![Jan\_Vermaeten](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@Jan\_Vermaeten](https://forum.ansible.com/u/Jan_Vermaeten)\
**Post date:** [January 6, 2018, 12:15pm UTC](https://forum.ansible.com/t/install-nagios-on-a-remote-maschine-execute-a-command-like-you-would-be-connected-via-ssh/26428/2 "2018-01-06T12:15:40Z")

</div>

Another way that would work for me would be to simply install a script by this playbook:

- name: Install nagios server  
hosts: nagioss  
become: yes  
become\_method: sudo

tasks:

- name: copy modified script  
copy:  
src: templates/install.sh  
dest: /tmp/install.sh
- name: Install  
command: chmod +x install.sh  
args:  
chdir: /tmp
- name: Install  
command: ./install.sh  
args:  
chdir: /tmp

But I am receiving this error message:

[![](https://lh3.googleusercontent.com/-cO1EUi_ynyc/WlC9uUDTDxI/AAAAAAAAmA4/59ejx0spmX03y2cZLx3xU-n8DzDf4FNJQCLcBGAs/s400/Capture.JPG)](https://lh3.googleusercontent.com/-cO1EUi_ynyc/WlC9uUDTDxI/AAAAAAAAmA4/59ejx0spmX03y2cZLx3xU-n8DzDf4FNJQCLcBGAs/s1600/Capture.JPG)

---

<div class="post-metadata">

**Author:** ![Christopher\_Meyers](https://avatars.discourse-cdn.com/v4/letter/c/3e96dc/32.png) [@Christopher\_Meyers](https://forum.ansible.com/u/Christopher_Meyers)\
**Post date:** [January 8, 2018, 2:59pm UTC](https://forum.ansible.com/t/install-nagios-on-a-remote-maschine-execute-a-command-like-you-would-be-connected-via-ssh/26428/3 "2018-01-08T14:59:54Z")

</div>

This is an Ansible core question. Try asking on [https://groups.google.com/forum/#!forum/ansible-project](https://groups.google.com/forum/#!forum/ansible-project)
