Last active
August 29, 2015 14:26
-
-
Save jollyrojer/045aed793de586c8db9f to your computer and use it in GitHub Desktop.
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
application: | |
configuration: | |
input.recipe-url: "https://dl.dropboxusercontent.com/u/250836/zabbix-cookbooks.tar.gz" | |
input.image: { "ami": "us-east-1/ami-8997afe0", "user": "root", "type": "linux", "hw": "m1.small" } | |
input.image-prefix: "Zabbix" | |
bindings: | |
- [zabbix, database] | |
interfaces: | |
input: | |
recipe-url: bind(zabbix#input.recipe-url) | |
image: bind(zabbix#input.image) | |
image-prefix: bind(zabbix#input.image-prefix) | |
output: | |
host: bind(zabbix#result.zabbix_host) | |
components: | |
zabbix: | |
type: workflow.Instance | |
interfaces: | |
input: | |
image: configuration(map<string, object>) | |
image-prefix: configuration(string) | |
recipe-url: configuration(string) | |
mysql: | |
dbms: | |
type: consume-signal(object) | |
db-host: | |
type: consume-signal(string) | |
db-port: | |
type: consume-signal(int) | |
schema: | |
type: send-command(string db-user, string db-user-password, list<string> db-user-privileges => object connection) | |
file-query: | |
type: send-command(object connection, list<string> sql-url) | |
result: | |
zabbix_host: | |
type: publish-signal(string) | |
name: Zabbix Host | |
required: [ mysql ] | |
configuration: | |
configuration.workflows: | |
launch: | |
steps: | |
- get-env-props: | |
action: getEnvironmentProperties | |
phase: get-env-props | |
output: | |
props: result | |
- provision: | |
action: provisionVms | |
parameters: | |
hardwareId: "{$.image.hw}" | |
imageId: "{$.image.ami}" | |
vmIdentity: "{$.image.user}" | |
jcloudsNodeNamePrefix: "{$.image-prefix}" | |
roleName: default | |
output: | |
ips: ips | |
- hostname: | |
action: execrun | |
precedingPhases: [ provision ] | |
parameters: | |
roles: [ default ] | |
command: | |
- bash | |
- "-c" | |
- | | |
hostname `curl -s http://169.254.169.254/latest/meta-data/public-hostname` && | |
echo "`hostname -i` `hostname` `hostname -s`" >> /etc/hosts && | |
hostname | |
output: | |
dns: stdout | |
- generate-db-password: | |
action: execrun | |
precedingPhases: [ provision ] | |
parameters: | |
roles: [ default ] | |
command: | |
- openssl rand -hex 10 | |
output: | |
pwout: stdout | |
- manage-schema: | |
action: mysql.schema | |
precedingPhases: [ "generate-db-password" , hostname ] | |
parameters: | |
commandCallTimeout: 5 minutes | |
db-user: "zabbix" | |
db-user-password: "{$.pwout[*][0]}" | |
db-user-privileges: ["all"] | |
output: | |
con: connection | |
- install-prerequisites: | |
action: execrun | |
precedingPhases: [ manage-schema ] | |
parameters: | |
roles: [ default ] | |
command: | |
- yum install -y mysql mysql-devel php-mysql | |
- install-zabbix: | |
action: chefsolo | |
precedingPhases: [ install-prerequisites ] | |
parameters: | |
#version: "11.16.2" | |
version: "12.4.1" | |
roles: [ default ] | |
recipeUrl: "{$.recipe-url}" | |
runList: [ "recipe[build-essential]", "recipe[zabbix::server_common]", "recipe[zabbix::server]" ] | |
jattrs: | |
mysql: | |
server_root_password: "{$.props.mysql.dbms.db-root-password}" | |
zabbix: | |
server: | |
version: "2.2.9" | |
install_method: "prebuild" | |
database: | |
dbhost: "{$.con.db-host}" | |
dbname: "{$.con.db-name}" | |
dbuser: "{$.con.db-user}" | |
dbpassword: "{$.con.db-user-password}" | |
web: | |
fqdn: "{$.dns[*][0]}" | |
agent: | |
servers: "{$.dns[*][0]}" | |
return: | |
zabbix_host: | |
value: "{$.dns[*][0]}" | |
database: | |
type: reference.Submodule | |
configuration: | |
__locator.application-id: "Database" | |
interfaces: | |
input: | |
db-port: | |
type: configuration(int) | |
name: Database port | |
db-root-password: | |
type: configuration(string) | |
name: Database root password | |
mysql: | |
schema: | |
type: receive-command(string db-user, string db-user-password, list<string> db-user-privileges => object connection) | |
name: Manage schema | |
file-query: | |
type: receive-command(list<string> sql-url, object connection) | |
name: Run a SQL query | |
dbms: | |
type: publish-signal(object) | |
name: Database parameters | |
db-host: | |
type: publish-signal(string) | |
name: Database host | |
db-port: | |
type: publish-signal(int) | |
name: Database port |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment