[Why] Output meed to be displayed in the ansible_test.json file.
[Input] fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: '__mysql_packages' is undefined\n\nThe error appears to be in '/root/.ansible/roles/ansible-role-mysql/tasks/variables.yml': line 11, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Define mysql_packages.\n ^ here\n"}
PLAY RECAP ********************************************************************* localhost : ok=2 changed=0 unreachable=0 failed=1 skipped=1 rescued=0 ignored=0
[Output]
playbook.run.msg: The task includes an option with an undefined variable. The error was: '__mysql_packages' is undefined
The error appears to be in '/root/.ansible/roles/ansible-role-mysql/tasks/variables.yml': line 11, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Define mysql_packages. ^ here
nr_ok: 2 nr_changed: 0 nr_failed: 1 nr_skipped: 1 nr_rescued: 0 nr_ignored: 0
Signed-off-by: Zhang Yale ylzhangah@qq.com --- stats/ansible_test | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/stats/ansible_test b/stats/ansible_test index 4c7d07b3..f0766412 100755 --- a/stats/ansible_test +++ b/stats/ansible_test @@ -1,15 +1,17 @@ #!/usr/bin/env ruby +require 'json'
while (line = STDIN.gets) case line.chomp! + when /FAILED!\s+=>\s+({.*})/ + value = JSON.load($1)['msg'] + puts "playbook.run.msg: #{value}" when /ok=(\d+)\s+changed=(\d+)\s+unreachable=(\d+)\s+failed=(\d+)\s+skipped=(\d+)\s+rescued=(\d+)\s+ignored=(\d+)/ - puts "ansible_test.total.nr_ok: #{$1}" - puts "ansible_test.total.nr_changed: #{$2}" - puts "ansible_test.total.nr_failed: #{$4}" - puts "ansible_test.total.nr_skipped: #{$5}" - puts "ansible_test.total.nr_rescued: #{$6}" - puts "ansible_test.total.nr_ignored: #{$7}" - when /playbook_run_on_fail/ - puts line + puts "nr_ok: #{$1}" + puts "nr_changed: #{$2}" + puts "nr_failed: #{$4}" + puts "nr_skipped: #{$5}" + puts "nr_rescued: #{$6}" + puts "nr_ignored: #{$7}" end end
On Fri, Jan 22, 2021 at 11:12:58AM +0800, Zhang Yale wrote:
[Why] Output meed to be displayed in the ansible_test.json file.
^^need
Thanks, Baijing
[Input] fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: '__mysql_packages' is undefined\n\nThe error appears to be in '/root/.ansible/roles/ansible-role-mysql/tasks/variables.yml': line 11, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Define mysql_packages.\n ^ here\n"}
PLAY RECAP ********************************************************************* localhost : ok=2 changed=0 unreachable=0 failed=1 skipped=1 rescued=0 ignored=0
[Output]
playbook.run.msg: The task includes an option with an undefined variable. The error was: '__mysql_packages' is undefined
The error appears to be in '/root/.ansible/roles/ansible-role-mysql/tasks/variables.yml': line 11, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Define mysql_packages.
^ here
nr_ok: 2 nr_changed: 0 nr_failed: 1 nr_skipped: 1 nr_rescued: 0 nr_ignored: 0
Signed-off-by: Zhang Yale ylzhangah@qq.com
stats/ansible_test | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/stats/ansible_test b/stats/ansible_test index 4c7d07b3..f0766412 100755 --- a/stats/ansible_test +++ b/stats/ansible_test @@ -1,15 +1,17 @@ #!/usr/bin/env ruby +require 'json'
while (line = STDIN.gets) case line.chomp!
- when /FAILED!\s+=>\s+({.*})/
- value = JSON.load($1)['msg']
- puts "playbook.run.msg: #{value}" when /ok=(\d+)\s+changed=(\d+)\s+unreachable=(\d+)\s+failed=(\d+)\s+skipped=(\d+)\s+rescued=(\d+)\s+ignored=(\d+)/
- puts "ansible_test.total.nr_ok: #{$1}"
- puts "ansible_test.total.nr_changed: #{$2}"
- puts "ansible_test.total.nr_failed: #{$4}"
- puts "ansible_test.total.nr_skipped: #{$5}"
- puts "ansible_test.total.nr_rescued: #{$6}"
- puts "ansible_test.total.nr_ignored: #{$7}"
- when /playbook_run_on_fail/
- puts line
- puts "nr_ok: #{$1}"
- puts "nr_changed: #{$2}"
- puts "nr_failed: #{$4}"
- puts "nr_skipped: #{$5}"
- puts "nr_rescued: #{$6}"
- puts "nr_ignored: #{$7}" end
end
2.23.0
On Wed, Jan 27, 2021 at 04:28:41PM +0800, Bai Jing wrote:
On Fri, Jan 22, 2021 at 11:12:58AM +0800, Zhang Yale wrote:
[Why] Output meed to be displayed in the ansible_test.json file.
^^need
Ok, I got it.
thanks
[Input] fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: '__mysql_packages' is undefined\n\nThe error appears to be in '/root/.ansible/roles/ansible-role-mysql/tasks/variables.yml': line 11, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Define mysql_packages.\n ^ here\n"}
PLAY RECAP ********************************************************************* localhost : ok=2 changed=0 unreachable=0 failed=1 skipped=1 rescued=0 ignored=0
[Output]
playbook.run.msg: The task includes an option with an undefined variable. The error was: '__mysql_packages' is undefined
The error appears to be in '/root/.ansible/roles/ansible-role-mysql/tasks/variables.yml': line 11, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Define mysql_packages.
^ here
nr_ok: 2 nr_changed: 0 nr_failed: 1 nr_skipped: 1 nr_rescued: 0 nr_ignored: 0
Signed-off-by: Zhang Yale ylzhangah@qq.com
stats/ansible_test | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/stats/ansible_test b/stats/ansible_test index 4c7d07b3..f0766412 100755 --- a/stats/ansible_test +++ b/stats/ansible_test @@ -1,15 +1,17 @@ #!/usr/bin/env ruby +require 'json'
while (line = STDIN.gets) case line.chomp!
- when /FAILED!\s+=>\s+({.*})/
- value = JSON.load($1)['msg']
- puts "playbook.run.msg: #{value}" when /ok=(\d+)\s+changed=(\d+)\s+unreachable=(\d+)\s+failed=(\d+)\s+skipped=(\d+)\s+rescued=(\d+)\s+ignored=(\d+)/
- puts "ansible_test.total.nr_ok: #{$1}"
- puts "ansible_test.total.nr_changed: #{$2}"
- puts "ansible_test.total.nr_failed: #{$4}"
- puts "ansible_test.total.nr_skipped: #{$5}"
- puts "ansible_test.total.nr_rescued: #{$6}"
- puts "ansible_test.total.nr_ignored: #{$7}"
- when /playbook_run_on_fail/
- puts line
- puts "nr_ok: #{$1}"
- puts "nr_changed: #{$2}"
- puts "nr_failed: #{$4}"
- puts "nr_skipped: #{$5}"
- puts "nr_rescued: #{$6}"
- puts "nr_ignored: #{$7}" end
end
2.23.0