[PATCH 2/8] devconfig: Add tmux.conf copying to target systems
Luis Chamberlain <[email protected]> Sat, 6 Dec 2025 08:56:16 -0800
| Newsgroups | dev.linux.lists.kdevops |
|---|---|
| Message-ID | <[email protected]> |
Added support for copying the user's local tmux.conf configuration to target systems during devconfig setup, following the same pattern as gitconfig copying. If a ~/.tmux.conf file exists on the control host, it will be copied to both the user home directory and root home directory on target nodes. The implementation checks for tmux.conf existence on localhost, copies it to the target user directory if present, and then copies to root using remote_src for efficient transfer. This ensures consistent terminal multiplexer configuration across all development systems. Generated-by: Claude AI Signed-off-by: Luis Chamberlain <[email protected]> --- playbooks/roles/devconfig/defaults/main.yml | 4 ++++ playbooks/roles/devconfig/tasks/main.yml | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/playbooks/roles/devconfig/defaults/main.yml b/playbooks/roles/devconfig/defaults/main.yml index 122cb898..4953f6aa 100644 --- a/playbooks/roles/devconfig/defaults/main.yml +++ b/playbooks/roles/devconfig/defaults/main.yml @@ -9,6 +9,10 @@ dev_gitconfig_src: "~/.gitconfig" # Where we copy it to dev_gitconfig_dest: "{{ data_home_dir }}/.gitconfig" +# Tmux configuration +dev_tmux_conf_src: "~/.tmux.conf" +dev_tmux_conf_dest: "{{ data_home_dir }}/.tmux.conf" + # The bash script we check for on the virtual machine dev_bash_config: "{{ data_home_dir }}/.bashrc" dev_bash_config_root: "/root/.bashrc" diff --git a/playbooks/roles/devconfig/tasks/main.yml b/playbooks/roles/devconfig/tasks/main.yml index ba55928e..325981a0 100644 --- a/playbooks/roles/devconfig/tasks/main.yml +++ b/playbooks/roles/devconfig/tasks/main.yml @@ -155,6 +155,23 @@ ansible.builtin.copy: src={{ dev_gitconfig_dest }} dest=/root/ remote_src=yes when: dev_git_config_file.stat.exists +- name: Check if the developer has a tmux config + delegate_to: localhost + ansible.builtin.stat: path={{ dev_tmux_conf_src }} + run_once: true + register: dev_tmux_config_file + +- name: Copy the developer's tmux.conf *if* it exists + ansible.builtin.copy: src={{ dev_tmux_conf_src }} dest={{ dev_tmux_conf_dest }} + when: dev_tmux_config_file.stat.exists + +- name: Copy the developer's tmux.conf *if* it exists to root + become: true + become_flags: "su - -c" + become_method: sudo + ansible.builtin.copy: src={{ dev_tmux_conf_dest }} dest=/root/ remote_src=yes + when: dev_tmux_config_file.stat.exists + - name: Check if the system has a user vimrc file ansible.builtin.stat: path: ~/.vimrc -- 2.51.0