mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-31 11:54:47 +00:00
Merge pull request #1364 from t-woerner/infra_image_service_refinement
infra/image: Make fixnet and fixipaip services active by default
This commit is contained in:
@@ -120,13 +120,6 @@ then
|
|||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
|
|
||||||
if $deployed; then
|
|
||||||
log info "= Enabling services ="
|
|
||||||
container_exec "${name}" systemctl enable fixnet
|
|
||||||
container_exec "${name}" systemctl enable fixipaip
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
|
|
||||||
container_stop "${name}"
|
container_stop "${name}"
|
||||||
|
|
||||||
$deployed || die "Deployment failed"
|
$deployed || die "Deployment failed"
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ COPY system-service/fixipaip.sh /root/
|
|||||||
COPY system-service/fixnet.service /etc/systemd/system/
|
COPY system-service/fixnet.service /etc/systemd/system/
|
||||||
COPY system-service/fixipaip.service /etc/systemd/system/
|
COPY system-service/fixipaip.service /etc/systemd/system/
|
||||||
RUN chmod +x /root/fixnet.sh /root/fixipaip.sh
|
RUN chmod +x /root/fixnet.sh /root/fixipaip.sh
|
||||||
|
RUN systemctl enable fixnet.service
|
||||||
|
RUN systemctl enable fixipaip.service
|
||||||
|
|
||||||
STOPSIGNAL RTMIN+3
|
STOPSIGNAL RTMIN+3
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ COPY system-service/fixipaip.sh /root/
|
|||||||
COPY system-service/fixnet.service /etc/systemd/system/
|
COPY system-service/fixnet.service /etc/systemd/system/
|
||||||
COPY system-service/fixipaip.service /etc/systemd/system/
|
COPY system-service/fixipaip.service /etc/systemd/system/
|
||||||
RUN chmod +x /root/fixnet.sh /root/fixipaip.sh
|
RUN chmod +x /root/fixnet.sh /root/fixipaip.sh
|
||||||
|
RUN systemctl enable fixnet.service
|
||||||
|
RUN systemctl enable fixipaip.service
|
||||||
|
|
||||||
STOPSIGNAL RTMIN+3
|
STOPSIGNAL RTMIN+3
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ COPY system-service/fixipaip.sh /root/
|
|||||||
COPY system-service/fixnet.service /etc/systemd/system/
|
COPY system-service/fixnet.service /etc/systemd/system/
|
||||||
COPY system-service/fixipaip.service /etc/systemd/system/
|
COPY system-service/fixipaip.service /etc/systemd/system/
|
||||||
RUN chmod +x /root/fixnet.sh /root/fixipaip.sh
|
RUN chmod +x /root/fixnet.sh /root/fixipaip.sh
|
||||||
|
RUN systemctl enable fixnet.service
|
||||||
|
RUN systemctl enable fixipaip.service
|
||||||
|
|
||||||
STOPSIGNAL RTMIN+3
|
STOPSIGNAL RTMIN+3
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ COPY system-service/fixipaip.sh /root/
|
|||||||
COPY system-service/fixnet.service /etc/systemd/system/
|
COPY system-service/fixnet.service /etc/systemd/system/
|
||||||
COPY system-service/fixipaip.service /etc/systemd/system/
|
COPY system-service/fixipaip.service /etc/systemd/system/
|
||||||
RUN chmod +x /root/fixnet.sh /root/fixipaip.sh
|
RUN chmod +x /root/fixnet.sh /root/fixipaip.sh
|
||||||
|
RUN systemctl enable fixnet.service
|
||||||
|
RUN systemctl enable fixipaip.service
|
||||||
|
|
||||||
STOPSIGNAL RTMIN+3
|
STOPSIGNAL RTMIN+3
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ COPY system-service/fixipaip.sh /root/
|
|||||||
COPY system-service/fixnet.service /etc/systemd/system/
|
COPY system-service/fixnet.service /etc/systemd/system/
|
||||||
COPY system-service/fixipaip.service /etc/systemd/system/
|
COPY system-service/fixipaip.service /etc/systemd/system/
|
||||||
RUN chmod +x /root/fixnet.sh /root/fixipaip.sh
|
RUN chmod +x /root/fixnet.sh /root/fixipaip.sh
|
||||||
|
RUN systemctl enable fixnet.service
|
||||||
|
RUN systemctl enable fixipaip.service
|
||||||
|
|
||||||
STOPSIGNAL RTMIN+3
|
STOPSIGNAL RTMIN+3
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Fix IPA server IP in IPA Server
|
Description=Fix IPA server IP in IPA Server
|
||||||
After=ipa.service
|
After=ipa.service
|
||||||
|
PartOf=ipa.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
@@ -9,4 +10,4 @@ StandardOutput=journal
|
|||||||
StandardError=journal
|
StandardError=journal
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=default.target
|
WantedBy=ipa.service
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ if [ -z "${FORWARDER}" ] || [ "${FORWARDER}" == "127.0.0.1" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Fix IPA:"
|
echo "Fix IPA:"
|
||||||
echo " HOSTNAME: '${HOSTNAME}'"
|
echo " HOSTNAME: '${HOSTNAME}'"
|
||||||
echo " IP: '${IP}'"
|
echo " IP: '${IP}'"
|
||||||
echo " PTR: '${PTR}'"
|
echo " PTR: '${PTR}'"
|
||||||
echo " FORWARDER: '${FORWARDER}'"
|
echo " FORWARDER: '${FORWARDER}'"
|
||||||
|
|
||||||
ZONES=$(ipa -e in_server=true dnszone-find --name-from-ip="${HOSTNAME}." \
|
ZONES=$(ipa -e in_server=true dnszone-find --name-from-ip="${HOSTNAME}." \
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Fix server IP in IPA Server
|
Description=Fix /etc/hosts and with local DNS also /etc/resolv.conf
|
||||||
Wants=network.target
|
|
||||||
After=network.target
|
|
||||||
Before=ipa.service
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
@@ -11,4 +8,4 @@ StandardOutput=journal
|
|||||||
StandardError=journal
|
StandardError=journal
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=ipa.service
|
WantedBy=container-ipa.target
|
||||||
|
|||||||
@@ -39,26 +39,35 @@ if [ -z "${IP}" ] || ! valid_ipv4 "${IP}" ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
DOMAIN=${HOSTNAME#*.}
|
||||||
|
|
||||||
echo "Fix NET:"
|
echo "Fix NET:"
|
||||||
echo " HOSTNAME: '${HOSTNAME}'"
|
echo " HOSTNAME: '${HOSTNAME}'"
|
||||||
echo " IP: '${IP}'"
|
echo " DOMAIN: '${DOMAIN}'"
|
||||||
|
echo " IP: '${IP}'"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
if grep -qE "^[^(#\s*)][0-9\.]+\s$HOSTNAME(\s|$)" /etc/hosts
|
# /etc/hosts
|
||||||
then
|
|
||||||
sed -i.bak -e "s/.*${HOSTNAME}/${IP}\t${HOSTNAME}/" /etc/hosts
|
|
||||||
else
|
|
||||||
echo -e "$IP\t${HOSTNAME} ${HOSTNAME%%.*}" >> /etc/hosts
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp -a /etc/resolv.conf /etc/resolv.conf.fixnet
|
sed -i -E "/\s+${HOSTNAME}(\s|$)/d" /etc/hosts
|
||||||
cat > /etc/resolv.conf <<EOF
|
echo -e "$IP\t${HOSTNAME} ${HOSTNAME%%.*}" >> /etc/hosts
|
||||||
search ${HOSTNAME#*.}
|
|
||||||
nameserver 127.0.0.1
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "/etc/hosts:"
|
echo "/etc/hosts:"
|
||||||
cat "/etc/hosts"
|
cat "/etc/hosts"
|
||||||
|
|
||||||
|
# /etc/resolv.conf
|
||||||
|
|
||||||
|
# If bind is not installed, exit
|
||||||
|
[ -f "/etc/named.conf" ] || exit 0
|
||||||
|
# If dyndb is not enabled for bind, exit
|
||||||
|
grep -q '^dyndb "ipa"' "/etc/named.conf" || exit 0
|
||||||
|
|
||||||
|
cp -a /etc/resolv.conf /etc/resolv.conf.fixnet
|
||||||
|
cat > /etc/resolv.conf <<EOF
|
||||||
|
search ${DOMAIN}
|
||||||
|
nameserver 127.0.0.1
|
||||||
|
EOF
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "/etc/resolv.conf:"
|
echo "/etc/resolv.conf:"
|
||||||
cat "/etc/resolv.conf"
|
cat "/etc/resolv.conf"
|
||||||
|
|||||||
Reference in New Issue
Block a user