Skip to content

[WIP] Remove symlinks for Ansible components - #5140

Closed
mtnbikenc wants to merge 1 commit into
openshift:masterfrom
mtnbikenc:remove-symlinks
Closed

mtnbikenc wants to merge 1 commit into
openshift:masterfrom
mtnbikenc:remove-symlinks

Conversation

@mtnbikenc

Copy link
Copy Markdown
Member

Removing all the symlinks for Ansible components and referencing them using the ansible.cfg file. This will require running all playbooks from the repo root or ensure the user has a properly configured ansible.cfg file in the directory they are running ansible-playbook. We want the user to have these default settings anyway to run callback_plugins and have tweaks for performance improvements.

@mtnbikenc

Copy link
Copy Markdown
Member Author

aos-ci-test

serial: 1
handlers:
- include: roles/openshift_master/handlers/main.yml
- include: ../../../roles/openshift_master/handlers/main.yml

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that we are pulling handlers out of roles like this, but that is another issue to address.

@michaelgugino

Copy link
Copy Markdown
Contributor

+1, you read my mind.

@openshift-bot

Copy link
Copy Markdown

error: aos-ci-jenkins/OS_3.6_containerized for 3f4f288 (logs)

@openshift-bot

Copy link
Copy Markdown

error: aos-ci-jenkins/OS_3.6_NOT_containerized for 3f4f288 (logs)

@mtnbikenc

Copy link
Copy Markdown
Member Author

I expected CI to have a hard time with this.

@mtnbikenc

Copy link
Copy Markdown
Member Author

[test]

@openshift-bot

Copy link
Copy Markdown

Evaluated for openshift ansible test up to 3f4f288

@openshift-bot

Copy link
Copy Markdown

continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_openshift_ansible/475/) (Base Commit: 11f0b7a) (PR Branch Commit: 3f4f288)

@mtnbikenc

Copy link
Copy Markdown
Member Author

A few things to take into consideration when trying to implement something like this. We don't really want to require users to be in the repo root when they are running playbooks. Using the ANSIBLE_CONFIG environment variable to set the location of the ansible.cfg file could work, however the plugin and library paths are not relative to the ansible.cfg file. Oddly, the roles_path path IS relative to the ansible.cfg file. In order to get this to function in CI, we would need to set the ANSIBLE_CONFIG env var as a complete path AND add ${ANSIBLE_CONFIG} to the beginning of each of the plugin paths and library path. There are some issues in ansible/ansible regarding making paths defined in ansible.cfg relative paths so there may be something we would work with Ansible developers. Ultimately, it would be nice to not have to symlink everywhere just to get things to work.

export ANSIBLE_CONFIG=/complete/path/to/openshift-ansible
# In ansible.cfg
callback_plugins = ${ANSIBLE_CONFIG}/callback_plugins/
library = ${ANSIBLE_CONFIG}/library/
lookup_plugins = ${ANSIBLE_CONFIG}/lookup_plugins/
filter_plugins = ${ANSIBLE_CONFIG}/filter_plugins/
roles_path = roles/

It would be better if the paths in ansible.cfg were relative instead of having to include env vars.

@michaelgugino

Copy link
Copy Markdown
Contributor

It is customary in ansible projects to execute plays inside the directory of the project. It's also customary for roles to be inside the playbooks directory. This behavior should be expected and encouraged. All things should be either child directories of the root of the project, child directories of playbooks, or installed in normal ansible locations (eg roles in /etc/ansible/roles)

@ashcrow

ashcrow commented Aug 21, 2017

Copy link
Copy Markdown
Member

👍 to this. I echo Luke's ux issue for action plugins, but I still think this is the way to go given the options.

@sosiouxme

Copy link
Copy Markdown
Member

It is customary in ansible projects to execute plays inside the directory of the project.

It may be customary but it is problematic. Anything that breaks (or worse, works differently) just because of where the user has changed directory to is a support call waiting to happen (also, causes user frustration and loss of confidence in the product). I doubt it's common to have a set of playbooks as complicated as ours either.

Nonetheless, I think it's somewhat unavoidable that we want people to be running from the config we provide (unless they copy and explicitly tweak it). So thinking through what needs to happen...

  • Users of the containerized o-a shouldn't have a problem because we have control over the env vars and pwd there.
  • Users of the git checkout can hopefully follow the convention of running from repo root (we'll need to be very clear about why this is necessary) or if they'd rather, ensure they're setting env vars appropriately.
  • CI entrypoints will be a pain but we do control those too.
  • o-a RPM users - I am thinking of all the docs that say run ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/byo/config.yml because that's where the RPM places it. It's pretty awkward to say cd /usr/share/ansible/openshift-ansible && ansible-playbook playbooks/byo/config.yml. We could lay down /etc/ansible/ansible.cfg with the RPM and have a reasonable chance of that being used (though it's last in precedence) but it seems to me any approach to this suffers from references being relative to pwd instead of ansible.cfg.

@michaelgugino

Copy link
Copy Markdown
Contributor

@sosiouxme

I'm against dropping ansible.cfg into /etc/ansible. We certainly can't claim that file as our own system-wide. There may be other ansible projects installed on the same deployment host.

Adding small notes to the documentation regard where the playbooks should be run from is trivial.

If installing from dnf/yum, please cd into /usr/share... and run ..., otherwise, cd into the cloned source and run ... This is because we have modified ansible.cfg to support this product.

@ashcrow

ashcrow commented Aug 21, 2017

Copy link
Copy Markdown
Member

Agreed. Pushing the config on users system wide would be problematic. In the container version of the installer I believe we use a flag to specify the ansible config and we default to the one provided from our repo.

@sosiouxme

sosiouxme commented Aug 21, 2017 via email

Copy link
Copy Markdown
Member

@sosiouxme

Copy link
Copy Markdown
Member

If we're going to tell RPM users to cd /usr/share/ansible/openshift-ansible && ansible-playbook ... then we should probably put ansible.cfg in /usr/share/ansible/openshift-ansible with one of the RPMs. Currently atomic-openshift-utils puts utils/etc/ansible.cfg (which is different) in /usr/share/atomic-openshift-utils/ansible.cfg and it's not clear to me how plugins are referenced at all.

@sosiouxme

Copy link
Copy Markdown
Member

You will want my latest commit on https://github.com/openshift/openshift-ansible/pull/5125/commits ("fix integration tests").

Other than that the CI jobs all need to be changed as they're running the playbooks from RPMs, while sitting in the jobs directory and configured with /etc/ansible/ansible.cfg.

Finally, if we get past that and merge this, I'm pretty sure it will totally break QE's automation which is also RPM-based.

@mtnbikenc

Copy link
Copy Markdown
Member Author

Closing this for now. We'll revisit removing symlinks once we default to the containerized installer.

@mtnbikenc mtnbikenc closed this Aug 25, 2017
@mtnbikenc
mtnbikenc deleted the remove-symlinks branch August 25, 2017 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants