--- - name: Check for profiles.ini stat: path: "{{ ansible_env.HOME }}/.mozilla/firefox/profiles.ini" register: profile_ini - name: Copy Firefox preferences to Profile0 copy: src: user.js dest: "{{ ansible_env.HOME }}/.mozilla/firefox/{{ lookup('ini', 'Path section=Profile0 file={{ ansible_env.HOME }}/.mozilla/firefox/profiles.ini') }}/user.js" when: profile_ini.stat.exists