From 76ac6294e0d49d6de9b908e87f7507796254ffda Mon Sep 17 00:00:00 2001 From: Tom Paine Date: Mon, 11 Jan 2016 18:21:28 +0000 Subject: [PATCH 1/5] profile_tasks README.md As agreed with Brian Coca in Ansible Project group: https://groups.google.com/forum/#!searchin/ansible-project/tom$20paine/ansible-project/__nv6BZs2yU/AkYQ0HU-BQAJ --- lib/ansible/plugins/callback/profile_tasks.md | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 lib/ansible/plugins/callback/profile_tasks.md diff --git a/lib/ansible/plugins/callback/profile_tasks.md b/lib/ansible/plugins/callback/profile_tasks.md new file mode 100644 index 0000000000..b52081d83b --- /dev/null +++ b/lib/ansible/plugins/callback/profile_tasks.md @@ -0,0 +1,58 @@ +# profile_tasks.py +Ansible plugin for timing individual tasks and overall execution time. + +Mashup of 2 excellent original works: +- (https://github.com/jlafon/ansible-profile) +- (https://github.com/junaid18183/ansible_home/blob/master/ansible_plugins/callback_plugins/timestamp.py.old) + +## Usage + +Add `profile_taks` to the `callback_whitelist` in `ansible.cfg`. + +Run playbooks as normal. + +## Features + +### Tasks + +Ongoing timing of each task as it happens. + +Format: +` () ` + +```shell +TASK: [ensure messaging security group exists] ******************************** +Thursday 11 June 2017 22:50:53 +0100 (0:00:00.721) 0:00:05.322 ********* +ok: [localhost] + +TASK: [ensure db security group exists] *************************************** +Thursday 11 June 2017 22:50:54 +0100 (0:00:00.558) 0:00:05.880 ********* +changed: [localhost] +``` + +### Play Recap + +Recap includes ending timestamp, total playbook execution time and a sorted list of the top longest running tasks. + +No more wondering how old the results in a terminal window are. + +```shell + ansible + + PLAY RECAP ******************************************************************** + Thursday 11 June 2016 22:51:00 +0100 (0:00:01.011) 0:00:43.247 ********* + =============================================================================== + really slow task | Download project packages----------------------------11.61s + security | Really slow security policies----------------------------------7.03s + common-base | Install core system dependencies----------------------------3.62s + common | Install pip------------------------------------------------------3.60s + common | Install boto-----------------------------------------------------3.57s + nginx | Install nginx-----------------------------------------------------3.41s + serf | Install system dependencies----------------------------------------3.38s + duo_security | Install Duo Unix SSH Integration---------------------------3.37s + loggly | Install TLS version----------------------------------------------3.36s +``` + +## Compatibility + +Ansible 2.0+ From 9eca81537712222a49cc326efba207ce94d93d94 Mon Sep 17 00:00:00 2001 From: Tom Paine Date: Fri, 5 Feb 2016 18:06:10 +0000 Subject: [PATCH 2/5] Update profile_tasks.md Converted to RST. --- lib/ansible/plugins/callback/profile_tasks.md | 83 +++++++++++-------- 1 file changed, 47 insertions(+), 36 deletions(-) diff --git a/lib/ansible/plugins/callback/profile_tasks.md b/lib/ansible/plugins/callback/profile_tasks.md index b52081d83b..86d19e9bd4 100644 --- a/lib/ansible/plugins/callback/profile_tasks.md +++ b/lib/ansible/plugins/callback/profile_tasks.md @@ -1,58 +1,69 @@ -# profile_tasks.py +profile\_tasks.py +================= + Ansible plugin for timing individual tasks and overall execution time. Mashup of 2 excellent original works: -- (https://github.com/jlafon/ansible-profile) -- (https://github.com/junaid18183/ansible_home/blob/master/ansible_plugins/callback_plugins/timestamp.py.old) -## Usage +- (https://github.com/jlafon/ansible-profile) +- (https://github.com/junaid18183/ansible_home/blob/master/ansible_plugins/callback_plugins/timestamp.py.old) -Add `profile_taks` to the `callback_whitelist` in `ansible.cfg`. +Usage +----- + +Add ``profile_taks`` to the ``callback_whitelist`` in ``ansible.cfg``. Run playbooks as normal. -## Features +Features +-------- -### Tasks +Tasks +~~~~~ Ongoing timing of each task as it happens. -Format: -` () ` +| Format: +| `` () `` -```shell -TASK: [ensure messaging security group exists] ******************************** -Thursday 11 June 2017 22:50:53 +0100 (0:00:00.721) 0:00:05.322 ********* -ok: [localhost] +Task output example: -TASK: [ensure db security group exists] *************************************** -Thursday 11 June 2017 22:50:54 +0100 (0:00:00.558) 0:00:05.880 ********* -changed: [localhost] -``` +.. code:: shell -### Play Recap + TASK: [ensure messaging security group exists] ******************************** + Thursday 11 June 2017 22:50:53 +0100 (0:00:00.721) 0:00:05.322 ********* + ok: [localhost] -Recap includes ending timestamp, total playbook execution time and a sorted list of the top longest running tasks. + TASK: [ensure db security group exists] *************************************** + Thursday 11 June 2017 22:50:54 +0100 (0:00:00.558) 0:00:05.880 ********* + changed: [localhost] + +Play Recap +~~~~~~~~~~ + +Recap includes ending timestamp, total playbook execution time and a +sorted list of the top longest running tasks. No more wondering how old the results in a terminal window are. -```shell - ansible - - PLAY RECAP ******************************************************************** - Thursday 11 June 2016 22:51:00 +0100 (0:00:01.011) 0:00:43.247 ********* - =============================================================================== - really slow task | Download project packages----------------------------11.61s - security | Really slow security policies----------------------------------7.03s - common-base | Install core system dependencies----------------------------3.62s - common | Install pip------------------------------------------------------3.60s - common | Install boto-----------------------------------------------------3.57s - nginx | Install nginx-----------------------------------------------------3.41s - serf | Install system dependencies----------------------------------------3.38s - duo_security | Install Duo Unix SSH Integration---------------------------3.37s - loggly | Install TLS version----------------------------------------------3.36s -``` +.. code:: shell -## Compatibility + ansible + + PLAY RECAP ******************************************************************** + Thursday 11 June 2016 22:51:00 +0100 (0:00:01.011) 0:00:43.247 ********* + =============================================================================== + really slow task | Download project packages----------------------------11.61s + security | Really slow security policies----------------------------------7.03s + common-base | Install core system dependencies----------------------------3.62s + common | Install pip------------------------------------------------------3.60s + common | Install boto-----------------------------------------------------3.57s + nginx | Install nginx-----------------------------------------------------3.41s + serf | Install system dependencies----------------------------------------3.38s + duo_security | Install Duo Unix SSH Integration---------------------------3.37s + loggly | Install TLS version----------------------------------------------3.36s + +Compatibility +------------- Ansible 2.0+ From 5a88cd8ad9ef9217f771346615d34de490ecf1ba Mon Sep 17 00:00:00 2001 From: Tom Paine Date: Mon, 8 Feb 2016 15:02:50 +0000 Subject: [PATCH 3/5] Rename profile_tasks.md to profile_tasks.rst --- .../plugins/callback/{profile_tasks.md => profile_tasks.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lib/ansible/plugins/callback/{profile_tasks.md => profile_tasks.rst} (100%) diff --git a/lib/ansible/plugins/callback/profile_tasks.md b/lib/ansible/plugins/callback/profile_tasks.rst similarity index 100% rename from lib/ansible/plugins/callback/profile_tasks.md rename to lib/ansible/plugins/callback/profile_tasks.rst From 8e3cc3eecd7c09b8e5425543718fbbf235e00f8b Mon Sep 17 00:00:00 2001 From: Tom Paine Date: Mon, 8 Feb 2016 19:19:05 +0000 Subject: [PATCH 4/5] Update profile_tasks.rst --- lib/ansible/plugins/callback/profile_tasks.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/plugins/callback/profile_tasks.rst b/lib/ansible/plugins/callback/profile_tasks.rst index 86d19e9bd4..04fe309925 100644 --- a/lib/ansible/plugins/callback/profile_tasks.rst +++ b/lib/ansible/plugins/callback/profile_tasks.rst @@ -11,7 +11,7 @@ Mashup of 2 excellent original works: Usage ----- -Add ``profile_taks`` to the ``callback_whitelist`` in ``ansible.cfg``. +Add ``profile_tasks`` to the ``callback_whitelist`` in ``ansible.cfg``. Run playbooks as normal. From edb36b6c4aced8231b80b3deccc2c83687082ecb Mon Sep 17 00:00:00 2001 From: Tom Paine Date: Fri, 12 Feb 2016 17:13:39 +0000 Subject: [PATCH 5/5] Update profile_tasks.rst remove brackets on links --- lib/ansible/plugins/callback/profile_tasks.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/plugins/callback/profile_tasks.rst b/lib/ansible/plugins/callback/profile_tasks.rst index 04fe309925..a125d64260 100644 --- a/lib/ansible/plugins/callback/profile_tasks.rst +++ b/lib/ansible/plugins/callback/profile_tasks.rst @@ -5,8 +5,8 @@ Ansible plugin for timing individual tasks and overall execution time. Mashup of 2 excellent original works: -- (https://github.com/jlafon/ansible-profile) -- (https://github.com/junaid18183/ansible_home/blob/master/ansible_plugins/callback_plugins/timestamp.py.old) +- https://github.com/jlafon/ansible-profile +- https://github.com/junaid18183/ansible_home/blob/master/ansible_plugins/callback_plugins/timestamp.py.old Usage -----