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

Fix LXC container implementations #231

Merged
merged 21 commits into from
Mar 3, 2023
Merged

Fix LXC container implementations #231

merged 21 commits into from
Mar 3, 2023

Conversation

Nomsplease
Copy link
Contributor

I moved branches around and it caused quite the Chaos on this PR. This a re-open of #219 with the same changes, just moved to a different branch

Proposed Changes

  • correct some implementation ideas for lxc supprt
  • We should not assume the rc.local is empty and just overwrite it, we can do this better and insert a managed code block
  • We also should not assume we are root on reboot handler, and become has been added to this handler
  • Also added resetting the lxc modification to a untouched state inside the container, resetting the lxc config in the host may also be a worthwhile adventure to make sure we get as close to original as possible.

Checklist

  • Tested locally
  • Ran site.yml playbook
  • Ran reset.yml playbook
  • Did not add any unnecessary changes
  • Ran pre-commit install at least once before committing
  • 🚀

remote_user: "{{ proxmox_lxc_ssh_user }}"
roles:
- role: reset_proxmox_lxc
when: proxmox_lxc_configure
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this always run? I suppose there is a chance that the user configured these values outside of this playbook, and this would remove them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel like it should, only because I consider this playbook as a it should configure and manage everything. If we don't we could leave security issues where they don't need to exist without user knowledge.

Copy link
Contributor

Choose a reason for hiding this comment

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

Think I agree, think the logic here should be that we assume these hosts are dedicated to k3s, so we should make sure this stuff is torn down through the reset process. Don't feel too strongly here though. Would just mean removing this when condition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That or the user just does not specify that the LXC is configured and hits those functions manually. I personally do this as the LXCs are dedicated solely to K3s, as I imagine most people do.

@acdoussan
Copy link
Contributor

One super small comment, but I'm good with these changes as is 👍

@timothystewart6
Copy link
Contributor

Looks like we have some lint. We aren't using the literal true for become, we've been using yes

@Nomsplease
Copy link
Contributor Author

Looks like we have some lint. We aren't using the literal true for become, we've been using yes

Im seeing in a lot of other files they are used interchangeably, but the standard for Ansible is True/False. Would you like me to swap these from True/False to Yes/No?

@timothystewart6
Copy link
Contributor

timothystewart6 commented Feb 13, 2023

I'd just leave the ones in place so that this PR only contains your changes. We have an issue to change them all at once, which will probably require new lint rules. too. #204

If you install all of the dependencies it will fix and fail on commits, rather than later in CI.

@Nomsplease
Copy link
Contributor Author

Ok that should be the last lint error, hopefully.

@timothystewart6
Copy link
Contributor

Looks like the cleanup is failing

 Remove rc.local modificaitons for proxmox lxc containers

@timothystewart6
Copy link
Contributor

@Nomsplease one small fix and then it's ready to go!

@Nomsplease
Copy link
Contributor Author

@timothystewart6 ill get this corrected and update when done. Did you run locally and get an error? Curious how that step failed for you.

@timothystewart6
Copy link
Contributor

@timothystewart6
Copy link
Contributor

timothystewart6 commented Feb 20, 2023

(expand and look at line 956)

@Nomsplease
Copy link
Contributor Author

Updated branch and changed how we handle the rc.local file. This is a good catch because we should not be touching this file on a host that was not setup with lxc in the first place.

roles/lxc/tasks/main.yml Outdated Show resolved Hide resolved
roles/reset/tasks/main.yml Outdated Show resolved Hide resolved
roles/reset_proxmox_lxc/tasks/main.yml Show resolved Hide resolved
roles/reset/tasks/main.yml Show resolved Hide resolved
@timothystewart6
Copy link
Contributor

We're so close to the finish line. What's left?

@Nomsplease
Copy link
Contributor Author

We're so close to the finish line. What's left?

All we had were the other review changes, but I think we are good to go on the functionality that was intended in this change.

@Nomsplease
Copy link
Contributor Author

I pulled the current upstream into this branch. One last round of checks should not hurt here and we can make the merge as smooth as possible.

@timothystewart6
Copy link
Contributor

Thank you all for working through this. If we need to change a pattern, we can add a new issue for it! Thanks again everyone!

@timothystewart6 timothystewart6 merged commit 3a1a7a1 into techno-tim:master Mar 3, 2023
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.

None yet

4 participants