--- - name: Create users.json hosts: localhost tasks: - name: Check if users.json exists ansible.builtin.stat: path: users.json register: register_stat_users - name: Create users.json ansible.builtin.command: /bin/bash users.sh 500 when: not register_stat_users.stat.exists