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

refactor: ansible roles #934

Merged
merged 1 commit into from
Jun 19, 2024
Merged

refactor: ansible roles #934

merged 1 commit into from
Jun 19, 2024

Conversation

tenthirtyam
Copy link
Contributor

@tenthirtyam tenthirtyam commented Jun 5, 2024

Summary of Pull Request

Refactors:

  • Used of fully qualified module names.
  • Well-formed and named blocks.
  • Well-formed YAML.
  • Moved the when directive to top of blocks.
  • Prefixed task_names var with role name.
  • Added some changes to silence linter, as needed.
  • Moved SLE values to var/main.yml.

Type of Pull Request

  • This is a bugfix. type/bug
  • This is an enhancement or feature. type/feature or type/enhancement
  • This is a documentation update. type/docs
  • This is a refactoring update. type/refactor
  • This is a chore. type/chore
  • This is something else.
    Please describe:

Related to Existing Issues

Ref: #932

Test and Documentation Coverage

  • Tests have been completed.
  • Documentation has been added or updated.

Breaking Changes?

  • Yes, there are breaking changes.
  • No, there are no breaking changes.

@tenthirtyam tenthirtyam added type/refactor Refactor area/ansible Area: Ansible labels Jun 5, 2024
@tenthirtyam tenthirtyam added this to the v0.21.0 milestone Jun 5, 2024
@tenthirtyam tenthirtyam self-assigned this Jun 5, 2024
@vmwclabot vmwclabot added the cla-not-required Contributor License Agreement Not Required label Jun 5, 2024
@tenthirtyam
Copy link
Contributor Author

Hi @shaneholloman 👋 - would you mind reviewing this pull request based on the content you provided in #932?

@tenthirtyam tenthirtyam marked this pull request as ready for review June 5, 2024 19:22
@tenthirtyam tenthirtyam requested a review from a team as a code owner June 5, 2024 19:22
@tenthirtyam tenthirtyam requested review from GaryJBlake and removed request for GaryJBlake June 5, 2024 19:22
Copy link

@shaneholloman shaneholloman left a comment

Choose a reason for hiding this comment

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

Generally looks very good...

  • there are some inconsistencies (my fault) with quotes - mode: '0644' vs "0644" (single quotes are a preference) I noticed yesterday that running ansible-lint --fix will normalize all the quoting bits for free, very handy: single vs double and will also clean up items like the name: "Quoting as well" changes to name: Quoting as well so maybe that be could run as a separate test/commit?

  • If I even understand this correctly, I'd like to let vmware tools tell us which distro flavor it sees, rather than squashing it to simply: 'other5xLinux64Guest' - however I may not understand fully how vmware-tools works in this regard.

  • I see you kept the suse refactor for

    full_module_path: "{{ base_sle_module_name }}/{{ base_sle_module_version }}/{{ base_sle_architecture }}"
    

    Note: I haven't test that. but syntaxually it checks for me.


Without personally testing on very distro, looks good to me ... that said I'll be testing every distro in the project (except the paid distros Rhel and Suse) next week.

awesome work as usual, this project is very helpful and Im grateful its maintained so well.


aside: working on a clean way to let users include their additional playbooks/roles as this something we do here at work.

@tenthirtyam
Copy link
Contributor Author

tenthirtyam commented Jun 6, 2024

An update has been force-pushed in abc8e53 with the auto fixes by ansible-lint.

Copy link

@shaneholloman shaneholloman left a comment

Choose a reason for hiding this comment

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

nice work.

@Codehunter-py
Copy link

Hi

Currently, I receive an error during the provision of the VM. Is it fixed in this pr?

    vsphere-iso.linux-rocky: TASK [users : Configure the operating system users.] ***************************
    vsphere-iso.linux-rocky: The error appears to be in '/builds/itops/packer-examples-for-vsphere/<sensitive>/roles/users/tasks/linux.yml': line 24, column 3, but may
    vsphere-iso.linux-rocky: be elsewhere in the file depending on the exact syntax problem.
    vsphere-iso.linux-rocky:
    vsphere-iso.linux-rocky: The offending line appears to be:
    vsphere-iso.linux-rocky:
    vsphere-iso.linux-rocky: # Tasks for managing the authorized keys for the local users.
    vsphere-iso.linux-rocky: - name: Managing the authorized keys for the local users.
    vsphere-iso.linux-rocky:   ^ here
==> vsphere-iso.linux-rocky: Error executing Ansible: Non-zero exit status: exit status 4

KR
Ibrahim

@burnsjared0415
Copy link
Contributor

i tested this on Rocky 9.4 and 8.10 with out running into this issue. Ran through build around 4 times with success on each run

Refactors with:

- fully qualified module names
- properly formed blocks
- named blocks
- corrected indenttion
- moved the when directive to top of blocks
- idempotent commands
- prefixed task_names var with role name
- added some changed when's to silence linter where needed
- suse hard coded values moved to var/main.yml

Signed-off-by: Ryan Johnson <[email protected]>
@tenthirtyam tenthirtyam merged commit 129bf5c into develop Jun 19, 2024
@tenthirtyam tenthirtyam deleted the refactor/ansible-roles branch June 19, 2024 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ansible Area: Ansible cla-not-required Contributor License Agreement Not Required type/refactor Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants