Skip to content

Commit bf28b9e

Browse files
committed
Updated to RHEL, added variables for ssh_key and ssh_pubkey
1 parent 1beee9d commit bf28b9e

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

terraform/apache.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
- hosts: apache
3+
tasks:
4+
- name: run

terraform/main.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,14 @@ resource "azurerm_virtual_machine" "site" {
102102
}
103103

104104
os_profile_linux_config {
105-
disable_password_authentication = false
105+
disable_password_authentication = true
106+
ssh_keys {
107+
path = "/home/${var.admin_username}/.ssh/authorized_keys"
108+
key_data = "${var.ssh_pubkey}"
109+
}
106110
}
107111

112+
# TODO: have Dylan help with apache.yml playbook
108113
provisioner "local-exec" {
109114
command = "ansible-playbook -i '${self.public_ip},' --private-key ${var.ssh_key} apache.yml"
110115
}

terraform/variables.tf

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ variable "ssh_key" {
99
description = "SSH key for connecting to our Red Hat instance"
1010
}
1111

12+
variable "ssh_pubkey" {
13+
description = "Public half of SSH key for connecting to our Red Hat instance."
14+
}
15+
1216
variable "resource_group" {
1317
description = "The name of your Azure Resource Group."
1418
default = "Terraform-Azure-Beginners"
@@ -61,17 +65,17 @@ variable "vm_size" {
6165

6266
variable "image_publisher" {
6367
description = "Name of the publisher of the image (az vm image list)"
64-
default = "Canonical"
68+
default = "RedHat"
6569
}
6670

6771
variable "image_offer" {
6872
description = "Name of the offer (az vm image list)"
69-
default = "UbuntuServer"
73+
default = "RHEL"
7074
}
7175

7276
variable "image_sku" {
7377
description = "Image SKU to apply (az vm image list)"
74-
default = "16.04-LTS"
78+
default = "7.3"
7579
}
7680

7781
variable "image_version" {

0 commit comments

Comments
 (0)