feat: render inspec.sh runnner script
This commit is contained in:
parent
24fcb154eb
commit
4d374c336b
2 changed files with 29 additions and 1 deletions
18
conf.tf
18
conf.tf
|
@ -34,7 +34,7 @@ variable "loadbalance_count" {
|
|||
|
||||
|
||||
variable "libreddit_count" {
|
||||
default = 4
|
||||
default = 2
|
||||
}
|
||||
|
||||
|
||||
|
@ -208,3 +208,19 @@ resource "local_file" "nginx_loadbalance_conf" {
|
|||
|
||||
filename = "./ansible/assets/nginx.cfg"
|
||||
}
|
||||
|
||||
resource "local_file" "auditor_script" {
|
||||
content = templatefile("./templates/auditor.tftpl",
|
||||
{
|
||||
libreddit_vm_ips = local.libreddit_vm_ips,
|
||||
libreddit_vm_names = local.libreddit_vm_names,
|
||||
libreddit_vms = local.libreddit_vm_map,
|
||||
|
||||
loadbalance_vm_ips = local.loadbalance_vm_ips,
|
||||
loadbalance_vm_names = local.loadbalance_vm_names,
|
||||
loadbalance_vms = local.loadbalance_vm_map
|
||||
|
||||
})
|
||||
|
||||
filename = "./inspec.sh"
|
||||
}
|
||||
|
|
12
templates/auditor.tftpl
Normal file
12
templates/auditor.tftpl
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
%{ for vm in loadbalance_vms ~}
|
||||
cinc-auditor exec ./inspec/linux-baseline -t ssh://atm@${vm.ip} # ${vm.name}
|
||||
cinc-auditor exec ./inspec/ssh-baseline -t ssh://atm@${vm.ip} # ${vm.name}
|
||||
cinc-auditor exec ./inspec/nginx-baseline -t ssh://atm@${vm.ip} # ${vm.name}
|
||||
%{ endfor ~}
|
||||
|
||||
%{ for vm in libreddit_vms ~}
|
||||
cinc-auditor exec ./inspec/linux-baseline -t ssh://atm@${vm.ip} # ${vm.name}
|
||||
cinc-auditor exec ./inspec/ssh-baseline -t ssh://atm@${vm.ip} # ${vm.name}
|
||||
%{ endfor ~}
|
Loading…
Reference in a new issue