Skip to content

Commit 8693bc1

Browse files
rodriguezsergiobilloneil
authored andcommitted
mount 100GB volume, update /usr/bin/java link (StubbornJava#70)
* mount 100GB volume, update /usr/bin/java link * add common role to ci
1 parent f1dfa6a commit 8693bc1

File tree

4 files changed

+43
-4
lines changed

4 files changed

+43
-4
lines changed

ansible/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
- server_name _
1414
- return 301 https://jenkins.stubbornjava.com$request_uri
1515
roles:
16-
- galaxy_roles/geerlingguy.java
16+
- roles/common
17+
- roles/java
1718
- galaxy_roles/geerlingguy.jenkins
1819
- galaxy_roles/jdauphant.nginx
1920
# - galaxy_roles/gantsign.maven

ansible/roles/java/tasks/main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- include_role:
2+
name: galaxy_roles/geerlingguy.java
3+
4+
- name: point to correct java version
5+
alternatives:
6+
name: java
7+
link: /usr/bin/java
8+
path: /usr/lib/jvm/java-1.8.0-openjdk.x86_64/bin/java

terraform/global.tfvars

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ region = "us-east-1"
22

33
amis = {
44
amazon-linux-2017-09 = "ami-8c1be5f6"
5+
amazon-linux-2017-09.1 = "ami-1853ac65"
56
}

terraform/stubbornjava.tf

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,31 @@ variable "amis" {
99

1010
# TODO: import stubbornjava-webapp
1111

12+
resource "aws_volume_attachment" "ebs_jenkins" {
13+
device_name = "/dev/sdh"
14+
volume_id = "${aws_ebs_volume.jenkins.id}"
15+
instance_id = "${aws_instance.ci.id}"
16+
17+
skip_destroy = true
18+
}
19+
20+
resource "aws_ebs_volume" "jenkins" {
21+
availability_zone = "us-east-1a"
22+
size = 100
23+
type = "gp2"
24+
25+
tags {
26+
Name = "jenkins"
27+
Path = "/var/lib/jenkins"
28+
}
29+
}
30+
1231
resource "aws_instance" "ci" {
1332
count = 1
14-
ami = "${var.amis["amazon-linux-2017-09"]}"
33+
ami = "${var.amis["amazon-linux-2017-09.1"]}"
1534
disable_api_termination = true
1635
iam_instance_profile = "jenkins"
17-
instance_type = "t2.micro"
36+
instance_type = "t2.medium"
1837
monitoring = false
1938
subnet_id = "${element(data.aws_subnet_ids.public.ids, count.index)}"
2039
key_name = "stubbornjava"
@@ -28,7 +47,17 @@ resource "aws_instance" "ci" {
2847

2948
root_block_device {
3049
volume_type = "gp2"
31-
volume_size = 20
50+
volume_size = 10
3251
delete_on_termination = true
3352
}
53+
54+
user_data = <<USER_DATA
55+
#cloud-config
56+
bootcmd:
57+
- [ cloud-init-per, once, mymkfs, mkfs.ext4, /dev/xvdh ]
58+
- [ cloud-init-per, once, createjenkinsdir, mkdir, /var/lib/jenkins ]
59+
60+
mounts:
61+
- [ /dev/xvdh, /var/lib/jenkins, "ext4", "defaults,noatime", "0", "0" ]
62+
USER_DATA
3463
}

0 commit comments

Comments
 (0)