- name: Deploy Application hosts: all become: yes become_method: sudo vars_files: - vars/main.yml pre_tasks: - name: Get applist block: - name: Get appname and dependencies, combine to a applist shell : | echo "{{appname}}" > /tmp/applist wget -N https://raw.githubusercontent.com/Websoft9/StackHub/main/apps/roles/{{appname}}/meta/main.yml cat main.yml | sed -n '/dependencies/,/galaxy_info/{//!p}'|grep -|awk -F'- ' '{print $2}' >>/tmp/applist cat /tmp/applist register: applist - debug: msg: You will install {{item}} loop: {{applist.stdout_lines}} roles: - { role: role_common, tags: "role_common" } - { role: role_cloud, tags: "role_cloud" } - { role: role_nginx, tags: "role_nginx" } - { role: "{{appname}}", tags: "{{appname}}" } - { role: role_init, tags: "role_init" } - { role: role_preend, tags: "preend" } - { role: role_end, tags: "role_end" }