Regarding your question
I didn't find the ansible.log
on the server. Isn't it enable log by default?
you may have a look into Logging Ansible output.
By default Ansible sends output about plays, tasks, and module arguments to your screen (STDOUT) on the control node. If you want to capture Ansible output in a log, you have three options ...
Regarding your question
Is it possible to save execute state logging on the target server?
technically yes. But you would need to implement something by yourself. You could use the following approach in your playbooks
vars:
ROLE: "{{ playbook_dir.split('/')[4] }}"
TASK: "main"
- name: "Make sure there is a log directory for this role {{ ROLE }} and task {{ TASK }}"
file:
path: "/var/log/ansible/{{ ROLE }}/{{ TASK }}"
state: directory
- name: "Log applying role {{ ROLE }} and task {{ TASK }} with {{ ansible_run_tags }}"
lineinfile:
path: "/var/log/ansible/{{ ROLE }}/{{ TASK }}/lastexecution.{{ lookup('pipe', 'date +%Y%m%d') }}.log"
create: yes
line: "{{ lookup('pipe', 'date') }}, {{ ansible_run_tags }}, {{ ansible_user }}"
The date lookup can also be replaced by an Ansible fact.