41 lines
1.2 KiB
HCL
41 lines
1.2 KiB
HCL
## NEED a provider
|
|
# use in root module:
|
|
#
|
|
# module "postinstall" {
|
|
# source "../alpine_postinstall"
|
|
# connexion_ip = var.eth0_ip
|
|
# connexion_private_key = var.pm_private_key
|
|
# }
|
|
|
|
resource "null_resource" "alpine_postinstall" {
|
|
connection {
|
|
type = "ssh"
|
|
user = "root"
|
|
host = var.connection_ip
|
|
private_key = var.connection_private_key
|
|
}
|
|
provisioner "remote-exec" {
|
|
inline = [
|
|
# see https://git.alpinelinux.org/aports/tree/main/
|
|
"echo '#--------------------------'",
|
|
"echo '# module alpine_postinstall'",
|
|
"echo '#--------------------------'",
|
|
"apk add file man-pages tzdata bash htop vim less",
|
|
"echo '# install service openssh-server'",
|
|
"apk add openssh-server",
|
|
#
|
|
"echo '# stop and disable service crond'",
|
|
"rc-service crond stop",
|
|
"rc-update del crond",
|
|
#
|
|
"echo '# bricoler le service syslog'",
|
|
"rc-service syslog stop",
|
|
"echo '# limiter a 10 fichiers messages.* de 100k max' > /etc/conf.d/syslog",
|
|
"echo 'SYSLOGD_OPTS=\"-t -D -s100 -b10 -l6\"' >> /etc/conf.d/syslog",
|
|
"rm -f /var/log/messages",
|
|
"rc-service syslog start",
|
|
]
|
|
}
|
|
}
|
|
|