--- - name: Introduce roles hosts: server become: true pre_tasks: - name: pre_tasks run here debug: msg: 'this runs before the roles' roles: - prep_server post_tasks: - name: post_tasks run here debug: msg: 'this runs after the roles' - name: retrieve content from port 80 uri: url: "http://localhost:80/index.html" return_content: yes when: port == 'http'