-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0b31ba
commit c8fb521
Showing
10 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# ===================== | ||
# Test | ||
# ===================== | ||
test_ansible: | ||
cp ansible/Dockerfile Dockerfile | ||
docker build --force-rm=true --rm=true --no-cache . | ||
rm Dockerfile | ||
docker rmi $$(docker images -q --filter dangling=true) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM williamyeh/ansible:centos7 | ||
# FROM williamyeh/ansible:ubuntu14.04 | ||
|
||
WORKDIR /tmp | ||
COPY ansible /tmp | ||
|
||
# ==> Creating inventory file... | ||
RUN echo localhost > inventory | ||
|
||
# ==> Executing Ansible... | ||
RUN ansible-playbook -i inventory amon-agent.yml --connection=local | ||
|
||
|
||
RUN cat /etc/amon-agent.conf |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## Installing the amon-agent with Ansible | ||
|
||
- Copy all the files from deployment/ansible to a local path | ||
- In amon-agent.yml, replace the following variables with the appropriate values: | ||
|
||
``` | ||
api_key - a valid API key | ||
amon_instance - the IP or domain pointing to your Amon instance | ||
``` | ||
|
||
## Running the playbook | ||
|
||
|
||
|
||
``` | ||
ansible-playbook amon-agent.yml | ||
``` | ||
|
||
Tested on Debian/Ubuntu and CentOS |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"server_key": "{{machine_id}}", | ||
"host": "{{amon_instance}}" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- hosts: localhost | ||
connection: local | ||
sudo: True | ||
vars: | ||
api_key: uxIDpRApV3ULEnDUAwUNA6grHLBQs91iEiQsN8pIUao | ||
amon_instance: http://192.168.72.128:9000 | ||
machine_id: "{{ ansible_machine_id | hash('md5') }}" | ||
tasks: | ||
- uri: | ||
url: "{{amon_instance}}/api/v1/servers/create/?api_key={{api_key}}&key={{machine_id}}&name={{ansible_nodename}}" | ||
method: GET | ||
- include: ubuntu_debian.yml | ||
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' | ||
- include: centos.yml | ||
when: ansible_distribution == 'CentOS' | ||
- template: src=amon-agent.conf dest=/etc/amon-agent.conf owner=amonagent group=amonagent mode=0644 | ||
- command: /etc/init.d/amon-agent restart |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[amon-agent] | ||
name=AmonAgent | ||
gpgcheck=0 | ||
enabled=1 | ||
baseurl=http://packages.amon.cx/rpm |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- template: src=centos.repo dest=/etc/yum.repos.d/amon.repo | ||
|
||
- name: Install | ||
yum: name=amon-agent state=latest |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
- name: Add Amon agent repository key. | ||
command: apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv AD53961F | ||
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' | ||
|
||
- name: Add repository - Debian/Ubuntu. | ||
lineinfile: "dest=/etc/apt/sources.list.d/amonagent.list create=yes line='deb http://packages.amon.cx/repo amon contrib'" | ||
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' | ||
|
||
|
||
- name: Update. | ||
command: apt-get update | ||
|
||
- name: Install. | ||
command: apt-get install -y --force-yes amon-agent |
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