[Why] modify ansible code to output the name of the module for tasks execution.
[How] print("{'action':'%s'}" % task_result.__dict__['_task_fields']['action'])
{'action':'package'}
Signed-off-by: Wang Chenglong 18509160991@163.com --- tests/ansible_test | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/tests/ansible_test b/tests/ansible_test index 56926bbed..8c3e68c59 100755 --- a/tests/ansible_test +++ b/tests/ansible_test @@ -58,7 +58,17 @@ ansible_playbook_run() EOF [ $? -eq 0 ] && { echo "Playbook has been generated!" - } + } + [ $(command -v ansible-playbook) ] || { + echo "ansible-playbook: command not found" + exit 1 + } + + sed -i "536a\ print("{'action':'%s'}" % task_result.__dict__['_task_fields']['action'])" \ + ansible-playbook "$ansible_path"/site.yml + + sed -i "550a\ print("{'action':'%s'}" % task_result.__dict__['_task_fields']['action'])" \ + /usr/local/lib/python3.7/site-packages/ansible/plugins/strategy/__init__.py ansible-playbook "$ansible_path"/site.yml
if [ $? -eq 0 ]; then
Pls ignore this email
On Wed, Mar 31, 2021 at 09:39:48AM +0800, Wang Chenglong wrote:
[Why] modify ansible code to output the name of the module for tasks execution.
[How] print("{'action':'%s'}" % task_result.__dict__['_task_fields']['action'])
{'action':'package'}
Signed-off-by: Wang Chenglong 18509160991@163.com
tests/ansible_test | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/tests/ansible_test b/tests/ansible_test index 56926bbed..8c3e68c59 100755 --- a/tests/ansible_test +++ b/tests/ansible_test @@ -58,7 +58,17 @@ ansible_playbook_run() EOF [ $? -eq 0 ] && { echo "Playbook has been generated!"
}
}
[ $(command -v ansible-playbook) ] || {
echo "ansible-playbook: command not found"
exit 1
}
sed -i "536a\ print("{'action':'%s'}" % task_result.__dict__['_task_fields']['action'])" \
ansible-playbook "$ansible_path"/site.yml
sed -i "550a\ print("{'action':'%s'}" % task_result.__dict__['_task_fields']['action'])" \
/usr/local/lib/python3.7/site-packages/ansible/plugins/strategy/__init__.py
ansible-playbook "$ansible_path"/site.yml
if [ $? -eq 0 ]; then
-- 2.23.0