-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additionally: fix all identified trailing whitespace
- Loading branch information
Showing
9 changed files
with
204 additions
and
17 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,6 @@ venv/ | |
*rpm | ||
.bundle | ||
ansible.cfg | ||
.molecule | ||
test.retry | ||
.cache |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
- name: restart kapacitord | ||
service: | ||
service: | ||
name: kapacitor | ||
state: restarted |
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,138 @@ | ||
--- | ||
# role specific overrides for molecule's config options. These will override ALL other config files. | ||
molecule: | ||
# # directory in CWD to place all temp files, etc. | ||
# molecule_dir: .molecule | ||
|
||
# # where temporary state will be stored (lives under molecule_dir) | ||
# state_file: state | ||
|
||
# # name of temporary vagrantfile / rakefile created during runs (lives under molecule_dir) | ||
# vagrantfile_file: vagrantfile | ||
# rakefile_file: rakefile | ||
|
||
# # directories to ignore when doing trailing whitespace checks on files during verify command | ||
# ignore_paths: | ||
# - .git | ||
# - .vagrant | ||
# - .molecule | ||
|
||
# # directory to look for serverspec tests | ||
# serverspec_dir: spec | ||
|
||
# directory to look for testinfra tests | ||
# testinfra_dir: tests | ||
|
||
# # template files to load when creating corresponding temporary files | ||
# # this would be a good place to specify your own ansible.cfg template, for example | ||
# vagrantfile_template: vagrantfile.j2 | ||
# ansible_config_template: ansible.cfg.j2 | ||
# rakefile_template: rakefile.j2 | ||
|
||
# # ssh arguments passed to `molecule login` command | ||
# raw_ssh_args: | ||
# - -o StrictHostKeyChecking=no | ||
# - -o UserKnownHostsFile=/dev/null | ||
|
||
# # sequence of commands to run when performing `molecule test` | ||
test: | ||
sequence: | ||
- destroy | ||
- create | ||
- converge | ||
# - idempotence | ||
- verify | ||
|
||
# configuration options for the internal call to ansible-playbook | ||
ansible: | ||
# # by default this lives under molecule_dir and is generated by molecule during execution | ||
# config_file: ansible.cfg | ||
|
||
# # playbook to execute during `molecule converge` | ||
playbook: tests/test.yml | ||
|
||
# # install role dependencies from that file with `ansible-galaxy` during `molecule converge` | ||
# requirements_file: requirements.yml | ||
|
||
# # verbosity for ansible-playbook | ||
# verbose: vvvv | ||
|
||
# # most CLI options to ansible-playbook can be passed in this format, even those not listed | ||
# user: vagrant | ||
# connection: ssh | ||
# timeout: 30 | ||
# sudo: True | ||
# sudo_user: False | ||
# ask_sudo_pass: False | ||
# ask_vault_pass: False | ||
# vault_password_file: False | ||
# limit: all | ||
# diff: True | ||
# tags: False | ||
host_key_checking: False | ||
|
||
# # this can be the path to a custom inventory script/directory | ||
# # by default this lives under molecule_dir and is generated by molecule during execution | ||
# inventory_file: ansible_inventory | ||
|
||
# # raw ssh arguments passed to ansible-playbook | ||
# raw_ssh_args: | ||
# - -o UserKnownHostsFile=/dev/null | ||
# - -o IdentitiesOnly=yes | ||
# - -o ControlMaster=auto | ||
# - -o ControlPersist=60s | ||
|
||
# # any additional environment variables that ansible-playbook supports can be passed in here | ||
# raw_env_vars: | ||
# ANSIBLE_ACTION_PLUGINS: ../plugins | ||
|
||
# configuration options for the internal call to vagrant | ||
vagrant: | ||
# vagrant arguments that are global to all instances | ||
raw_config_args: | ||
- "ssh.insert_key = false" | ||
# - "vm.network 'forwarded_port', guest: 80, host: 8080" | ||
|
||
# molecule's --platform option will look for these names | ||
platforms: | ||
- name: trusty64 | ||
box: trusty64 | ||
box_url: https://vagrantcloud.com/ubuntu/boxes/trusty64/versions/14.04/providers/virtualbox.box | ||
- name: centos72 | ||
box: bento/centos-7.2 | ||
|
||
providers: | ||
- name: virtualbox | ||
type: virtualbox | ||
# options: | ||
# memory: 512 | ||
# cpus: 2 | ||
|
||
instances: | ||
- name: kapacitor-01 | ||
ansible_groups: | ||
- kapacitor | ||
interfaces: | ||
- network_name: private_network | ||
type: dhcp | ||
auto_config: true | ||
options: | ||
# prevents vagrant-01 from becoming vagrant-01-rhel-7 (platform is appended by default) | ||
append_platform_to_hostname: no | ||
# vagrant arguments specific to this instance | ||
# raw_config_args: | ||
# - "vm.synced_folder '../projects/web', '/web'" | ||
|
||
# - name: network-01 | ||
# ansible_groups: | ||
# - group_1 | ||
# - group_2 | ||
# interfaces: | ||
# - network_name: private_network | ||
# type: dhcp | ||
# auto_config: true | ||
# - network_name: private_network | ||
# type: dhcp | ||
# auto_config: false | ||
# options: | ||
# append_platform_to_hostname: no |
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
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,29 @@ | ||
--- | ||
- hosts: all | ||
remote_user: root | ||
vars: | ||
- influxdb_install_version: | ||
roles: | ||
- role: ansible-kapacitor | ||
influxdb_install_version: stable | ||
kapacitor_tasks_to_enable: | ||
- name: cpu_alert | ||
type: stream | ||
tick: cpu_alert.tick | ||
dbrp: telegraf.default | ||
- name: cpu_alert_batch | ||
type: batch | ||
tick: cpu_alert_batch.tick | ||
dbrp: telegraf.default | ||
- name: disk_alert | ||
type: stream | ||
tick: disk_alert.tick | ||
dbrp: telegraf.default | ||
kapacitor_influxdb_subscriptions: | ||
- name: test_db | ||
rps: | ||
- rp_test_db | ||
- name: test_db_2 | ||
rps: | ||
- rp_test_db_one | ||
- rp_test_db_two |
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,19 @@ | ||
|
||
def test_kapacitor_running_and_enabled(Service): | ||
kapacitor = Service("kapacitor") | ||
assert kapacitor.is_running | ||
assert kapacitor.is_enabled | ||
|
||
def test_kapacitor_config(File): | ||
kapacitor_config = File("/etc/kapacitor/kapacitor.conf") | ||
assert kapacitor_config.exists | ||
assert 'test_db = ["rp_test_db"]' in kapacitor_config.content_string | ||
assert 'test_db_2 = ["rp_test_db_one", "rp_test_db_two"]' in kapacitor_config.content_string | ||
|
||
def test_tick_file(File): | ||
tick_script = File("/tmp/cpu_alert.tick") | ||
assert tick_script.exists | ||
|
||
def test_tick_load(Command): | ||
tick_load = Command("kapacitor list tasks") | ||
assert "cpu_alert" in tick_load.stdout |
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