35 lines
941 B
YAML
35 lines
941 B
YAML
---
|
|
- include_tasks: '{{ansible_os_family}}.yaml'
|
|
|
|
# gdb 11.1 introduced support for config files that respect the XDG base
|
|
# directory spec, handle the boths paths dependant on the gdb version install.
|
|
- name: get installed version
|
|
command: gdb --version
|
|
register: gdb_version_output
|
|
changed_when: false
|
|
|
|
- set_fact:
|
|
gdb_version: '{{gdb_version_output.stdout | regex_search("(\d+)\.(\d+)", "\1", "\2")}}'
|
|
- set_fact:
|
|
gdb_xdg_base_dir_check:
|
|
gdb_version[0] | int > 11 or (
|
|
gdb_version[0] | int == 11 and gdb_version[1] | int == 1
|
|
)
|
|
|
|
- set_fact:
|
|
gdb_config_file: '{{ansible_env.HOME}}/.gdbinit'
|
|
gdb_state_dir: '{{ansible_env.HOME}}/.local/state/gdb'
|
|
|
|
- when: gdb_xdg_base_dir_check
|
|
include_tasks: gdb-11.1-config.yaml
|
|
|
|
- name: create config file
|
|
template:
|
|
src: gdbinit
|
|
dest: '{{gdb_config_file}}'
|
|
|
|
- name: create state directory
|
|
file:
|
|
path: '{{gdb_state_dir}}'
|
|
state: directory
|