You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/02/27 00:11:27 UTC

[GitHub] merlimat closed pull request #1290: Fix Terraform/Ansible docs

merlimat closed pull request #1290: Fix Terraform/Ansible docs
URL: https://github.com/apache/incubator-pulsar/pull/1290
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.gitignore b/.gitignore
index dd1d1bf4c..aa6ed821b 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 e00db17ce..8807c29ad 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 d353262e3..2eb872929 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 4786ec7ab..02263a482 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 779e2e5f1..c78c0dc9f 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 db6ca30e1..784e0caa8 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 f2b6d7542..1f1e26150 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 000000000..65f4ea528
--- /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 1f91753e1..56a7fae47 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 7e9b96712..df95c5c50 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


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services