2026-09-24 23:36:10 +03:00
|
|
|
# Исходники hackrf-scanner с управляющей машины (scanner_src) на узлы и сборка
|
|
|
|
|
# на месте. Интернет не нужен, зависимости ставит playbook.yml (тег base).
|
|
|
|
|
# Что уехало, видно в ~/hackrf-scanner/DEPLOYED (git describe).
|
|
|
|
|
- name: Код hackrf-scanner на узлы и сборка
|
|
|
|
|
hosts: all
|
|
|
|
|
gather_facts: false
|
|
|
|
|
tasks:
|
|
|
|
|
- name: Ревизия исходников на управляющей машине
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
run_once: true
|
|
|
|
|
ansible.builtin.command: git -C {{ scanner_src }} describe --always --dirty
|
|
|
|
|
register: rev
|
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
|
|
- name: Исходники на узле (без .git и build), лишние файлы удаляются
|
|
|
|
|
ansible.posix.synchronize:
|
|
|
|
|
src: "{{ scanner_src }}/"
|
2026-10-03 18:27:34 +03:00
|
|
|
dest: "{{ scanner_dir }}/"
|
2026-09-24 23:36:10 +03:00
|
|
|
delete: true
|
|
|
|
|
rsync_opts:
|
|
|
|
|
- "--exclude=.git"
|
|
|
|
|
- "--exclude=build*"
|
|
|
|
|
- "--exclude=.cache"
|
|
|
|
|
- "--exclude=__pycache__"
|
|
|
|
|
- "--exclude=DEPLOYED"
|
|
|
|
|
|
|
|
|
|
- name: След клона прежнего провижнинга не нужен
|
|
|
|
|
ansible.builtin.file:
|
2026-10-03 18:27:34 +03:00
|
|
|
path: "{{ scanner_dir }}/.git"
|
2026-09-24 23:36:10 +03:00
|
|
|
state: absent
|
|
|
|
|
|
|
|
|
|
- name: Метка ревизии
|
|
|
|
|
ansible.builtin.copy:
|
|
|
|
|
content: "{{ rev.stdout }}\n"
|
2026-10-03 18:27:34 +03:00
|
|
|
dest: "{{ scanner_dir }}/DEPLOYED"
|
2026-09-24 23:36:10 +03:00
|
|
|
mode: "0644"
|
|
|
|
|
|
|
|
|
|
- name: Сборка
|
|
|
|
|
ansible.builtin.shell: |
|
|
|
|
|
cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo >/dev/null
|
|
|
|
|
cmake --build build -j"$(nproc)"
|
|
|
|
|
args:
|
2026-10-03 18:27:34 +03:00
|
|
|
chdir: "{{ scanner_dir }}"
|
2026-09-24 23:36:10 +03:00
|
|
|
register: build
|
|
|
|
|
changed_when: "'Building CXX' in build.stdout or 'Linking' in build.stdout"
|
|
|
|
|
|
|
|
|
|
- name: Бинарники на месте
|
|
|
|
|
ansible.builtin.stat:
|
2026-10-03 18:27:34 +03:00
|
|
|
path: "{{ scanner_dir }}/build/{{ item }}"
|
2026-09-24 23:36:10 +03:00
|
|
|
register: bins
|
|
|
|
|
failed_when: not bins.stat.exists
|
|
|
|
|
loop: [peleng, scan]
|
|
|
|
|
|
|
|
|
|
- name: Итог по узлу
|
|
|
|
|
ansible.builtin.debug:
|
|
|
|
|
msg: "[+] {{ inventory_hostname }}: {{ rev.stdout }} собран"
|