--- - hosts: localhost connection: local tasks: - add_host: name: "{{ server }}" groups: working_group changed_when: false - hosts: working_group remote_user: ubuntu tasks: - name: apt update become: true become_user: root apt: update_cache: yes name: [python3-dev, libpq-dev, python3-pip] state: present - name: pip install pip: name: - django - psycopg2 - name: git cloning git: repo: https://github.com/raulikeda/tasks.git dest: /home/ubuntu/tasks - name: migration command: python3 manage.py migrate args: chdir: /home/ubuntu/tasks - name: crontab cron: name: "start django" special_time: reboot job: cd /home/ubuntu/tasks && ./run.sh - name: reboot machine become: true become_user: root reboot: