我已经将ansible.cfg配置为显示它在运行剧本期间完成的步骤,它看起来如下所示:
===============================================================================
common : Upgrade all packages --------------------------------------- 407.33s
jenkins-slave : compile git --------------------------------------- 153.26s
jenkins-slave : clone tss repo --------------------------------------- 44.61s
jenkins-slave : remove current git installation --------------------------------------- 24.22s
jenkins-slave : install java 1.8.0 --------------------------------------- 16.61s
jenkins-slave : download git source --------------------------------------- 12.44s
jenkins-slave : Install required packages --------------------------------------- 10.83s
jenkins-slave : clone repo --------------------------------------- 9.02s
common : Install base packages --------------------------------------- 6.74s
jenkins-slave : install nvm --------------------------------------- 5.72s
common : install pip --------------------------------------- 5.21s
common : Install base packages centos 7 --------------------------------------- 3.53s
node-exporter : download node-exporter tarball --------------------------------------- 2.83s
jenkins-slave : create "/opt/devenv/company" --------------------------------------- 1.97s
common : download pip --------------------------------------- 1.80s
Gathering Facts --------------------------------------- 1.69s
common : install pip packages --------------------------------------- 1.66s
jenkins-slave : unarchive git source --------------------------------------- 1.46s
node-exporter : untar node-exporter tarball --------------------------------------- 1.32sansible.cfg的配置如下:
[defaults]
nocows = 1
nocolor = 0
retry_files_enabled = False
display_skipped_hosts = True
host_key_checking = False
transport = paramiko
bin_ansible_callbacks = True
callback_whitelist = profile_tasks
forks = 25
[ssh_connection]
transfer_method = scp如果从输出中看到,顺序是混合的,并按每个任务的运行长度按降序排序。
如何对输出进行排序,以便根据任务的运行顺序显示任务?
发布于 2020-06-02 16:51:09
您可以在ini文件中添加一个条目,将回调插件的sort_order设置为none。
[callback_profile_tasks]
sort_order = none默认情况下,它被设置为降序,这就是为什么任务以减少时间的顺序显示的原因。
参考:https://docs.ansible.com/ansible/latest/plugins/callback/profile_Tasks.html#参数-排序_订单
https://devops.stackexchange.com/questions/11683
复制相似问题