Install tea with Ansible
Posted on May 31, 2026 • 2 min read • 330 wordsI use tea to automate some things in my homelab. Since I usually dive all the way into something, install and configure things and then forget about it again, it is important to me that as much as possible is automatic. Ansible helps me with this. I created a role in Ansible to set up and standardize my management host. To store everything neatly and do versioning I use gitea. To take care of some gitea issues from the commandline, like creating a repository when it doesn’t exist yet, I use tea.
An Ansible role takes care of downloading, installing and configuring tea.
I have a baseline playbook in playbooks/baseline.yml.
---
- name: Baseline configuration for the management Linux host
hosts: linux
become: true
roles:
- baselineIn roles/baseline/vars/main.yml I put the variables for tea
tea_version: "0.14.0"
tea_config_dir: "/home/{{ tea_admin_user }}/.config/tea"
tea_config_file: "{{ tea_config_dir }}/config.yml"in roles/baseline/tasks/main.yml are the final actions I do
- name: Download tea binary
ansible.builtin.get_url:
url: "{{ tea_url }}"
dest: /usr/local/bin/tea
mode: "0755"
- name: make sure config directory exists
ansible.builtin.file:
path: "{{ tea_config_dir }}"
state: directory
mode: "0700"
owner: {{ tea_admin_user }}
group: {{ tea_admin_user }}
become: true
- name: Place tea config
ansible.builtin.template:
src: templates/tea-config.yml.j2
dest: "{{ tea_config_file }}"
mode: "0600"
owner: {{ tea_admin_user }}
group: {{ tea_admin_user }}
become: trueThe actual config file is located in roles/baseline/templates/tea-config.yml.j2.
logins:
- name: gitea
url: {{ tea_gitea_url }}
token: {{ tea_gitea_token }}
default: true
ssh_host: git.home.elsinga.me
ssh_key: ""
insecure: false
ssh_certificate_principal: ""
ssh_agent: false
ssh_key_agent_pub: ""
version_check: true
user: elsingaa
created: 1773661605
refresh_token: ""
token_expiry: 0
preferences:
editor: false
flag_defaults:
remote: ""The secrets are in an Ansible vault, ansible-vault edit group_vars/all/vault.yml:
This contains the gitea url, token and username.
tea_admin_user:"<the admin user you are building the config for>"
tea_gitea_token: "<the token you generate in gitea>"
tea_gitea_url: "<gitea instance>Finally, with ansible-playbook playbooks/baseline.yml, I run the playbook to perform the actual installation and configuration.
Hopefully this will ensure that in a while I will still understand what I have done.
