Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Commit

Permalink
Merge pull request #23 from ripienaar/19.2
Browse files Browse the repository at this point in the history
(#19) use choria broker instead of nats and other small fixes
  • Loading branch information
ripienaar authored Feb 15, 2019
2 parents 5602a04 + 2f80796 commit 096a743
Show file tree
Hide file tree
Showing 10 changed files with 448 additions and 17 deletions.
3 changes: 1 addition & 2 deletions ec2environment/cloud-init/puppet-master.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ runcmd:
- "puppet resource host puppet ensure=present ip=127.0.0.1"
- "echo '*' > /etc/puppetlabs/puppet/autosign.conf"
- "echo role=puppet_master > /opt/puppetlabs/facter/facts.d/role.txt"
- "/opt/puppetlabs/puppet/bin/gem install librarian-puppet --no-ri --no-rdoc"
- "cd /tmp;git clone https://github.com/choria-io/choria-emulator.git"
- "mkdir -p /etc/puppetlabs/code/environments/production"
- "cp -fr /tmp/choria-emulator/ec2environment/puppet/* /etc/puppetlabs/code/environments/production/"
- "cd /etc/puppetlabs/code/environments/production; HOME=/root /opt/puppetlabs/puppet/bin/librarian-puppet install --verbose"
- "cd /etc/puppetlabs/code/environments/production; HOME=/root ./install-modules.sh"
- "puppet config set --section main waitforcert 10"
- "systemctl start puppetserver.service"
- "systemctl start puppet.service"
14 changes: 7 additions & 7 deletions ec2environment/instance-nats.tf
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
resource "template_file" "nats_init" {
resource "template_file" "broker_init" {
template = "${file("cloud-init/common.txt")}"
vars {
puppet_master_ip = "${aws_instance.puppetmaster.private_ip}"
role = "nats"
role = "broker"
}
}

resource "aws_instance" "nats" {
count = "${var.nats_count}"
resource "aws_instance" "broker" {
count = "${var.broker_count}"
ami = "${lookup(var.amis, var.region)}"
instance_type = "t2.medium"
subnet_id = "${aws_subnet.choria_emulator.id}"
vpc_security_group_ids = ["${aws_security_group.internal.id}", "${aws_security_group.management.id}"]
source_dest_check = false
user_data = "${template_file.nats_init.rendered}"
user_data = "${template_file.broker_init.rendered}"
root_block_device {
volume_type = "standard"
volume_size = 8
Expand All @@ -24,7 +24,7 @@ resource "aws_instance" "nats" {
}
}

output "nats" {
value = "${aws_instance.nats.*.public_dns}"
output "broker" {
value = "${aws_instance.broker.*.public_dns}"
}

13 changes: 13 additions & 0 deletions ec2environment/puppet/install-modules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -e

puppet module install choria-choria
puppet module install puppetlabs-apache
puppet module install puppetlabs-ntp
puppet module install puppetlabs-puppetdb
puppet module install puppetlabs-puppet_authorization
puppet module install camptocamp-puppetserver
puppet module install camptocamp-puppetserver --ignore-dependencies
puppet module install saz-limits

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$schema": "https://choria.io/schemas/mcorpc/ddl/v1/agent.json",
"metadata": {
"name": "emulated0",
"description": "Choria Agent emulated by choria-emulator",
"author": "R.I.Pienaar <[email protected]>",
"license": "Apache-2.0",
"version": "0.0.1",
"url": "http://choria.io",
"timeout": 120
},
"actions": [
{
"action": "generate",
"input": {
"size": {
"prompt": "Size",
"description": "Amount of text to generate",
"type": "integer",
"default": 20,
"optional": true
}
},
"output": {
"message": {
"description": "Generated Message",
"display_as": "Message",
"default": null
}
},
"display": "failed",
"description": "Generates random data of a given size"
}
]
}
Loading

0 comments on commit 096a743

Please sign in to comment.