Skip to content

Commit

Permalink
Ansible for AWS, terraform for AWS
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-szabo committed Jun 15, 2018
1 parent a2b9ab7 commit 6dcbd62
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ localnet-stop:

TESTNET_NAME?=remotenet
SERVERS?=4
BINARY=$(CURDIR)/build/gaiad
BINARY?=$(CURDIR)/build/gaiad
remotenet-start:
@if [ -z "$(DO_API_TOKEN)" ]; then echo "DO_API_TOKEN environment variable not set." ; false ; fi
@if ! [ -f $(HOME)/.ssh/id_rsa.pub ]; then ssh-keygen ; fi
Expand Down Expand Up @@ -188,7 +188,7 @@ awsnet-start:

awsnet-stop:
cd networks/remote/terraform-aws && terraform destroy -force -var SSH_PUBLIC_FILE="$(HOME)/.ssh/id_rsa.pub" -var SSH_PRIVATE_FILE="$(HOME)/.ssh/id_rsa"
rm -rf networks/remote/ansible/keys/
rm -rf networks/remote/ansible/keys/ networks/remote/ansible/files/

awsnet-status:
cd networks/remote/ansible && ansible-playbook -i inventory/ec2.py -l "tag_Environment_$(TESTNET_NAME)" status.yml
Expand Down
1 change: 1 addition & 0 deletions networks/remote/ansible/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.retry
files/*
keys/*
19 changes: 10 additions & 9 deletions networks/remote/ansible/roles/setup-validators/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
args:
creates: /home/gaiad/.gaiad/config/gentx

- name: Get wallet word seed
- name: Get wallet word seed from result of initial transaction locally
when: gentxresult["changed"]
shell: "echo '{{gentxresult.stdout}}' | python -c 'import json,string,sys ; print json.loads(string.join(sys.stdin.readlines()))[\"app_message\"][\"secret\"]'"
changed_when: false
register: walletkey
connection: local

- name: Write wallet word seed to file
- name: Write wallet word seed to local files
when: gentxresult["changed"]
copy: "content={{walletkey.stdout}} dest=keys/node{{nodeid.stdout_lines[0]}}"
become: no
Expand All @@ -48,18 +48,19 @@
connection: local
run_once: yes

- name: Get gen-tx
- name: Get gen-tx file
fetch:
dest: files/
src: "/home/gaiad/.gaiad/config/gentx/{{gentxfile.stdout_lines[0]}}"
flat: yes

- name: Copy generated transactions to all nodes
copy:
src: files/
dest: /home/gaiad/.gaiad/config/gentx/
become: yes
become_user: gaiad
- name: Compress gathered gen-tx files locally
archive: path=files/ exclude_path=files/gen-tx.tgz dest=files/gen-tx.tgz
run_once: yes
connection: local

- name: Unpack gen-tx archive
unarchive: src=files/gen-tx.tgz dest=/home/gaiad/.gaiad/config/gentx owner=gaiad

- name: Generate genesis.json
command: "/usr/bin/gaiad init --gen-txs --name=node{{nodeid.stdout_lines[0]}} --chain-id={{TESTNET_NAME}}"
Expand Down
1 change: 1 addition & 0 deletions networks/remote/terraform-aws/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
terraform.tfstate
terraform.tfstate.backup
terraform.tfstate.d
.terraform.tfstate.lock.info
4 changes: 2 additions & 2 deletions networks/remote/terraform-aws/nodes/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ resource "aws_security_group" "secgroup" {
}

ingress {
from_port = 46656
to_port = 46657
from_port = 26656
to_port = 26657
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
Expand Down
2 changes: 2 additions & 0 deletions networks/remote/terraform/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
terraform.tfstate
terraform.tfstate.backup
terraform.tfstate.d
.terraform.tfstate.lock.info

0 comments on commit 6dcbd62

Please sign in to comment.