[ADD] плейбуки bootstrap, wifi-on, wifi-off, deploy, poweroff
This commit is contained in:
+58
@@ -0,0 +1,58 @@
|
||||
# Исходники hackrf-scanner с управляющей машины (scanner_src) на узлы и сборка
|
||||
# на месте. Интернет не нужен, зависимости ставит playbook.yml (тег base).
|
||||
# Что уехало, видно в ~/hackrf-scanner/DEPLOYED (git describe).
|
||||
- name: Код hackrf-scanner на узлы и сборка
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
vars:
|
||||
scanner_dest: /home/pi/hackrf-scanner
|
||||
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 }}/"
|
||||
dest: "{{ scanner_dest }}/"
|
||||
delete: true
|
||||
rsync_opts:
|
||||
- "--exclude=.git"
|
||||
- "--exclude=build*"
|
||||
- "--exclude=.cache"
|
||||
- "--exclude=__pycache__"
|
||||
- "--exclude=DEPLOYED"
|
||||
|
||||
- name: След клона прежнего провижнинга не нужен
|
||||
ansible.builtin.file:
|
||||
path: "{{ scanner_dest }}/.git"
|
||||
state: absent
|
||||
|
||||
- name: Метка ревизии
|
||||
ansible.builtin.copy:
|
||||
content: "{{ rev.stdout }}\n"
|
||||
dest: "{{ scanner_dest }}/DEPLOYED"
|
||||
mode: "0644"
|
||||
|
||||
- name: Сборка
|
||||
ansible.builtin.shell: |
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo >/dev/null
|
||||
cmake --build build -j"$(nproc)"
|
||||
args:
|
||||
chdir: "{{ scanner_dest }}"
|
||||
register: build
|
||||
changed_when: "'Building CXX' in build.stdout or 'Linking' in build.stdout"
|
||||
|
||||
- name: Бинарники на месте
|
||||
ansible.builtin.stat:
|
||||
path: "{{ scanner_dest }}/build/{{ item }}"
|
||||
register: bins
|
||||
failed_when: not bins.stat.exists
|
||||
loop: [peleng, scan]
|
||||
|
||||
- name: Итог по узлу
|
||||
ansible.builtin.debug:
|
||||
msg: "[+] {{ inventory_hostname }}: {{ rev.stdout }} собран"
|
||||
Reference in New Issue
Block a user