Files
deploy_home/ansible/roles/gitea-actions/tasks/esp-idf.yml
Bastian de Byl d5e473304a fix: use python_env as guard for ESP-IDF install task
The tools directory can exist without the Python venv being created,
causing install.sh to be skipped on re-runs. Check for python_env
instead, which is the actual output we need.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 12:43:14 -04:00

93 lines
2.3 KiB
YAML

---
- name: install ESP-IDF build dependencies
become: true
ansible.builtin.dnf:
name:
- git
- wget
- flex
- bison
- gperf
- python3
- python3-pip
- cmake
- ninja-build
- ccache
- libffi-devel
- libusb1-devel
state: present
tags: gitea-actions
- name: check if ESP-IDF is installed
ansible.builtin.stat:
path: "{{ esp_idf_path }}"
register: esp_idf_dir
tags: gitea-actions
- name: clone ESP-IDF repository
become: true
ansible.builtin.git:
repo: https://github.com/espressif/esp-idf.git
dest: "{{ esp_idf_path }}"
version: "{{ esp_idf_version }}"
recursive: true
force: false
when: not esp_idf_dir.stat.exists
tags: gitea-actions
- name: add ESP-IDF to git safe.directory
become: true
ansible.builtin.command:
cmd: git config --global --add safe.directory {{ esp_idf_path }}
changed_when: false
tags: gitea-actions
- name: ensure ESP-IDF submodules are initialized
become: true
ansible.builtin.command:
cmd: git submodule update --init --recursive
chdir: "{{ esp_idf_path }}"
changed_when: false
tags: gitea-actions
- name: set ESP-IDF directory ownership
become: true
ansible.builtin.file:
path: "{{ esp_idf_path }}"
owner: "{{ gitea_runner_user }}"
group: "{{ gitea_runner_user }}"
recurse: true
tags: gitea-actions
- name: set SELinux context for ESP-IDF directory
become: true
community.general.sefcontext:
target: "{{ esp_idf_path }}(/.*)?"
setype: usr_t
state: present
when: ansible_selinux.status == "enabled"
notify: restore esp-idf selinux context
tags: gitea-actions
- name: create ESP-IDF tools directory for runner user
become: true
ansible.builtin.file:
path: "{{ gitea_runner_home }}/.espressif"
state: directory
owner: "{{ gitea_runner_user }}"
group: "{{ gitea_runner_user }}"
mode: "0755"
tags: gitea-actions
- name: install ESP-IDF tools for runner user
become: true
become_user: "{{ gitea_runner_user }}"
ansible.builtin.shell: |
export IDF_TOOLS_PATH="{{ gitea_runner_home }}/.espressif"
{{ esp_idf_path }}/install.sh esp32
args:
creates: "{{ gitea_runner_home }}/.espressif/python_env"
environment:
HOME: "{{ gitea_runner_home }}"
tags: gitea-actions