Created
August 1, 2014 12:19
-
-
Save martinrusev/e7b8d5c6888ceec1be97 to your computer and use it in GitHub Desktop.
Install mongo plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM mongo:latest | |
MAINTAINER Martin Rusev | |
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv AD53961F | |
RUN echo 'deb http://bg.archive.ubuntu.com/ubuntu precise main universe' > /etc/apt/sources.list && \ | |
echo 'deb http://bg.archive.ubuntu.com/ubuntu precise-updates universe' >> /etc/apt/sources.list | |
RUN echo 'deb http://packages.amon.cx/repo amon contrib' >> /etc/apt/sources.list | |
RUN apt-get update | |
RUN apt-get install -y --force-yes amon-agent | |
RUN /etc/init.d/amon-agent status | |
ADD hosts /etc/amonagent/hosts | |
ADD mongo.yml /etc/amonagent/plugins/mongo/mongo.yml | |
RUN apt-get install -y --force-yes autoconf g++ python-dev ssh | |
RUN pip install ansible | |
RUN ansible-playbook /etc/amonagent/plugins/mongo/mongo.yml -i /etc/amonagent/hosts --verbose | |
CMD ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127.0.0.1 ansible_connection=local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: all | |
vars: | |
plugins_path: "/etc/amonagent/plugins/" | |
enabled_plugins: "/etc/amonagent/plugins-enabled/" | |
mongo_url: "127.0.0.1:27017/test" | |
# vars_prompt: | |
# - name: "password" | |
# prompt: "Please enter your MongoDB connection string (Example: 127.0.0.1:27017/db)" | |
tasks: | |
- name: Install python-devel | |
yum: name=python-devel state=latest | |
when: ansible_os_family == "RedHat" | |
- name: Install python-dev | |
apt: name=python-dev | |
when: ansible_os_family == "Debian" | |
- template: src={{ plugins_path }}mongo/mongo.conf.example dest={{ enabled_plugins }}mongo.conf | |
- name: Install Plugin requirements | |
pip: requirements={{ plugins_path }}mongo/requirements.txt | |
- name: Restart the agent | |
sudo: True | |
command: /etc/init.d/amon-agent restart | |
- name: Test the plugins | |
sudo: True | |
command: /etc/init.d/amon-agent test_plugins |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment