This is an automated email from the ASF dual-hosted git repository. mmerli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git
The following commit(s) were added to refs/heads/master by this push: new 3739567 Fix Terraform/Ansible docs (#1290) 3739567 is described below commit 3739567c80c6b4999b2414c62a6ae99701fe6967 Author: Luc Perkins <lucperk...@gmail.com> AuthorDate: Mon Feb 26 16:11:25 2018 -0800 Fix Terraform/Ansible docs (#1290) * remove separate BK systemd service * add tfvars file, reformat terraform configs, and update docs * update docs with --user=ec2-user flag * fix jq command in docs * update pulsar version in ansible playbook config * revert changes to .service files * revert ansible config --- .gitignore | 3 ++- deployment/terraform-ansible/aws/ansible.cfg | 3 +-- deployment/terraform-ansible/aws/instances.tf | 12 ++++++------ deployment/terraform-ansible/aws/keys.tf | 2 +- deployment/terraform-ansible/aws/network.tf | 12 ++++++------ deployment/terraform-ansible/aws/output.tf | 2 +- deployment/terraform-ansible/aws/security.tf | 2 +- deployment/terraform-ansible/aws/terraform.tfvars | 12 ++++++++++++ deployment/terraform-ansible/aws/variables.tf | 2 +- site/docs/latest/deployment/aws-cluster.md | 8 +++++--- 10 files changed, 36 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index dd1d1bf..aa6ed82 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ generated-site/ # Ansible and Terraform artifacts deployment/terraform-ansible/deploy-pulsar.retry -deployment/terraform-ansible/aws/terraform* deployment/terraform-ansible/aws/.terraform/ deployment/terraform-ansible/aws/.terraform.tfstate.lock.info +deployment/terraform-ansible/aws/terraform.tfstate +deployment/terraform-ansible/aws/terraform.tfstate.backup diff --git a/deployment/terraform-ansible/aws/ansible.cfg b/deployment/terraform-ansible/aws/ansible.cfg index e00db17..8807c29 100644 --- a/deployment/terraform-ansible/aws/ansible.cfg +++ b/deployment/terraform-ansible/aws/ansible.cfg @@ -18,9 +18,8 @@ # [defaults] -private_key_file=~/.ssh/pulsar_aws +private_key_file=~/.ssh/id_rsa host_key_checking=false -user='ec2-user' [privilege_escalation] become=True diff --git a/deployment/terraform-ansible/aws/instances.tf b/deployment/terraform-ansible/aws/instances.tf index d353262..2eb8729 100644 --- a/deployment/terraform-ansible/aws/instances.tf +++ b/deployment/terraform-ansible/aws/instances.tf @@ -31,12 +31,12 @@ resource "aws_instance" "zookeeper" { } resource "aws_instance" "pulsar" { - ami = "${var.aws_ami}" - instance_type = "${var.instance_types["pulsar"]}" - key_name = "${aws_key_pair.default.id}" - subnet_id = "${aws_subnet.default.id}" - vpc_security_group_ids = ["${aws_security_group.default.id}"] - count = "${var.num_pulsar_brokers}" + ami = "${var.aws_ami}" + instance_type = "${var.instance_types["pulsar"]}" + key_name = "${aws_key_pair.default.id}" + subnet_id = "${aws_subnet.default.id}" + vpc_security_group_ids = ["${aws_security_group.default.id}"] + count = "${var.num_pulsar_brokers}" tags { Name = "pulsar-${count.index + 1}" diff --git a/deployment/terraform-ansible/aws/keys.tf b/deployment/terraform-ansible/aws/keys.tf index 4786ec7..02263a4 100644 --- a/deployment/terraform-ansible/aws/keys.tf +++ b/deployment/terraform-ansible/aws/keys.tf @@ -25,4 +25,4 @@ resource "random_id" "key_pair_name" { resource "aws_key_pair" "default" { key_name = "${random_id.key_pair_name.hex}" public_key = "${file(var.public_key_path)}" -} \ No newline at end of file +} diff --git a/deployment/terraform-ansible/aws/network.tf b/deployment/terraform-ansible/aws/network.tf index 779e2e5..c78c0dc 100644 --- a/deployment/terraform-ansible/aws/network.tf +++ b/deployment/terraform-ansible/aws/network.tf @@ -59,7 +59,7 @@ resource "aws_route_table_association" "default" { /* Misc */ resource "aws_eip" "default" { - vpc = true + vpc = true depends_on = ["aws_internet_gateway.default"] } @@ -90,10 +90,10 @@ resource "aws_route" "internet_access" { /* Load balancer */ resource "aws_elb" "default" { - name = "pulsar-elb" - instances = ["${aws_instance.pulsar.*.id}"] - security_groups = ["${aws_security_group.elb.id}"] - subnets = ["${aws_subnet.default.id}"] + name = "pulsar-elb" + instances = ["${aws_instance.pulsar.*.id}"] + security_groups = ["${aws_security_group.elb.id}"] + subnets = ["${aws_subnet.default.id}"] listener { instance_port = 8080 @@ -114,4 +114,4 @@ resource "aws_elb" "default" { tags { Name = "Pulsar-Load-Balancer" } -} \ No newline at end of file +} diff --git a/deployment/terraform-ansible/aws/output.tf b/deployment/terraform-ansible/aws/output.tf index db6ca30..784e0ca 100644 --- a/deployment/terraform-ansible/aws/output.tf +++ b/deployment/terraform-ansible/aws/output.tf @@ -31,4 +31,4 @@ output "pulsar_web_url" { output "pulsar_ssh_host" { value = "${aws_instance.pulsar.0.public_ip}" -} \ No newline at end of file +} diff --git a/deployment/terraform-ansible/aws/security.tf b/deployment/terraform-ansible/aws/security.tf index f2b6d75..1f1e261 100644 --- a/deployment/terraform-ansible/aws/security.tf +++ b/deployment/terraform-ansible/aws/security.tf @@ -74,4 +74,4 @@ resource "aws_security_group" "default" { tags { Name = "Pulsar-Security-Group" } -} \ No newline at end of file +} diff --git a/deployment/terraform-ansible/aws/terraform.tfvars b/deployment/terraform-ansible/aws/terraform.tfvars new file mode 100644 index 0000000..65f4ea5 --- /dev/null +++ b/deployment/terraform-ansible/aws/terraform.tfvars @@ -0,0 +1,12 @@ +public_key_path = "~/.ssh/id_rsa.pub" +region = "us-west-2" +availability_zone = "us-west-2a" +aws_ami = "ami-9fa343e7" +num_zookeeper_nodes = 3 +num_pulsar_brokers = 3 +base_cidr_block = "10.0.0.0/16" + +instance_types = { + "pulsar" = "i3.xlarge" + "zookeeper" = "t2.small" +} diff --git a/deployment/terraform-ansible/aws/variables.tf b/deployment/terraform-ansible/aws/variables.tf index 1f91753..56a7fae 100644 --- a/deployment/terraform-ansible/aws/variables.tf +++ b/deployment/terraform-ansible/aws/variables.tf @@ -59,4 +59,4 @@ variable "instance_types" { variable "base_cidr_block" { description = "The baseline CIDR block to be used by network assets for the Pulsar cluster" -} \ No newline at end of file +} diff --git a/site/docs/latest/deployment/aws-cluster.md b/site/docs/latest/deployment/aws-cluster.md index 7e9b967..df95c5c 100644 --- a/site/docs/latest/deployment/aws-cluster.md +++ b/site/docs/latest/deployment/aws-cluster.md @@ -90,11 +90,11 @@ Variable name | Description | Default `public_key_path` | The path of the public key that you've generated. | `~/.ssh/id_rsa.pub` `region` | The AWS region in which the Pulsar cluster will run | `us-west-2` `availability_zone` | The AWS availability zone in which the Pulsar cluster will run | `us-west-2a` -`ami` | The [Amazon Machine Image](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html) (AMI) that will be used by the cluster | `ami-9fa343e7` +`aws_ami` | The [Amazon Machine Image](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html) (AMI) that will be used by the cluster | `ami-9fa343e7` `num_zookeeper_nodes` | The number of [ZooKeeper](https://zookeeper.apache.org) nodes in the ZooKeeper cluster | 3 `num_pulsar_brokers` | The number of Pulsar brokers and BookKeeper bookies that will run in the cluster | 3 `base_cidr_block` | The root [CIDR](http://searchnetworking.techtarget.com/definition/CIDR) that will be used by network assets for the cluster | `10.0.0.0/16` -`instance_types` | The EC2 instance types to be used. This variable is a map with two keys: `zookeeper` for the ZooKeeper instances and `pulsar` for the Pulsar brokers and BookKeeper bookies | `t2.small` (ZooKeeper) and `i3.3xlarge` (Pulsar/BookKeeper) +`instance_types` | The EC2 instance types to be used. This variable is a map with two keys: `zookeeper` for the ZooKeeper instances and `pulsar` for the Pulsar brokers and BookKeeper bookies | `t2.small` (ZooKeeper) and `i3.xlarge` (Pulsar/BookKeeper) ### What is installed @@ -122,7 +122,7 @@ pulsar://pulsar-elb-1800761694.us-west-2.elb.amazonaws.com:6650 You can fetch that value at any time by running `terraform output pulsar_service_url` or parsing the `terraform.tstate` file (which is JSON, even though the filename doesn't reflect that): ```bash -$ cat terraform.tfstate | jq '.modules | .[0].outputs.pulsar_connection_url.value' +$ cat terraform.tfstate | jq .modules[0].outputs.pulsar_service_url.value ``` ### Destroying your cluster @@ -139,6 +139,7 @@ Once you've created the necessary AWS resources using Terraform, you can install ```bash $ ansible-playbook \ + --user='ec2-user' \ --inventory=`which terraform-inventory` \ ../deploy-pulsar.yaml ``` @@ -147,6 +148,7 @@ If you've created a private SSH key at a location different from `~/.ssh/id_rsa` ```bash $ ansible-playbook \ + --user='ec2-user' \ --inventory=`which terraform-inventory` \ --private-key="~/.ssh/some-non-default-key" \ ../deploy-pulsar.yaml -- To stop receiving notification emails like this one, please contact mme...@apache.org.