@@ -66,7 +66,7 @@ Parameters:
6666 AdminNodeAmiId :
6767 Description : AMI for the Admin Node
6868 Type : ' AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
69- Default : ' /aws/service/ami-amazon-linux-latest/amzn2 -ami-hvm-x86_64-gp2 '
69+ Default : ' /aws/service/ami-amazon-linux-latest/al2023 -ami-kernel-default-x86_64 '
7070
7171Transform : AWS::Serverless-2016-10-31
7272
@@ -387,7 +387,6 @@ Resources:
387387 samba-common-tools : []
388388 krb5-workstation : []
389389 openldap-clients : []
390- policycoreutils-python : []
391390 openssl : []
392391 Properties :
393392 IamInstanceProfile :
@@ -416,25 +415,25 @@ Resources:
416415 echo "Domain Name: ${DirectoryDomain}"
417416 echo "Domain Certificate Secret: ${DomainCertificateSecretArn}"
418417 echo "Domain Private Key Secret: ${DomainPrivateKeySecretArn}"
419- cat << EOF > /etc/resolv.conf
420- search ${DirectoryDomain}
421- nameserver ${DnsIp1}
422- nameserver ${DnsIp2}
418+
419+ mkdir -p /etc/systemd/resolved.conf.d
420+ cat << EOF > /etc/systemd/resolved.conf.d/pcluster-ad-domain-dns-server.conf
421+ [Resolve]
422+ DNS=${DnsIp1} ${DnsIp2}
423+ Domains=~.
423424 EOF
424- sed -i 's/PEERDNS=.*/PEERDNS=no/' /etc/sysconfig/network-scripts/ifcfg-eth0
425- chattr +i /etc/resolv.conf
425+ service systemd-resolved restart
426+
426427 ADMIN_PW="${AdminPassword}"
427428
428429 attempt=0
429430 max_attempts=5
430431 until [ $attempt -ge $max_attempts ]; do
431432 attempt=$((attempt+1))
432- echo "[DEBUG] Content of /etc/resolv.conf is:"
433- cat /etc/resolv.conf
434- echo "[DEBUG] Resolving ${DirectoryDomain} ..."
435- dig ${DirectoryDomain}
433+ echo "[DEBUG] Checking domain name resolution for ${DirectoryDomain} ..."
434+ dig ${DirectoryDomain}
436435 echo "Joining domain (attempt $attempt/$max_attempts) ..."
437- echo "$ADMIN_PW" | sudo realm join -U "${Admin}" "${DirectoryDomain} --verbose" && echo "Domain joined" && break
436+ echo "$ADMIN_PW" | sudo realm join -U "${Admin}" "${DirectoryDomain}" --verbose && echo "Domain joined" && break
438437 sleep 10
439438 done
440439
0 commit comments