I am currently using ansible to manage my dotfiles locally and i was trying to automate my GTK themes setup. So i created a role “lxappearance” under “~/repos/dotfiles/roles/lxappearance”. included it in “~/repos/dotfiles/main.yml”.
I have a task in “~/repos/dotfiles/roles/lxappearance/tasks/main.yml” tagged “save-lxappearance” which copies the “~/.themes” & “~/.icons” directories to “~/repos/dotfiles/roles/lxappearance/files/”.
“~/repos/dotfiles/roles/lxappearance/tasks/main.yml”:
- name: (lxappearance) save config files
  become: false
  tags:
    - save
    - save-lxappearance
  ansible.builtin.copy:
    src: /home/{{ ansible_user }}/"{{ item }}"
    dest: /home/{{ ansible_user }}/repos/dotfiles/roles/lxappearance/files
    group: users
    owner: "{{ ansible_user }}"
    mode: 0644
  loop:
    - .themes
    - .iconswhen i ran it with “ansible-playbook -vvvv main.yml --tags save-lxappearance”, it gave:
ansible-playbook [core 2.18.0]
  config file = /home/odd/repos/dotfiles/ansible.cfg
  configured module search path = ['/home/odd/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.12/site-packages/ansible
  ansible collection location = /home/odd/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible-playbook
  python version = 3.12.7 (main, Oct  1 2024, 11:15:50) [GCC 14.2.1 20240910] (/usr/bin/python)
  jinja version = 3.1.4
  libyaml = True
Using /home/odd/repos/dotfiles/ansible.cfg as config file
setting up inventory plugins
Loading collection ansible.builtin from
host_list declined parsing /home/odd/repos/dotfiles/inventory.yml as it did not pass its verify_file() method
script declined parsing /home/odd/repos/dotfiles/inventory.yml as it did not pass its verify_file() method
Parsed /home/odd/repos/dotfiles/inventory.yml inventory source with yaml plugin
Loading collection community.general from /usr/lib/python3.12/site-packages/ansible_collections/community/general
Loading callback plugin beautiful_output of type stdout, v2.0 from /home/odd/repos/dotfiles/callback_plugins/beautiful_output.py
Skipping callback 'beautiful_output', as we already have a stdout callback.
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
Executing playbook 🅨 main.yml
  Positional arguments: main.yml
  verbosity: 4
  connection: ssh
  become_method: sudo
  tags:
    - save-lxappearance
  inventory:
    - /home/odd/repos/dotfiles/inventory.yml
  forks: 5
1 plays in main.yml
-----------------------------------[PLAY: all]----------------------------------
Hosts:
  - all
--------------------------------------------------------------------------------
Gathering Facts
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: odd
<localhost> EXEC /bin/sh -c 'echo ~odd && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/odd/.ansible/tmp `"&& mkdir "` echo /home/odd/.ansible/tmp/ansible-tmp-1731837553.0558484-102723-81088891471729 `" && echo ansible-tmp-1731837553.0558484-102723-81088891471729="` echo /home/odd/.ansible/tmp/ansible-tmp-1731837553.0558484-102723-81088891471729 `" ) && sleep 0'
<system> Attempting python interpreter discovery
<localhost> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'python3.13'"'"'; command -v '"'"'python3.12'"'"'; command -v '"'"'python3.11'"'"'; command -v '"'"'python3.10'"'"'; command -v '"'"'python3.9'"'"'; command -v '"'"'python3.8'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'python3'"'"'; echo ENDFOUND && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python3.12 && sleep 0'
<system> Python interpreter discovery fallback (unable to get Linux distribution/version info)
Using module file /usr/lib/python3.12/site-packages/ansible/modules/setup.py
<localhost> PUT /home/odd/.ansible/tmp/ansible-local-102714xx41u8ds/tmp57wi3go4 TO /home/odd/.ansible/tmp/ansible-tmp-1731837553.0558484-102723-81088891471729/AnsiballZ_setup.py
<localhost> EXEC /bin/sh -c 'chmod u+x /home/odd/.ansible/tmp/ansible-tmp-1731837553.0558484-102723-81088891471729/ /home/odd/.ansible/tmp/ansible-tmp-1731837553.0558484-102723-81088891471729/AnsiballZ_setup.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python3.12 /home/odd/.ansible/tmp/ansible-tmp-1731837553.0558484-102723-81088891471729/AnsiballZ_setup.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/odd/.ansible/tmp/ansible-tmp-1731837553.0558484-102723-81088891471729/ > /dev/null 2>&1 && sleep 0'
[WARNING]: Platform linux on host system is using the discovered Python interpreter at /usr/bin/python3.12, but future installation of another Python interpreter could
change the meaning of that path. See https://docs.ansible.com/ansible-core/2.18/reference_appendices/interpreter_discovery.html for more information.
  ✔ system [OK]
(lxappearance) save config files
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: odd
<localhost> EXEC /bin/sh -c 'echo ~odd && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/odd/.ansible/tmp `"&& mkdir "` echo /home/odd/.ansible/tmp/ansible-tmp-1731837555.4758263-102808-187877599957614 `" && echo ansible-tmp-1731837555.4758263-102808-187877599957614="` echo /home/odd/.ansible/tmp/ansible-tmp-1731837555.4758263-102808-187877599957614 `" ) && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/odd/.ansible/tmp/ansible-tmp-1731837555.4758263-102808-187877599957614/ > /dev/null 2>&1 && sleep 0'
  ∑ Items:
    ✘ .themes (@system) [FAILED]
<localhost> EXEC /bin/sh -c 'echo ~odd && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/odd/.ansible/tmp `"&& mkdir "` echo /home/odd/.ansible/tmp/ansible-tmp-1731837555.5032568-102808-113486849709284 `" && echo ansible-tmp-1731837555.5032568-102808-113486849709284="` echo /home/odd/.ansible/tmp/ansible-tmp-1731837555.5032568-102808-113486849709284 `" ) && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/odd/.ansible/tmp/ansible-tmp-1731837555.5032568-102808-113486849709284/ > /dev/null 2>&1 && sleep 0'
    ✘ .icons (@system) [FAILED]After half a day of debugging i tried adding “remote_src” to “true”. and it worked:
- name: (lxappearance) save config directories
  become: false
  tags:
    - save
    - save-lxappearance
  ansible.builtin.copy:
    src: /home/{{ ansible_user }}/{{ item }}
    dest: /home/{{ ansible_user }}/repos/dotfiles/roles/lxappearance/files
    group: users
    owner: "{{ ansible_user }}"
    mode: 0644
    remote_src: true
  with_items:
    - .themes
    - .iconsQuestion is i have another similar task for neovim:
- name: (neovim) save config files
  become: false
  tags:
    - save
    - save-neovim
  ansible.builtin.copy:
    src: /home/{{ ansible_user }}/.config/nvim
    dest: /home/{{ ansible_user }}/repos/dotfiles/roles/neovim/files
    group: users
    owner: "{{ ansible_user }}"
    mode: 0644  This task runs without any issue. Why is that ?
Extra Info:
“~/repos/dotfiles/main.yml”:
---
- hosts: all
  roles:
    - base
    - services
    - git
    - ssh
    - xorg
    - picom
    - bash
    - alsa
    - yay
    - betterlockscreen
    - qtile
    - alacritty
    - starship
    - rofi
    - dunst
    - neovim
    - wallpapers
    - mpv
    - lxappearance“~/repos/dotfiles/inventory.yml”:
---
linux: # group
  hosts:
    system:
      ansible_user: odd
      ansible_host: localhost
      ansible_connection: local“~/repos/dotfiles/ansible.cfg”:
[defaults]
inventory = inventory.yml
nocows=True
stdout_callback=beautiful_output
bin_ansible_callbacks=True
[privilege_escalation]
become_method = sudo
become_user = root