The commit updates the `tasks` directory by adding new roles (`rapbian_desktop_prov.yml`, `test_remote.yml`, `update_roles.sh`) and tasks within these roles. This refactoring enhances the organization and maintainability of the Ansible playbook.
79 lines
2.1 KiB
YAML
79 lines
2.1 KiB
YAML
---
|
|
- name: Install LDAP client and Bitwarden Extension on Raspbian Desktop
|
|
hosts: pi5
|
|
become: true
|
|
become_user: root
|
|
gather_facts: true
|
|
|
|
vars:
|
|
# System detection
|
|
is_raspbian_desktop: false
|
|
|
|
pre_tasks:
|
|
- name: Check if Raspbian Desktop (GUI) is installed
|
|
ansible.builtin.shell: dpkg -l | grep raspberrypi-ui-mods
|
|
register: raspbian_desktop_check
|
|
changed_when: false
|
|
failed_when: false
|
|
tags: [system_check]
|
|
|
|
- name: Check if Chromium is installed
|
|
ansible.builtin.shell: which chromium-browser || which chromium
|
|
register: chromium_check
|
|
changed_when: false
|
|
failed_when: false
|
|
tags: [system_check]
|
|
|
|
- name: Set fact if host is Raspbian Desktop
|
|
ansible.builtin.set_fact:
|
|
is_raspbian_desktop: true
|
|
when:
|
|
- ansible_distribution | lower in ['raspbian', 'debian']
|
|
- raspbian_desktop_check.rc == 0
|
|
- chromium_check.rc == 0
|
|
tags: [system_check]
|
|
|
|
- name: Verify LDAP password is set
|
|
assert:
|
|
that: ldap_bind_pw is defined
|
|
fail_msg: "ldap_bind_pw must be defined in vault file"
|
|
success_msg: "LDAP password verification successful"
|
|
when: is_raspbian_desktop
|
|
tags: [always]
|
|
|
|
roles:
|
|
- role: bitwarden_chromium
|
|
when: is_raspbian_desktop
|
|
tags: [bitwarden]
|
|
|
|
- role: ldap-client
|
|
vars:
|
|
enable_auth: true
|
|
vault_ldap_password: "{{ ldap_bind_pw }}"
|
|
nss_services:
|
|
- passwd
|
|
- group
|
|
- shadow
|
|
when: is_raspbian_desktop
|
|
tags: [ldap]
|
|
|
|
# post_tasks:
|
|
# - name: Verify LDAP authentication
|
|
# block:
|
|
# - name: Test LDAP user lookup
|
|
# ansible.builtin.command: id "{{ test_ldap_user | default('testuser') }}"
|
|
# register: ldap_test
|
|
# changed_when: false
|
|
# failed_when: false
|
|
|
|
# - name: Show LDAP test results
|
|
# debug:
|
|
# msg: "LDAP user lookup {{ 'successful' if ldap_test.rc == 0 else 'failed' }}"
|
|
# when:
|
|
# - is_raspbian_desktop
|
|
# - enable_auth | default(true)
|
|
# tags: [test, ldap]
|
|
|
|
|
|
# TODO
|
|
# - install pavucontrol |