Skip to content

Commit 5713593

Browse files
committed
General update and improvement ( new target Distro releases, new install approaches tarball/yum/apt, new remoteagent/remotecollector/localcollector+localagent etc)
1 parent bc2efbe commit 5713593

File tree

8 files changed

+292
-72
lines changed

8 files changed

+292
-72
lines changed

README.md

Lines changed: 72 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,89 @@
1+
12
#Takipi Ansible Playbook
23

4+
###Run the full test using Vagrant + VirtualBox
5+
- the main configuration is saved in the host.json ( 4 hosts )
6+
- the default Vagrantfile picks base boxes and name them accordingly
7+
8+
The command to use to build all the boxes is:
9+
```vagrant up```
10+
11+
The general command to use to build a single box is:
12+
```vagrant up <BOX_NAME>```
13+
14+
i.e. to deploy centos_7 box use the command:
15+
```vagrant up centos_7```
16+
317
###Run the playbook against you server using:
418

5-
``ansible-playbook -i inventory site.yml``
19+
```ansible-playbook -i inventory site.yml```
620

721
Add your host in inventory.ini like:
822
```
923
[remote]
1024
example.com ansible_ssh_user=root
1125
```
1226

13-
Add your API Key in roles/common/vars/main.yml or group_vars/all.yml:
27+
Add your variables values in roles/common/vars/main.yml or group_vars/all.yml (defaults are included already in defaults/main.yml). There are few variables to consider:
28+
29+
- takipi - this contains the OverOps Host details
1430
```
1531
takipi:
32+
# OOMODE can be either:
33+
# remoteAgent - for Agent ONLY pointing to a remote collector ip/port ( default )
34+
# remoteCollector - for remote Collector
35+
# localCollector - for local Collector + Agent
36+
#
37+
# Examples:
38+
#
39+
# OOMODE:
40+
# mode: "remoteAgent"
41+
# coll:
42+
# ip: "10.0.1.200"
43+
# port: 6060
44+
#
45+
# OOMODE:
46+
# mode: "remoteCollector"
47+
# coll:
48+
# ip: ""
49+
# port: 6060 # listening tcp port
50+
#
51+
# OOMODE:
52+
# mode: "localCollector"
53+
# coll:
54+
# ip: "" # this is set to "127.0.0.1"
55+
# port: 6060 # this is both used for collector binging port and agent port
56+
OOMODE:
57+
mode: "remoteAgent"
58+
coll:
59+
ip: "10.0.1.1"
60+
port: 6060
61+
62+
# OOINSTALLMODE can be either:
63+
# package - for yum/apt
64+
# tarball - for tarball
65+
OOINSTALLMODE: "tarball"
66+
```
67+
68+
- takipiSK - this contains the OverOps Service Key
69+
```
70+
takipiSK:
1671
SECRET_KEY: "<Insert your secret key here>"
1772
```
1873

74+
- takipiInternal - this is for internal use ( do not modify UNLESS YOU REALLY KNOW WHAT YOU ARE DOING )
75+
```
76+
takipiInternal:
77+
# do not modify UNLESS YOU REALLY KNOW WHAT YOU ARE DOING
78+
```
79+
80+
81+
1982
Tested on:
20-
- Ubuntu 14.04, 12.04
21-
- Ansible 1.7.2, 1.8.2
83+
- boxes OS ( also for Vagrant guests )
84+
- Ubuntu 16.04, 18.04
85+
- CentOS 7, 8
86+
- Vagrant 2.2.6
87+
- (patched to work with VirtualBox 6.1 ref: https://github.com/oracle/vagrant-boxes/issues/178#issue-536720633 )
88+
- VirtualBox 6.1
89+
- Ansible 2.9.2

Vagrantfile

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,60 +7,70 @@ Vagrant.require_version ">= 1.4.3"
77
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
88
VAGRANTFILE_API_VERSION = "2"
99

10+
# Require JSON module
11+
require 'json'
12+
13+
BASE_IP = "10.0.1."
14+
# Read YAML file with box details
15+
HOSTS = JSON.parse(File.read(File.join(File.dirname(__FILE__), 'hosts.json')))
16+
1017
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
11-
["centos_6", "centos_7", "ubuntu_trusty64", "ubuntu_xenial64"].each do |i|
12-
config.vm.define "#{i}" do |node|
13-
node.vm.box = "#{i.sub '_', '/'}"
14-
18+
HOSTS.each_with_index do |i,index|
19+
config.vm.define i['name'] do |node|
20+
node.vm.box = "#{i['name'].sub '_', '/'}"
21+
1522
# The url from where the 'node.vm.box' box will be fetched if it
1623
# doesn't already exist on the user's system.
17-
18-
node.vm.hostname = "takipi-dev"
19-
24+
25+
node.vm.hostname = "#{i['name'].sub '_',''}"
26+
node.vm.network "private_network", ip: "#{i['hostip']}"
27+
2028
# Share an additional folder to the guest VM. The first argument is
2129
# the path on the host to the actual folder. The second argument is
2230
# the path on the guest to mount the folder. And the optional third
2331
# argument is a set of non-required options.
2432
node.vm.synced_folder "~/", "/host-home"
2533
node.vm.synced_folder ".", "/vagrant"
26-
34+
2735
# Provider-specific configuration so you can fine-tune various
2836
# backing providers for Vagrant. These expose provider-specific options.
2937
node.vm.provider "virtualbox" do |vb|
3038
# Don't boot with headless mode
3139
# vb.gui = true
32-
40+
3341
# specify vm name
34-
vb.name = "takipi-#{i}-env"
35-
42+
vb.name = "takipi-#{i['name']}-env"
43+
3644
# Use VBoxManage to customize the VM. For example to change memory:
3745
vb.customize ["modifyvm", :id, "--memory", "1024"]
3846
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "100"]
39-
47+
4048
# The following allows symlinks in shared folders when running on windows host.
4149
# vagrant must be run from a command prompt with admin privileges
4250
if RUBY_PLATFORM == "i386-mingw32"
4351
vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
4452
vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/code", "1"]
4553
end
46-
47-
end
48-
49-
if i.include? "ubuntu"
50-
config.vm.provision "shell" do |s|
51-
s.inline = "apt-get install -y python"
52-
end
54+
5355
end
56+
5457
node.vm.provision :ansible do |ansible|
55-
if i.include? "ubuntu_trusty"
56-
ansible.extra_vars = {
57-
"RHEL_JAVA_VERSION": "java-1.7.0-openjdk",
58-
"DEBIAN_JAVA_VERSION": "openjdk-7-jdk"
59-
}
60-
end
61-
ansible.playbook = "site.yml"
58+
ansible.playbook = "site.yml"
6259
ansible.verbose = "vv"
63-
end
60+
ansible.extra_vars = {
61+
"takipi" => {
62+
"SECRET_KEY" => "S27571#sRk0xej3CHW8epq7#w1Mo879MTFaWhhCt61ZUy+OZRMOJeBanYshvKNIW5Hc=#7116",
63+
"OOMODE" => {
64+
"mode" => "#{i['takipi']['OOMODE']['mode']}" ,
65+
"coll" => {
66+
"ip" => "#{i['takipi']['OOMODE']['coll']['ip']}",
67+
"port" => "#{i['takipi']['OOMODE']['coll']['port']}",
68+
}
69+
},
70+
"OOINSTALLMODE" => "#{i['takipi']['OOINSTALLMODE']}"
71+
}
72+
}
73+
end
6474
end
6575

6676
end

hosts.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
[
2+
{
3+
"name":"centos_7",
4+
"hostip":"10.0.1.122",
5+
"takipi":{
6+
"OOMODE":{
7+
"mode":"remoteCollector",
8+
"coll":{
9+
"ip":"10.0.1.1",
10+
"port":6060
11+
}
12+
},
13+
"OOINSTALLMODE":"tarball"
14+
}
15+
},
16+
{
17+
"name":"centos_8",
18+
"hostip":"10.0.1.2",
19+
"takipi":{
20+
"OOMODE":{
21+
"mode":"remoteAgent",
22+
"coll":{
23+
"ip":"10.0.1.1",
24+
"port":6060
25+
}
26+
},
27+
"OOINSTALLMODE":"tarball"
28+
}
29+
},
30+
{
31+
"name":"ubuntu_xenial64",
32+
"hostip":"10.0.1.3",
33+
"takipi":{
34+
"OOMODE":{
35+
"mode":"remoteAgent",
36+
"coll":{
37+
"ip":"10.0.1.1",
38+
"port":6060
39+
}
40+
},
41+
"OOINSTALLMODE":"tarball"
42+
}
43+
},
44+
{
45+
"name":"ubuntu_bionic64",
46+
"hostip":"10.0.1.4",
47+
"takipi":{
48+
"OOMODE":{
49+
"mode":"remoteAgent",
50+
"coll":{
51+
"ip":"10.0.1.1",
52+
"port":6060
53+
}
54+
},
55+
"OOINSTALLMODE":"tarball"
56+
}
57+
}
58+
]

roles/common/defaults/main.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
takipi:
2+
# OOMODE can be either:
3+
# remoteAgent - for Agent ONLY pointing to a remote collector ip/port ( default )
4+
# remoteCollector - for remote Collector
5+
# localCollector - for local Collector + Agent
6+
#
7+
# Example stubs:
8+
#
9+
# OOMODE:
10+
# mode: "remoteAgent"
11+
# coll:
12+
# ip: "10.0.1.200"
13+
# port: 6060
14+
#
15+
# OOMODE:
16+
# mode: "remoteCollector"
17+
# coll:
18+
# ip: ""
19+
# port: 6060 # listening tcp port
20+
#
21+
# OOMODE:
22+
# mode: "localCollector"
23+
# coll:
24+
# ip: "" # this is set to "127.0.0.1"
25+
# port: 6060 # this is both used for collector binging port and agent port
26+
OOMODE:
27+
mode: "remoteAgent"
28+
coll:
29+
ip: "10.0.1.1"
30+
port: 6060
31+
32+
# OOINSTALLMODE can be either:
33+
# package - for yum/apt ( default )
34+
# tarball - for tarball + install script
35+
OOINSTALLMODE: "tarball"
36+
37+
takipiSK:
38+
SECRET_KEY: "S3875#YAFwDEGg5oSIU+TM#G0G7VATLOqJIKtAMy1MObfFINaQmVT5hGYLQ+cpPuq4=#87a1"
39+
40+
41+
takipiInternal:
42+
# do not modify UNLESS YOU REALLY KNOW WHAT YOU ARE DOING
43+
OOONELINER: "wget -O - -o /dev/null http://get.takipi.com | bash /dev/stdin -i"
44+
OOINSTALLERURLAGENT: "https://app.overops.com/app/download?t=sa-tgz"
45+
46+
DEBIAN_JAVA_VERSION: "openjdk-8-jdk"
47+
RHEL_JAVA_VERSION: "java-1.8.0-openjdk"

0 commit comments

Comments
 (0)