Skip to content

Instantly share code, notes, and snippets.

@rakesh-patnaik
Created August 1, 2014 22:20
Show Gist options
  • Save rakesh-patnaik/2ff92190c4b227eeb8f8 to your computer and use it in GitHub Desktop.
Save rakesh-patnaik/2ff92190c4b227eeb8f8 to your computer and use it in GitHub Desktop.
proxy_env changes
## File: vm-infra-monitoring\ansible\monitoring\group_vars\all
proxy_env:
http_proxy: http://one.proxy.att.com:8080
https_proxy: http://one.proxy.att.com:8080
## File: vm-infra-monitoring\ansible\monitoring\roles\apt\tasks\main.yml
- apt: update_cache=yes upgrade=dist
environment: proxy_env
- shell: /usr/bin/apt-get autoremove -y
## File: vm-infra-monitoring\ansible\monitoring\roles\apache\tasks\ubuntu.yml
- name: install apache
apt: pkg={{ item }} state=present
environment: proxy_env
with_items:
- apache2
- php5-gd
- libgd2-xpm-dev
- libapache2-mod-php5
- name: Activate Apache cgi on Ubuntu
shell: /usr/sbin/a2enmod cgi
notify: restart apache
## File: vm-infra-monitoring\ansible\monitoring\roles\nagios\tasks\build.yml
- name: Ensure download directory is present
file: path={{ ansible_env.HOME }}/nagios state=directory
- name: Downloading the EPEL repository definitions.
get_url: url=http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm dest={{ ansible_env.HOME }}/nagios/epel-release-6-8.noarch.rpm
environment: proxy_env
when: is_centos
- name: Downloading and enable the EPEL repository definitions.
yum: name={{ ansible_env.HOME }}/nagios//epel-release-6-8.noarch.rpm state=present
environment: proxy_env
when: is_centos
- name: Install Nagios prerequisites for CentOS
yum: pkg={{ item }} state=present
environment: proxy_env
with_items:
- gcc
- glibc
- glibc-common
- gd
- gd-devel
- make
- perl
- perl-devel
- wget
- python-passlib
when: is_centos
- name: Install Nagios prerequisites for Debian
apt: pkg={{ item }} state=present
environment: proxy_env
with_items:
- linux-headers-{{ ansible_kernel }}
- build-essential
- python-passlib
when: is_debian
- name: Install Nagios prerequisites for Ubuntu
apt: pkg={{ item }} state=present
environment: proxy_env
with_items:
- linux-headers-{{ ansible_kernel }}
- build-essential
- python-passlib
when: is_ubuntu
- name: Install plugin prerequisites for CentOS
yum: pkg={{ item }} state=present
environment: proxy_env
with_items:
- openssl-devel
- fping
- openldap-devel
- postgresql-devel
- radiusclient-ng-devel
- samba-client
- libsmbclient
when: is_centos
- name: Install Plugin prerequisites for Debian
apt: pkg={{ item }} state=present
environment: proxy_env
with_items:
- libssl-dev
- dnsutils
- fping
- libldap2-dev
- libpq-dev
- libradiusclient-ng-dev
- smbclient
- gawk
when: is_debian
- name: Install Plugin prerequisites for Ubuntu
apt: pkg={{ item }} state=present
environment: proxy_env
with_items:
- libssl-dev
- dnsutils
- fping
- libldap2-dev
- libpq-dev
- libradiusclient-ng-dev
- smbclient
- gawk
when: is_ubuntu
- name: Create nagcmd group
group: name=nagcmd state=present
- name: Create nagios user
user: name=nagios state=present groups=nagcmd
- name: Add apache user to nagcmd group
user: name={{ apacheuser }} state=present groups=nagcmd
- name: GET Nagios
environment: proxy_env
get_url: url={{ nagiosurl }} dest={{ ansible_env.HOME }}/nagios/{{ nagiossrc }}.tar.gz
- name: Get Plugins
environment: proxy_env
get_url: url={{ pluginsurl }} dest={{ ansible_env.HOME }}/nagios/{{ pluginssrc }}.tar.gz
- name: Get NRPE
environment: proxy_env
get_url: url={{ nrpeurl }} dest={{ ansible_env.HOME }}/nagios/{{ nrpesrc }}.tar.gz
- name: Unpack Nagios source files
shell: cd {{ ansible_env.HOME }}/nagios && tar -xzvf {{ nagiossrc }}.tar.gz creates={{ ansible_env['HOME'] }}/nagios/{{ nagiossrc }}
- name: Configure
shell: cd {{ ansible_env.HOME }}/nagios/{{ nagiossrc }} && ./configure --with-command-group=nagcmd creates={{ ansible_env['HOME'] }}/nagios/{{ nagiossrc }}/Makefile
when: is_centos
- name: Configure
shell: cd {{ ansible_env.HOME }}/nagios/{{ nagiossrc }} && ./configure --with-command-group=nagcmd creates={{ ansible_env['HOME'] }}/nagios/{{ nagiossrc }}/Makefile
when: is_debian
- name: Configure
shell: cd {{ ansible_env.HOME }}/nagios/{{ nagiossrc }} && ./configure --with-command-group=nagcmd -with-httpd_conf=/etc/apache2/conf-available creates={{ ansible_env['HOME'] }}/nagios/{{ nagiossrc }}/Makefile
when: is_ubuntu
- name: Make all
shell: cd {{ ansible_env.HOME }}/nagios/{{ nagiossrc }} && make all creates={{ ansible_env['HOME'] }}/nagios/{{ nagiossrc }}/base/nagios
- name: Make install
shell: cd {{ ansible_env.HOME }}/nagios/{{ nagiossrc }} && make install creates=/usr/local/nagios/bin/nagios
- name: Make install-config
shell: cd {{ ansible_env.HOME }}/nagios/{{ nagiossrc }} && make install-config creates=/usr/local/nagios/etc/nagios.cfg
- name: Make install-commandmode
shell: cd {{ ansible_env.HOME }}/nagios/{{ nagiossrc }} && make install-commandmode creates=/usr/local/nagios/var/rw
- name: Make install-devel
shell: cd {{ ansible_env.HOME }}/nagios/{{ nagiossrc }} && make install-devel creates=/usr/local/nagios/include/nagios/nagios.h
- name: Make install-webconf
shell: cd {{ ansible_env.HOME }}/nagios/{{ nagiossrc }} && make install-webconf creates=/etc/httpd/conf.d/nagios.conf
environment: proxy_env
notify: restart apache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment