Automation and setup for sites I own.
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

77 líneas
1.9 KiB

  1. resource "null_resource" "post_setup" {
  2. depends_on = [ linode_instance.prod ]
  3. connection {
  4. host = linode_instance.prod.ip_address
  5. user = "root"
  6. private_key = file("~/.ssh/id_rsa")
  7. }
  8. provisioner "remote-exec" {
  9. inline = [<<FIN
  10. apk update
  11. apk upgrade
  12. apk add iproute2 sqlite bind-tools tar xz
  13. sed -i -e 's/AllowTcpForwarding .*/AllowTcpForwarding yes/g' /etc/ssh/sshd_config
  14. rc-service sshd restart
  15. FIN
  16. ]
  17. }
  18. }
  19. resource "null_resource" "nginx_install" {
  20. depends_on = [ null_resource.post_setup ]
  21. connection {
  22. host = linode_instance.prod.ip_address
  23. user = "root"
  24. private_key = file("~/.ssh/id_rsa")
  25. }
  26. provisioner "file" {
  27. source = "http-default.conf"
  28. destination = "/tmp/http-default.conf"
  29. }
  30. provisioner "remote-exec" {
  31. inline = [<<FIN
  32. flock -x /tmp/apk -c 'apk add nginx'
  33. [ -e /etc/nginx/conf.d/default.conf ] && mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.disable
  34. install -m644 /tmp/http-default.conf /etc/nginx/conf.d/http-default.conf
  35. install -dm755 /var/www/default/htdocs /var/www/.well-known/acme-challenge
  36. echo todo write more stuff > /var/www/default/htdocs/index.html
  37. rc-update add nginx default
  38. rc-service nginx restart
  39. rm /tmp/http-default.conf
  40. FIN
  41. ]
  42. }
  43. }
  44. resource "null_resource" "uacme_install" {
  45. depends_on = [ null_resource.post_setup ]
  46. connection {
  47. host = linode_instance.prod.ip_address
  48. user = "root"
  49. private_key = file("~/.ssh/id_rsa")
  50. }
  51. provisioner "remote-exec" {
  52. inline = [<<FIN
  53. flock -x /tmp/apk -c 'apk add muacme'
  54. FIN
  55. ]
  56. }
  57. }
  58. resource "null_resource" "gitea_install" {
  59. depends_on = [ null_resource.post_setup ]
  60. connection {
  61. host = linode_instance.prod.ip_address
  62. user = "root"
  63. private_key = file("~/.ssh/id_rsa")
  64. }
  65. provisioner "remote-exec" {
  66. inline = [<<FIN
  67. flock -x /tmp/apk -c 'apk add gitea'
  68. FIN
  69. ]
  70. }
  71. }