Hi,
can someone help me is it possible to count ignore_errors as failed in play
recap ? as below sample. it supposed to have 4 Failed.
Thanks,
Mujahiddin Janapi
PLAY [all]
***********************************************************************************************************************************************************************
TASK [Temp folder creation]
******************************************************************************************************************************************************
changed: [ninjalab]
changed: [wildcard]
changed: [equestcj]
TASK [Copy local template config to remote temp folder]
**************************************************************************************************************************
changed: [ninjalab] => (item={u'dest':
u'/tmp/devops-checks/sshd_config.template', u'src':
u'/home/mxj/project/sshd_config.template'})
changed: [wildcard] => (item={u'dest':
u'/tmp/devops-checks/sshd_config.template', u'src':
u'/home/mxj/project/sshd_config.template'})
changed: [equestcj] => (item={u'dest':
u'/tmp/devops-checks/sshd_config.template', u'src':
u'/home/mxj/project/sshd_config.template'})
changed: [ninjalab] => (item={u'dest':
u'/tmp/devops-checks/passwd.template', u'src':
u'/home/mxj/project/passwd.template'})
changed: [wildcard] => (item={u'dest':
u'/tmp/devops-checks/passwd.template', u'src':
u'/home/mxj/project/passwd.template'})
changed: [equestcj] => (item={u'dest':
u'/tmp/devops-checks/passwd.template', u'src':
u'/home/mxj/project/passwd.template'})
TASK [Copy remote current config to remote temp folder]
**************************************************************************************************************************
changed: [ninjalab] => (item={u'dest':
u'/tmp/devops-checks/sshd_config.current', u'src': u'/etc/ssh/sshd_config'})
changed: [wildcard] => (item={u'dest':
u'/tmp/devops-checks/sshd_config.current', u'src': u'/etc/ssh/sshd_config'})
changed: [equestcj] => (item={u'dest':
u'/tmp/devops-checks/sshd_config.current', u'src': u'/etc/ssh/sshd_config'})
changed: [ninjalab] => (item={u'dest':
u'/tmp/devops-checks/passwd.current', u'src': u'/etc/passwd'})
changed: [wildcard] => (item={u'dest':
u'/tmp/devops-checks/passwd.current', u'src': u'/etc/passwd'})
changed: [equestcj] => (item={u'dest':
u'/tmp/devops-checks/passwd.current', u'src': u'/etc/passwd'})
TASK [Analyzing sshd config]
*****************************************************************************************************************************************************
changed: [ninjalab]
changed: [wildcard]
fatal: [equestcj]: FAILED! => {"changed": true, "cmd": "diff -w
--side-by-side sshd_config.template sshd_config.current >
103.197.59.221sshd.out", "delta": "0:00:00.008898", "end": "2018-05-07
19:20:27.846172", "failed_when_result": true, "msg": "non-zero return
code", "rc": 1, "start": "2018-05-07 19:20:27.837274", "stderr": "",
"stderr_lines": [], "stdout": "", "stdout_lines": []}
...ignoring
TASK [Analyzing passwd file]
*****************************************************************************************************************************************************
fatal: [ninjalab]: FAILED! => {"changed": true, "cmd": "diff -w
--side-by-side passwd.template passwd.current > 128.199.149.173passwd.out",
"delta": "0:00:00.005960", "end": "2018-05-07 11:20:28.723825",
"failed_when_result": true, "msg": "non-zero return code", "rc": 1,
"start": "2018-05-07 11:20:28.717865", "stderr": "", "stderr_lines": [],
"stdout": "", "stdout_lines": []}
...ignoring
fatal: [wildcard]: FAILED! => {"changed": true, "cmd": "diff -w
--side-by-side passwd.template passwd.current > 128.199.241.228passwd.out",
"delta": "0:00:00.008222", "end": "2018-05-07 11:20:28.835798",
"failed_when_result": true, "msg": "non-zero return code", "rc": 1,
"start": "2018-05-07 11:20:28.827576", "stderr": "", "stderr_lines": [],
"stdout": "", "stdout_lines": []}
...ignoring
fatal: [equestcj]: FAILED! => {"changed": true, "cmd": "diff -w
--side-by-side passwd.template passwd.current > 103.197.59.221passwd.out",
"delta": "0:00:00.010196", "end": "2018-05-07 19:20:29.009931",
"failed_when_result": true, "msg": "non-zero return code", "rc": 1,
"start": "2018-05-07 19:20:28.999735", "stderr": "", "stderr_lines": [],
"stdout": "", "stdout_lines": []}
...ignoring
TASK [Clean-up remote temp folder]
***********************************************************************************************************************************************
changed: [ninjalab]
changed: [wildcard]
changed: [equestcj]
PLAY RECAP
***********************************************************************************************************************************************************************
equestcj : ok=6 changed=6 unreachable=0 failed=0
ninjalab : ok=6 changed=6 unreachable=0 failed=0
wildcard : ok=6 changed=6 unreachable=0 failed=0
- hosts: all
gather_facts: no
tasks:
- name: Temp folder creation
file:
path: /tmp/devops-checks
state: directory
- name: Copy local template config to remote temp folder
copy: src={{ item.src }} dest={{ item.dest }}
with_items:
- { src: '/home/mxj/project/sshd_config.template', dest:
'/tmp/devops-checks/sshd_config.template' }
- { src: '/home/mxj/project/passwd.template', dest:
'/tmp/devops-checks/passwd.template' }
- name: Copy remote current config to remote temp folder
copy: remote_src=true src={{ item.src }} dest={{ item.dest }}
with_items:
- { src: '/etc/ssh/sshd_config', dest:
'/tmp/devops-checks/sshd_config.current' }
- { src: '/etc/passwd', dest: '/tmp/devops-checks/passwd.current' }
- name: Analyzing sshd config
shell: diff -w --side-by-side sshd_config.template
sshd_config.current > {{ansible_host}}sshd.out
register: diff1_cmd
ignore_errors: true
failed_when: diff1_cmd.rc == 1
args:
chdir: /tmp/devops-checks/
- name: Analyzing passwd file
shell: diff -w --side-by-side passwd.template passwd.current >
{{ansible_host}}passwd.out
register: diff2_cmd
ignore_errors: true
failed_when: diff2_cmd.rc == 1
args:
chdir: /tmp/devops-checks/
- name: Clean-up remote temp folder
file:
path: /tmp/devops-checks
state: absent
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/06f64d62-69b3-42c6-a644-085d8996b138%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.