diff --git a/molecule/cookiecutter/scenario/driver/azure/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml b/molecule/cookiecutter/scenario/driver/azure/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml index 0fd501a992..9129f45610 100644 --- a/molecule/cookiecutter/scenario/driver/azure/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml +++ b/molecule/cookiecutter/scenario/driver/azure/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml @@ -4,7 +4,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" vars: resource_group_name: molecule location: westus diff --git a/molecule/cookiecutter/scenario/driver/azure/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml b/molecule/cookiecutter/scenario/driver/azure/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml index 138947ea68..ccfead2555 100644 --- a/molecule/cookiecutter/scenario/driver/azure/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml +++ b/molecule/cookiecutter/scenario/driver/azure/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml @@ -4,7 +4,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" vars: resource_group_name: molecule tasks: diff --git a/molecule/cookiecutter/scenario/driver/delegated/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml b/molecule/cookiecutter/scenario/driver/delegated/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml index f1a99154b5..74acf6da4b 100644 --- a/molecule/cookiecutter/scenario/driver/delegated/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml +++ b/molecule/cookiecutter/scenario/driver/delegated/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml @@ -4,7 +4,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: # Developer must implement. diff --git a/molecule/cookiecutter/scenario/driver/delegated/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml b/molecule/cookiecutter/scenario/driver/delegated/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml index 0d854d1a8d..c7ad3eb090 100644 --- a/molecule/cookiecutter/scenario/driver/delegated/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml +++ b/molecule/cookiecutter/scenario/driver/delegated/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml @@ -4,7 +4,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: # Developer must implement. diff --git a/molecule/cookiecutter/scenario/driver/ec2/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml b/molecule/cookiecutter/scenario/driver/ec2/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml index 05669d17ef..cf9b1ed33d 100644 --- a/molecule/cookiecutter/scenario/driver/ec2/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml +++ b/molecule/cookiecutter/scenario/driver/ec2/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml @@ -4,7 +4,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" vars: ssh_user: ubuntu ssh_port: 22 diff --git a/molecule/cookiecutter/scenario/driver/ec2/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml b/molecule/cookiecutter/scenario/driver/ec2/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml index 118cb8118e..bcf8bef669 100644 --- a/molecule/cookiecutter/scenario/driver/ec2/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml +++ b/molecule/cookiecutter/scenario/driver/ec2/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml @@ -4,7 +4,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - block: - name: Populate instance config diff --git a/molecule/cookiecutter/scenario/driver/gce/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml b/molecule/cookiecutter/scenario/driver/gce/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml index 32a3de3dd1..82e249bca4 100644 --- a/molecule/cookiecutter/scenario/driver/gce/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml +++ b/molecule/cookiecutter/scenario/driver/gce/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml @@ -4,7 +4,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" vars: ssh_port: 22 ssh_user: "{{ lookup('env', 'USER') }}" diff --git a/molecule/cookiecutter/scenario/driver/gce/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml b/molecule/cookiecutter/scenario/driver/gce/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml index 85903ebf3d..107aed4bb3 100644 --- a/molecule/cookiecutter/scenario/driver/gce/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml +++ b/molecule/cookiecutter/scenario/driver/gce/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml @@ -4,7 +4,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Destroy molecule instance(s) gce: diff --git a/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml b/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml index c96608717f..d9f8ef3b08 100644 --- a/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml +++ b/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml @@ -4,7 +4,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Create molecule instance(s) lxc_container: diff --git a/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml b/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml index 8a459dbc9d..167b9e988c 100644 --- a/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml +++ b/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml @@ -4,7 +4,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Destroy molecule instance(s) lxc_container: diff --git a/molecule/cookiecutter/scenario/driver/lxd/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml b/molecule/cookiecutter/scenario/driver/lxd/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml index d2508fbeaf..ceca4fa051 100644 --- a/molecule/cookiecutter/scenario/driver/lxd/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml +++ b/molecule/cookiecutter/scenario/driver/lxd/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml @@ -4,7 +4,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Create molecule instance(s) lxd_container: diff --git a/molecule/cookiecutter/scenario/driver/lxd/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml b/molecule/cookiecutter/scenario/driver/lxd/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml index 2985567d1f..30fafd1e7e 100644 --- a/molecule/cookiecutter/scenario/driver/lxd/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml +++ b/molecule/cookiecutter/scenario/driver/lxd/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml @@ -4,7 +4,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Destroy molecule instance(s) lxd_container: diff --git a/molecule/cookiecutter/scenario/driver/openstack/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml b/molecule/cookiecutter/scenario/driver/openstack/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml index 29cf5ab8ff..93a7945cef 100644 --- a/molecule/cookiecutter/scenario/driver/openstack/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml +++ b/molecule/cookiecutter/scenario/driver/openstack/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml @@ -4,7 +4,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" vars: ssh_user: cloud-user ssh_port: 22 diff --git a/molecule/cookiecutter/scenario/driver/openstack/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml b/molecule/cookiecutter/scenario/driver/openstack/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml index 9d03d08575..7a3d2a8d49 100644 --- a/molecule/cookiecutter/scenario/driver/openstack/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml +++ b/molecule/cookiecutter/scenario/driver/openstack/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml @@ -4,7 +4,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Destroy molecule instance(s) os_server: diff --git a/molecule/model/schema_v2.py b/molecule/model/schema_v2.py index f11657c9f3..a9978508e5 100644 --- a/molecule/model/schema_v2.py +++ b/molecule/model/schema_v2.py @@ -267,6 +267,9 @@ def pre_validate_base_schema(env, keep_string): 'name': { 'type': 'string', }, + 'log': { + 'type': 'boolean', + }, 'config_options': { 'type': 'dict', 'schema': { diff --git a/molecule/provisioner/ansible.py b/molecule/provisioner/ansible.py index 7f9e15e87d..4ef3caad50 100644 --- a/molecule/provisioner/ansible.py +++ b/molecule/provisioner/ansible.py @@ -69,6 +69,16 @@ class Ansible(base.Base): to the underlying `ansible-playbook` command when executing `molecule --debug`. + Molecule will silence log output, unless invoked with the `--debug` flag. + However, this results in quite a bit of output. To enable Ansible log + output, add the following to the `provisioner` section of `molecule.yml`. + + .. code-block:: yaml + + provisioner: + name: ansible + log: True + The create/destroy playbooks for Docker and Vagrant are bundled with Molecule. These playbooks have a clean API from `molecule.yml`, and are the most commonly used. The bundled playbooks can still be overriden. diff --git a/molecule/provisioner/ansible/playbooks/docker/create.yml b/molecule/provisioner/ansible/playbooks/docker/create.yml index 5b453efbb7..c8f26c2f3a 100644 --- a/molecule/provisioner/ansible/playbooks/docker/create.yml +++ b/molecule/provisioner/ansible/playbooks/docker/create.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Log into a Docker registry docker_login: diff --git a/molecule/provisioner/ansible/playbooks/docker/destroy.yml b/molecule/provisioner/ansible/playbooks/docker/destroy.yml index fa48f36a21..d4a8b751d2 100644 --- a/molecule/provisioner/ansible/playbooks/docker/destroy.yml +++ b/molecule/provisioner/ansible/playbooks/docker/destroy.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Destroy molecule instance(s) docker_container: diff --git a/molecule/provisioner/ansible/playbooks/vagrant/create.yml b/molecule/provisioner/ansible/playbooks/vagrant/create.yml index 4136704f4c..d434f69892 100644 --- a/molecule/provisioner/ansible/playbooks/vagrant/create.yml +++ b/molecule/provisioner/ansible/playbooks/vagrant/create.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Create molecule instance(s) molecule_vagrant: diff --git a/molecule/provisioner/ansible/playbooks/vagrant/destroy.yml b/molecule/provisioner/ansible/playbooks/vagrant/destroy.yml index c340c81834..223ae44a1a 100644 --- a/molecule/provisioner/ansible/playbooks/vagrant/destroy.yml +++ b/molecule/provisioner/ansible/playbooks/vagrant/destroy.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Destroy molecule instance(s) molecule_vagrant: diff --git a/test/resources/playbooks/azure/create.yml b/test/resources/playbooks/azure/create.yml index 65ce6c8216..93e1a3ae85 100644 --- a/test/resources/playbooks/azure/create.yml +++ b/test/resources/playbooks/azure/create.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" vars: resource_group_name: molecule location: westus diff --git a/test/resources/playbooks/azure/destroy.yml b/test/resources/playbooks/azure/destroy.yml index 56b06f03a5..f95ff3ce1f 100644 --- a/test/resources/playbooks/azure/destroy.yml +++ b/test/resources/playbooks/azure/destroy.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" vars: resource_group_name: molecule tasks: diff --git a/test/resources/playbooks/docker/create.yml b/test/resources/playbooks/docker/create.yml index deb32c1bb6..068eabf519 100644 --- a/test/resources/playbooks/docker/create.yml +++ b/test/resources/playbooks/docker/create.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Log into a Docker registry docker_login: diff --git a/test/resources/playbooks/docker/destroy.yml b/test/resources/playbooks/docker/destroy.yml index fa48f36a21..d4a8b751d2 100644 --- a/test/resources/playbooks/docker/destroy.yml +++ b/test/resources/playbooks/docker/destroy.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Destroy molecule instance(s) docker_container: diff --git a/test/resources/playbooks/ec2/create.yml b/test/resources/playbooks/ec2/create.yml index 721d16167f..32679d06fc 100644 --- a/test/resources/playbooks/ec2/create.yml +++ b/test/resources/playbooks/ec2/create.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" vars: ssh_user: ubuntu ssh_port: 22 diff --git a/test/resources/playbooks/ec2/destroy.yml b/test/resources/playbooks/ec2/destroy.yml index ee3b48970e..485993d10f 100644 --- a/test/resources/playbooks/ec2/destroy.yml +++ b/test/resources/playbooks/ec2/destroy.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" vars: resource_group_name: molecule tasks: diff --git a/test/resources/playbooks/gce/create.yml b/test/resources/playbooks/gce/create.yml index e3cbd47060..7027231c43 100644 --- a/test/resources/playbooks/gce/create.yml +++ b/test/resources/playbooks/gce/create.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" vars: ssh_port: 22 ssh_user: "{{ lookup('env', 'USER') }}" diff --git a/test/resources/playbooks/gce/destroy.yml b/test/resources/playbooks/gce/destroy.yml index 4e22489c2c..8d0ab8cf22 100644 --- a/test/resources/playbooks/gce/destroy.yml +++ b/test/resources/playbooks/gce/destroy.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Destroy molecule instance(s) gce: diff --git a/test/resources/playbooks/lxc/create.yml b/test/resources/playbooks/lxc/create.yml index e7d6dc588f..37e30c202b 100644 --- a/test/resources/playbooks/lxc/create.yml +++ b/test/resources/playbooks/lxc/create.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Create molecule instance(s) lxc_container: diff --git a/test/resources/playbooks/lxc/destroy.yml b/test/resources/playbooks/lxc/destroy.yml index 8c112d4cd4..f4ce249a82 100644 --- a/test/resources/playbooks/lxc/destroy.yml +++ b/test/resources/playbooks/lxc/destroy.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Destroy molecule instance(s) lxc_container: diff --git a/test/resources/playbooks/lxd/create.yml b/test/resources/playbooks/lxd/create.yml index d6b37f02c7..6d15c6cf54 100644 --- a/test/resources/playbooks/lxd/create.yml +++ b/test/resources/playbooks/lxd/create.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Create molecule instance(s) lxd_container: diff --git a/test/resources/playbooks/lxd/destroy.yml b/test/resources/playbooks/lxd/destroy.yml index 2176a9ffb9..c23f735c97 100644 --- a/test/resources/playbooks/lxd/destroy.yml +++ b/test/resources/playbooks/lxd/destroy.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Destroy molecule instance(s) lxd_container: diff --git a/test/resources/playbooks/openstack/create.yml b/test/resources/playbooks/openstack/create.yml index 03233a6fa0..d91fc5b2c0 100644 --- a/test/resources/playbooks/openstack/create.yml +++ b/test/resources/playbooks/openstack/create.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" vars: ssh_user: cloud-user ssh_port: 22 diff --git a/test/resources/playbooks/openstack/destroy.yml b/test/resources/playbooks/openstack/destroy.yml index b626634b5b..ce1d8d6d2a 100644 --- a/test/resources/playbooks/openstack/destroy.yml +++ b/test/resources/playbooks/openstack/destroy.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Destroy molecule instance(s) os_server: diff --git a/test/resources/playbooks/vagrant/create.yml b/test/resources/playbooks/vagrant/create.yml index 4136704f4c..d434f69892 100644 --- a/test/resources/playbooks/vagrant/create.yml +++ b/test/resources/playbooks/vagrant/create.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Create molecule instance(s) molecule_vagrant: diff --git a/test/resources/playbooks/vagrant/destroy.yml b/test/resources/playbooks/vagrant/destroy.yml index c340c81834..223ae44a1a 100644 --- a/test/resources/playbooks/vagrant/destroy.yml +++ b/test/resources/playbooks/vagrant/destroy.yml @@ -3,7 +3,7 @@ hosts: localhost connection: local gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Destroy molecule instance(s) molecule_vagrant: diff --git a/test/scenarios/side_effect/molecule/default/side_effect.yml b/test/scenarios/side_effect/molecule/default/side_effect.yml index f519d0f2b3..dee4ef09e1 100644 --- a/test/scenarios/side_effect/molecule/default/side_effect.yml +++ b/test/scenarios/side_effect/molecule/default/side_effect.yml @@ -2,7 +2,7 @@ - name: Side Effect hosts: all gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" + no_log: "{{ not (lookup('env', 'MOLECULE_DEBUG') | bool or molecule_yml.provisioner.log|default(false) | bool) }}" tasks: - name: Kill ntpd on target command: pkill ntpd diff --git a/test/unit/model/v2/test_provisioner_section.py b/test/unit/model/v2/test_provisioner_section.py index 36f07572ac..a093b1a552 100644 --- a/test/unit/model/v2/test_provisioner_section.py +++ b/test/unit/model/v2/test_provisioner_section.py @@ -28,6 +28,7 @@ def _model_provisioner_section_data(): return { 'provisioner': { 'name': 'ansible', + 'log': True, 'config_options': { 'foo': 'bar', }, @@ -91,6 +92,7 @@ def _model_provisioner_errors_section_data(): return { 'provisioner': { 'name': int(), + 'log': int, 'config_options': [], 'connection_options': [], 'options': [], @@ -164,6 +166,7 @@ def test_provisioner_has_errors(_config): }], 'options': ['must be of dict type'], 'name': ['must be of string type'], + 'log': ['must be of boolean type'], }] }