Hello,
Just a quick test with import_tasks vs import_tasks ansible statements:
[[email protected] ~]# cat base.yaml
---
- hosts: localhost
gather_facts: no
tasks:
- import_tasks: tasks.yaml
[[email protected] ~]# cat tasks.yaml
- set_fact:
name: 'username'
- name: Print name
debug:
var: name
[[email protected] ~]# ansible-playbook base.yaml
PLAY [localhost]
*******************************************************************************************************************
TASK [set_fact]
********************************************************************************************************************
Tuesday 13 November 2018 22:38:57 +0000 (0:00:00.216) 0:00:00.216 ******
ok: [localhost]
TASK [Print name]
******************************************************************************************************************
Tuesday 13 November 2018 22:38:57 +0000 (0:00:00.117) 0:00:00.333 ******
ok: [localhost] => {
"name": "username"
}
PLAY RECAP
*************************************************************************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0
Tuesday 13 November 2018 22:38:57 +0000 (0:00:00.156) 0:00:00.489 ******
===============================================================================
Print name
------------------------------------------------------------------------------------------------------------------
0.16s
set_fact
--------------------------------------------------------------------------------------------------------------------
0.12s
Same but with include_tasks:
[[email protected] ~]# ansible-playbook base.yaml
PLAY [localhost]
*******************************************************************************************************************
TASK [include_tasks]
***************************************************************************************************************
Tuesday 13 November 2018 22:39:34 +0000 (0:00:00.954) 0:00:00.954 ******
included: /root/tasks.yaml for localhost
TASK [set_fact]
********************************************************************************************************************
Tuesday 13 November 2018 22:39:34 +0000 (0:00:00.130) 0:00:01.084 ******
ok: [localhost]
TASK [Print name]
******************************************************************************************************************
Tuesday 13 November 2018 22:39:34 +0000 (0:00:00.098) 0:00:01.182 ******
ok: [localhost] => {
"name": "username"
}
PLAY RECAP
*************************************************************************************************************************
localhost : ok=3 changed=0 unreachable=0 failed=0
Tuesday 13 November 2018 22:39:34 +0000 (0:00:00.118) 0:00:01.300 ******
===============================================================================
include_tasks
---------------------------------------------------------------------------------------------------------------
0.13s
Print name
------------------------------------------------------------------------------------------------------------------
0.12s
set_fact
--------------------------------------------------------------------------------------------------------------------
0.10s
So, less output with import, that's cool. Also ARA output is better for
we have less tasks (65 with include_tasks and 53 with import_tasks, but
I didn't replace yet all include_tasks).
includes_tasks:
https://softwarefactory-project.io/logs/18/14218/1/check/sf-ci-functional-minimal/47ab525/ara-report/
import_tasks:
https://softwarefactory-project.io/logs/18/14218/7/check/sf-ci-functional-minimal/993d349/ara-report/
Finally perfs should be better for all import are pre-processed at the
time playbooks are parsed, check
https://docs.ansible.com/ansible/devel/user_guide/playbooks_reuse.html#dynamic-vs-static
Nico
_______________________________________________
Softwarefactory-dev mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/softwarefactory-dev