Bug 1458018

Summary: [RFE] Enable ansible logging by default
Product: OpenShift Container Platform Reporter: Eric Jones <erjones>
Component: InstallerAssignee: Scott Dodson <sdodson>
Status: CLOSED ERRATA QA Contact: Johnny Liu <jialiu>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.0.0CC: aos-bugs, erich, jokerman, mmccomas, rybrown, sdodson, tibrahim
Target Milestone: ---Keywords: Reopened
Target Release: 3.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
The ansible.cfg file distributed with openshift-ansible now sets a default log path of ~/openshift-ansible.log. This ensures that logs are written in a predictable location by default. In order to use the distributed ansible.cfg file you must first change directories to /usr/share/ansible/openshift-ansible before running playbooks. This ansible.cfg also sets other options meant to increase performance and reliability of openshift-ansible.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-11 07:19:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Eric Jones 2017-06-01 19:06:52 UTC
- What is the nature and description of the request? 
As an admin I require the ability to run Ansible playbooks and collect the logs at a later point.

- Why does the customer need this? (List the business requirements here) 
Because it is off by default so if you don't save the stdout, the details generated are gone quickly.

- How would the customer like to achieve this? (List the functional requirements here) 
Turn on the config setting in /etc/ansible/ansible.cfg (line 92 with ansible 2.2.3.0-1.el7.noarch installed)

- For each functional requirement listed, specify how Red Hat and the customer can test to confirm the requirement is successfully implemented.
Install ansible and have the logging setting enabled already

- Is there already an existing RFE upstream or in Red Hat Bugzilla?
no

Comment 8 Eric Rich 2017-12-21 17:02:22 UTC
Is the suggestion here that OpenShift override the default ansible configuration files so that they log anible run's to logs by default?

Comment 9 Ryan Brown 2017-12-21 17:41:47 UTC
Ansible takes configuration from projects as well. For example, if we had the OpenShift install playbooks in a directory like this: 


os-ansible-installer/
  - roles/
    - roleA/
    - roleB/
  - vars/
    - main.yml
    - site_vault.yml
  - install_openshift_playbook.yml
  - ansible.cfg

If, in the ansible.cfg, the OpenShift team supplied overrides to Ansible's logging options, then runs of `install_openshift_playbook.yml` would pick up those and any other configs in ansible.cfg. So there's no need to override system config.

Comment 10 Eric Rich 2017-12-21 18:06:57 UTC
(In reply to Ryan Brown from comment #9)
> If, in the ansible.cfg, the OpenShift team supplied overrides to Ansible's
> logging options, then runs of `install_openshift_playbook.yml` would pick up
> those and any other configs in ansible.cfg. So there's no need to override
> system config.

Here: https://github.com/openshift/openshift-ansible/blob/master/ansible.cfg#L10

Comment 12 Scott Dodson 2018-01-19 19:22:52 UTC
We need to update ansible.cfg to ensure that it logs and update the documentation to have them change directories to /usr/share/ansible/openshift-ansible prior to running playbooks.

Comment 13 Scott Dodson 2018-07-18 18:34:22 UTC
https://github.com/openshift/openshift-ansible/pull/9247

Sets log path to ~/openshift-ansible.log

We'll open a docs pr that instructs people to cd /usr/share/ansible/openshift-ansible prior to running playbooks.

Comment 14 Johnny Liu 2018-08-03 08:35:07 UTC
Verified this bug with openshift-ansible-3.11.0-0.10.0.git.0.91bb588None.noarch, and PASS.

# pwd
/usr/share/ansible/openshift-ansible

# cat ansible.cfg
<--snip-->
[defaults]
# Set the log_path
log_path = ~/openshift-ansible.log
<--snip-->

# cat ~/openshift-ansible.log
cat: /root/openshift-ansible.log: No such file or directory

# ansible-playbook -i /tmp/qe-inventory-host-file playbooks/openshift-checks/pre-install.yml

# ll ~/openshift-ansible.log
-rw-r--r--. 1 root root 75873 Aug  3 04:27 /root/openshift-ansible.log

Comment 16 errata-xmlrpc 2018-10-11 07:19:06 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:2652