fix(ansipa): Arch package/hostname fixes, safer seed_policystore delegation
- Use samba/openssh package names on Arch instead of Debian-style samba-client/openssh-server - Skip AUR-only freeipa install when ipa-client-install already present; skip oddjob if not in official repos - Guard seed_policystore delegate_to when ipa_server_host is undefined - Make hostname detection and OS version parsing more robust - Fix inverted DNS_UPDATE/CONFIGURE_SUDO enrollment flagsfeat/astal-menu
parent
815c0e57a8
commit
03db4f00a7
|
|
@ -97,10 +97,10 @@
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: present
|
state: present
|
||||||
loop:
|
loop:
|
||||||
- samba-client
|
- "{{ 'samba' if ansible_os_family == 'Archlinux' else 'samba-client' }}"
|
||||||
- cups
|
- cups
|
||||||
- cifs-utils # needed for usr_smb_* CIFS mounts
|
- cifs-utils # needed for usr_smb_* CIFS mounts
|
||||||
- openssh-server # needed for dev_ssh_* (sshd must be running to accept keys)
|
- "{{ 'openssh' if ansible_os_family == 'Archlinux' else 'openssh-server' }}"
|
||||||
- lm_sensors # needed for dev_mon_power fallback (Intel RAPL preferred)
|
- lm_sensors # needed for dev_mon_power fallback (Intel RAPL preferred)
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
|
||||||
|
|
@ -188,6 +188,6 @@
|
||||||
dest: /data/policy-store/policies.d/
|
dest: /data/policy-store/policies.d/
|
||||||
mode: '0664'
|
mode: '0664'
|
||||||
directory_mode: '02775'
|
directory_mode: '02775'
|
||||||
delegate_to: "{{ ipa_server_host }}"
|
delegate_to: "{{ ipa_server_host | default(omit) }}"
|
||||||
run_once: true
|
run_once: true
|
||||||
when: seed_policystore | default(false) | bool
|
when: (seed_policystore | default(false) | bool) and (ipa_server_host is defined)
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ section "Detecting OS"
|
||||||
if [[ -f /etc/os-release ]]; then
|
if [[ -f /etc/os-release ]]; then
|
||||||
source /etc/os-release
|
source /etc/os-release
|
||||||
OS_ID="${ID}"
|
OS_ID="${ID}"
|
||||||
OS_VERSION="${VERSION_ID%%.*}"
|
OS_VERSION="${VERSION_ID:+${VERSION_ID%%.*}}"
|
||||||
log "Detected: $PRETTY_NAME"
|
log "Detected: $PRETTY_NAME"
|
||||||
else
|
else
|
||||||
error "Cannot detect OS — /etc/os-release missing"
|
error "Cannot detect OS — /etc/os-release missing"
|
||||||
|
|
@ -259,7 +259,18 @@ section "Installing packages"
|
||||||
if [[ "$OS_ID" == "arch" ]]; then
|
if [[ "$OS_ID" == "arch" ]]; then
|
||||||
# Ensure pacman db is fresh
|
# Ensure pacman db is fresh
|
||||||
pacman -Sy --noconfirm
|
pacman -Sy --noconfirm
|
||||||
pkg_install $IPA_CLIENT_PKG $SSSD_PKGS $ODDJOB_PKGS
|
# freeipa is AUR-only; skip if ipa-client-install already present
|
||||||
|
if command -v ipa-client-install &>/dev/null; then
|
||||||
|
log "ipa-client-install already present — skipping AUR freeipa install"
|
||||||
|
else
|
||||||
|
pkg_install $IPA_CLIENT_PKG $SSSD_PKGS
|
||||||
|
fi
|
||||||
|
# oddjob (for mkhomedir) — skip if not available in official repos
|
||||||
|
if pacman -Si oddjob &>/dev/null 2>&1; then
|
||||||
|
pkg_install $ODDJOB_PKGS
|
||||||
|
else
|
||||||
|
warn "oddjob not in official repos — mkhomedir via pam_mkhomedir fallback"
|
||||||
|
fi
|
||||||
|
|
||||||
# Arch: pam-u2f may be in AUR — try pacman first, fall back to yay/paru
|
# Arch: pam-u2f may be in AUR — try pacman first, fall back to yay/paru
|
||||||
if [[ "$ENABLE_FIDO2" == true ]]; then
|
if [[ "$ENABLE_FIDO2" == true ]]; then
|
||||||
|
|
@ -299,7 +310,7 @@ log "Packages installed"
|
||||||
# ─── Set hostname ─────────────────────────────────────────────────────────────
|
# ─── Set hostname ─────────────────────────────────────────────────────────────
|
||||||
section "Configuring hostname"
|
section "Configuring hostname"
|
||||||
|
|
||||||
CURRENT_HOSTNAME=$(hostname -f 2>/dev/null || hostname)
|
CURRENT_HOSTNAME=$(hostname -f 2>/dev/null || hostnamectl hostname 2>/dev/null || cat /etc/hostname 2>/dev/null || echo "unknown")
|
||||||
if [[ "$CURRENT_HOSTNAME" != "$IPA_HOSTNAME" ]]; then
|
if [[ "$CURRENT_HOSTNAME" != "$IPA_HOSTNAME" ]]; then
|
||||||
log "Setting hostname to $IPA_HOSTNAME"
|
log "Setting hostname to $IPA_HOSTNAME"
|
||||||
hostnamectl set-hostname "$IPA_HOSTNAME"
|
hostnamectl set-hostname "$IPA_HOSTNAME"
|
||||||
|
|
@ -344,8 +355,8 @@ ENROLL_ARGS=(
|
||||||
)
|
)
|
||||||
|
|
||||||
[[ "$MKHOMEDIR" == true ]] && ENROLL_ARGS+=(--mkhomedir)
|
[[ "$MKHOMEDIR" == true ]] && ENROLL_ARGS+=(--mkhomedir)
|
||||||
[[ "$DNS_UPDATE" == false ]] && ENROLL_ARGS+=(--no-dns-update)
|
[[ "$DNS_UPDATE" == true ]] && ENROLL_ARGS+=(--enable-dns-updates)
|
||||||
[[ "$CONFIGURE_SUDO" == true ]] && ENROLL_ARGS+=(--enable-dns-updates)
|
[[ "$CONFIGURE_SUDO" == true ]] && true # sudo via SSSD is configured post-enrollment
|
||||||
|
|
||||||
log "Running ipa-client-install..."
|
log "Running ipa-client-install..."
|
||||||
if ipa-client-install "${ENROLL_ARGS[@]}"; then
|
if ipa-client-install "${ENROLL_ARGS[@]}"; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue