add static facility and apply to register (#49737)

* add static facility and apply to register

* added warning

* added test for templated register

* test register 'static' status

* rely on subshell to deal with quote context

* use corrects pb for test

* bring constants back cause new code in devel
This commit is contained in:
Brian Coca
2019-01-24 11:51:52 -05:00
committed by GitHub
parent ffac260c66
commit be776daefe
7 changed files with 29 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
- hosts: testhost
gather_facts: false
tasks:
- name: template in register warns, but no template should not
debug: msg=unimportant
register: thisshouldnotwarn

View File

@@ -3,3 +3,5 @@
set -eux
ansible-playbook test_templating_settings.yml -i ../../inventory -v "$@"
ansible-playbook warn_on_register.yml -i ../../inventory -v "$@" 2>&1| grep 'is not templatable, but we found'
[ "$(ansible-playbook dont_warn_register.yml -i ../../inventory -v "$@" 2>&1| grep -c 'is not templatable, but we found')" == "0" ]

View File

@@ -0,0 +1,8 @@
- hosts: testhost
gather_facts: false
vars:
thisshouldwarn: noreally
tasks:
- name: template in register warns
debug: msg=unimportant
register: '{{ thisshouldwarn }}'