@@ -66,7 +66,7 @@ Parameters:
66
66
AdminNodeAmiId :
67
67
Description : AMI for the Admin Node
68
68
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 '
70
70
71
71
Transform : AWS::Serverless-2016-10-31
72
72
@@ -387,7 +387,6 @@ Resources:
387
387
samba-common-tools : []
388
388
krb5-workstation : []
389
389
openldap-clients : []
390
- policycoreutils-python : []
391
390
openssl : []
392
391
Properties :
393
392
IamInstanceProfile :
@@ -416,25 +415,25 @@ Resources:
416
415
echo "Domain Name: ${DirectoryDomain}"
417
416
echo "Domain Certificate Secret: ${DomainCertificateSecretArn}"
418
417
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=~.
423
424
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
+
426
427
ADMIN_PW="${AdminPassword}"
427
428
428
429
attempt=0
429
430
max_attempts=5
430
431
until [ $attempt -ge $max_attempts ]; do
431
432
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}
436
435
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
438
437
sleep 10
439
438
done
440
439
0 commit comments