Files
ouranos/ansible/loki/deploy.yml
Robert Helewka 042df52bca Refactor user management in Ansible playbooks to standardize on keeper_user
- Updated user addition tasks across multiple playbooks (mcp_switchboard, mcpo, neo4j, neo4j_mcp, openwebui, postgresql, rabbitmq, searxng, smtp4dev) to replace references to ansible_user and remote_user with keeper_user.
- Modified PostgreSQL deployment to create directories and manage files under keeper_user's home.
- Enhanced documentation to clarify account taxonomy and usage of keeper_user in playbooks.
- Introduced new deployment for Agent S, including environment setup, desktop environment installation, XRDP configuration, and accessibility support.
- Added staging playbook for preparing release tarballs from local repositories.
- Created templates for XRDP configuration and environment activation scripts.
- Removed obsolete sunwait documentation.
2026-03-05 10:37:41 +00:00

90 lines
2.0 KiB
YAML

---
- name: Deploy Loki to Prospero
hosts: ubuntu
become: true
tasks:
- name: Check if host has loki service
ansible.builtin.set_fact:
has_loki_service: "{{'loki' in services}}"
- name: Skip hosts without loki service
ansible.builtin.meta: end_host
when: not has_loki_service
- name: Add Grafana repository
ansible.builtin.deb822_repository:
name: grafana
types: [deb]
uris: https://apt.grafana.com
suites: [stable]
components: [main]
signed_by: https://apt.grafana.com/gpg.key
state: present
- name: Install Loki
become: true
ansible.builtin.apt:
name:
- loki
state: present
update_cache: true
- name: Create loki group
become: true
ansible.builtin.group:
name: "{{loki_group}}"
- name: Create loki user
become: true
ansible.builtin.user:
name: "{{loki_user}}"
comment: "{{loki_user}}"
group: "{{loki_group}}"
system: true
- name: Add group loki to keeper_user
become: true
ansible.builtin.user:
name: "{{keeper_user}}"
groups: "{{loki_group}}"
append: true
- name: Create loki directories
become: true
ansible.builtin.file:
path: "{{item}}"
owner: "{{loki_user}}"
group: "{{loki_group}}"
state: directory
mode: '750'
loop:
- "{{loki_data_dir}}"
- "{{loki_config_dir}}"
- name: Template Loki configuration
become: true
ansible.builtin.template:
src: "{{loki_config_file}}.j2"
dest: "{{loki_config_dir}}/{{loki_config_file}}"
owner: "{{loki_user}}"
group: "{{loki_group}}"
mode: '550'
notify: restart loki
- name: Reset SSH connection to apply group changes
meta: reset_connection
- name: Enable and start Loki service
become: true
ansible.builtin.systemd:
name: loki
enabled: true
state: started
handlers:
- name: restart loki
become: true
ansible.builtin.systemd:
name: loki
state: restarted