diff --git a/aws/ec2.tf b/aws/ec2.tf index 217a524..eb1f449 100644 --- a/aws/ec2.tf +++ b/aws/ec2.tf @@ -153,8 +153,8 @@ resource "aws_instance" "test_femiwiki" { } tags = { - Name = "Test Server" - consul-cloud-auto-join = "true" + Name = "Test Server" + ConsulAutoJoin = "auto-join" } lifecycle { diff --git a/aws/res/consul.hcl b/aws/res/consul.hcl index 0ac22e6..260bf71 100644 --- a/aws/res/consul.hcl +++ b/aws/res/consul.hcl @@ -7,7 +7,7 @@ acl { server = true node_name = "femiwiki" -advertise_addr = "IP_ADDRESS" +advertise_addr = "{{GetInterfaceIP \"ens5\"}}" bind_addr = "0.0.0.0" client_addr = "0.0.0.0" bootstrap = true diff --git a/aws/res/consul.service b/aws/res/consul.service deleted file mode 100644 index 1d99d2a..0000000 --- a/aws/res/consul.service +++ /dev/null @@ -1,23 +0,0 @@ -# https://learn.hashicorp.com/tutorials/consul/deployment-guide#configure-systemd -# https://github.com/hashicorp/consul/blob/v1.19.2/.release/linux/package/usr/lib/systemd/system/consul.service -[Unit] -Description="HashiCorp Consul - A service mesh solution" -Documentation=https://www.consul.io/ -Requires=network-online.target -After=network-online.target -ConditionFileNotEmpty=/etc/consul.d/consul.hcl - -[Service] -Type=notify -EnvironmentFile=-/etc/consul.d/consul.env -User=root -Group=root -ExecStart=/usr/bin/consul agent -config-dir=/etc/consul.d/ -ExecReload=/bin/kill --signal HUP \$MAINPID -KillMode=process -KillSignal=SIGTERM -Restart=on-failure -LimitNOFILE=65536 - -[Install] -WantedBy=multi-user.target diff --git a/aws/res/nomad.service b/aws/res/nomad.service deleted file mode 100644 index 13c7033..0000000 --- a/aws/res/nomad.service +++ /dev/null @@ -1,20 +0,0 @@ -# https://learn.hashicorp.com/tutorials/nomad/production-deployment-guide-vm-with-consul#configure-systemd -# https://github.com/hashicorp/terraform-aws-nomad/blob/master/modules/run-nomad/run-nomad -[Unit] -Description="HashiCorp Nomad" -Documentation=https://www.nomadproject.io/ -Requires=network-online.target -After=network-online.target -ConditionFileNotEmpty=/etc/nomad.d/default.hcl - -[Service] -ExecStart=/usr/bin/nomad agent -config /etc/nomad.d -ExecReload=/bin/kill -HUP \$MAINPID -KillMode=process -Restart=on-failure -LimitNOFILE=65536 -User=root -Group=root - -[Install] -WantedBy=multi-user.target diff --git a/aws/res/user-data.sh.tftpl b/aws/res/user-data.sh.tftpl index 33bd952..46f09af 100644 --- a/aws/res/user-data.sh.tftpl +++ b/aws/res/user-data.sh.tftpl @@ -156,8 +156,6 @@ dnf install -y "consul-$${CONSUL_VERSION}" cat </etc/consul.d/consul.hcl ${consul_config} EOF -IP_ADDRESS=$(curl http://instance-data/latest/meta-data/local-ipv4) -sed -i "s/IP_ADDRESS/$IP_ADDRESS/g" /etc/consul.d/consul.hcl dnf install -y consul-cni-$${CONSUL_CNI_VERSION}