module_alpine_rsyslog/main.tf

37 lines
883 B
HCL

resource "null_resource" "rsyslog" {
connection {
type = "ssh"
user = "root"
host = var.connection_ip
private_key = var.connection_private_key
}
provisioner "file" {
source = "${path.module}/rsyslog.conf"
destination = "/tmp/rsyslog.conf"
}
# execute postinstall script
provisioner "remote-exec" {
inline = [
"echo '# install rsyslog'",
"apk add --no-cache rsyslog",
#
"echo '# disable service syslog'",
"rc-service syslog stop",
"rc-update del syslog",
"rc-update del syslog boot",
#
"echo '# configuration service rsyslog'",
"rc-service rsyslog stop",
"mv /tmp/rsyslog.conf /etc/rsyslog.conf",
"rc-service rsyslog start",
"rc-update add rsyslog boot",
#
"echo;echo '# VM must be restarted to clean syslogd'",
]
}
}