Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible related research and improving the quality of yml files #260

Closed
AnkshitJain opened this issue Jan 24, 2018 · 2 comments
Closed

Ansible related research and improving the quality of yml files #260

AnkshitJain opened this issue Jan 24, 2018 · 2 comments

Comments

@AnkshitJain
Copy link
Collaborator

AnkshitJain commented Jan 24, 2018

Description

Obtain enough information about the working of Ansible and use this knowledge to improve the quality of the currently existing playbook structure for installation.

Steps to work on

  1. Variable scoping in Ansible

  2. Modules: Nature of scoping, how can we improve our playbooks using them, advantage of using well defined modules vs running commands using the shell module, and similarity with functions

  3. Retain the ansible logs when run through playbook (see serverfault). All ansible modules return stdout and stderror. Please see ansible docs.

  4. Including .ansible.cnf in our structure.

  5. What happens when hostname is not present in the inventory file?

  6. Iterating over groups of hosts in the inventory Mongo DB example.

  7. Find out the most frequently used modules, like apt, and the modules used in our yml files and how we can use them better.

  8. Waiting for Gitlab during installation can be done like here.

  9. Iterating over execution nodes to install in ansible

  10. Use Ansible tags to run selective tasks in a playbook

  11. Use Ansible variable and task includes along with tags to create extra execution nodes.

Expected behavior

Simpler ansible playbook files that reduces the complexity of installation.

Additional Information

A good resource for ansible examples is the resource shared by Ansible project.
The Ansible docs should help in finding the answers for almost all the points above.

@sneachta96
Copy link

  1. The ansible logs can be retained by using DeBUG . The module/task can be assigned a
    register and then , using parameter : var , statements during the execution can be obtained.

  2. The current code has the local inventory file which can be directly passed to ansible by overriding the
    ansible.cnf file.

  3. First ansible looks for the hosts in the local inventory , if not found would look in the default file for
    hosts which is "/etc/ansible/hosts" . If not found , then it shows that host is not matched.

4.Iterating over the execution nodes might not work . This feature is module dependent .Ansible runs
each loop iteration as separate run, so would end up with different ssh sessions.
There are some exceptions described in Ansible_Squash_variables variable: "apk, apt, dnf,
package, pacman, pkgng, yum, zypper"
These modules are smart enough to squash all items into a single task call.

@prasadtalasila
Copy link
Member

Not a priority now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants