Examine Ansible Changelogs
The Cray Configuration Management Framework (CMF) collects changes to files by Ansible plays in changelogs.
Ansible changelogs provide information about files created, modified, and deleted by Ansible. Changelogs are created for cray-ansible when it first runs during the init phase and again when cray-ansible runs for the second time, during the booted phase. These logs are stored on the SMW in /var/opt/cray/log/ansible.
Note that the Ansible changelogs record changes made by common methods; it is possible that some changes may not be captured.
Logs created in the first phase (init):
- sitelog-init
- Contains Ansible play output from each task in executed plays.
- file-changelog-init
- Human-readable listing of each file changed by an Ansible play.
- file-changelog-init.yaml
- Machine-readable listing of each file changed by an Ansible play.
Logs created in the second phase (booted):
- sitelog-booted
- Contains Ansible play output from each task in executed plays.
- file-changelog-booted
- Human-readable listing of each file changed by an Ansible play.
- file-changelog-booted.yaml
- Machine-readable listing of each file changed by an Ansible play.
This sitelog entry shows that a task updated the message of the day (motd) file.
2016-01-17 12:15:27,671 TASK: [cle_motd | task motd, release]
*****************************************
2016-01-17 12:15:27,671 changed: [localhost] => {"changed": true,
"cmd": "grep RELEASE /etc/opt/cray/release/cle-release | awk -F\\='{print $2}'",
"delta": "0:00:00.002536", "end": "2016-01-17 12:15:27.471384", "rc": 0,
"start": "2016-01-17 12:15:27.468848", "stderr": "", "stdout": "6.0.UP01", "warnings": []}
The location of failing task can be found in plays:
boot# grep -Rn "task motd, release" /etc/ansible \
/etc/opt/cray/config/current/ansible
/etc/ansible/roles/cle_motd/tasks/motd.yaml:15:- name: task motd, release
The file-changelog files show the Ansible phase, each changed file, and the play that changed the file. This an entry from a file-changelog-init changelog:
Apr 05 2016 21:07:47 (init) template: file '/etc/nologin' changed by Ansible
task file '/etc/ansible/roles/early/tasks/nologin.yaml' with owner=root,
group=root, mode=0775
This an entry from a file-changelog-booted changelog:
May 16 2016 22:26:39 (booted) lineinfile: file '/etc/hosts' changed by Ansible
task file '/etc/ansible/roles/hosts/tasks/main.yaml' with owner=None,
group=None, mode=NoneThe same entry for the /etc/hosts edit in the file-changelog-booted.yaml changelog:
- backup_file_path: ''
file_path: /etc/hosts
group: null
mode: null
module: lineinfile
owner: null
phase: booted
play: populate local hostfile
state: null
task_file: /etc/ansible/roles/hosts/tasks/main.yaml
task_name: Add additional hosts to master file
time: May 16 2016 22:26:39The changelog entry fields are:
| Field Name | Description |
|---|---|
| backup_file_path | Location of backup copy of file modified or deleted, if available. |
| file_path | Full path to the file which was modified. |
| group | Group given to the file if created or modified, or null if not specified. |
| mode | Permissions changed on the file if created or modified, or null if permissions were not changed. |
| module | Ansible module executed. |
| owner | Owner given to the file if created or modified, or null if not specified. |
| phase | Values are "booted" or "init". |
| play | Name of play making change. |
| state | Whether a line should be "present" or "absent". |
| task_file | Name of the task file which made the change. |
| task_name | Name of the task which made this change. |
| time | Format is "Month Day Year HH:mm:ss". |