Listing 1: Dotfiles mit "dot-" kennzeichnen ls ~/dotfiles/zsh/dot-zshrc /root/dotfiles/zsh/dot-zshrc stow --dotfiles --target $HOME --dir $HOME/dotfiles/ zsh ls -l ~/.zshrc /root/.zshrc -> dotfiles/zsh/dot-zshrc Listing 2: Defaultvariablen in "main.yml" --- dotfiles_repo: "https://git.example.com/users/tscherf/dot files.git/" dotfiles_repo_local_destination: "{{ ansible_env.HOME }}/dotfiles" dotfiles_home: "{{ ansible_env.HOME }}" Listing 3: Tasks in "main.yml" --- - name: Update dnf cache ansible.builtin.dnf: update_cache: true become: true - name: Install stow and git ansible.builtin.package: name: - stow - git state: present become: true - name: Install terminal applications ansible.builtin.package: name: - neovim - tmux - zsh state: present become: true - name: Ensure dotfiles repository is cloned on target system ansible.builtin.git: repo: "{{ dotfiles_repo }}" dest: "{{ dotfiles_repo_local_ destination }}" become: false - name: Build package list ansible.builtin.find: paths: ["{{ dotfiles_repo_local_ destination }}"] depth: 1 file_type: directory register: files become: false - name: Deploy dotfiles with_items: '{{ files.files }}' ansible.builtin.command: cmd: stow --dotfiles --target= {{ dotfiles_home }} --dir {{ dotfiles_repo_local_destination }} {{ item.path | basename }} chdir: "{{ dotfiles_repo_local_destination }}" register: result changed_when: 'result.stderr is search("LINK: ")' become: false Listing 4: Playbook "dotfiles-play.yml" --- - hosts: localhost roles: - { role: dotfiles } become: true