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

Make laptop role optional #126

Open
petRUShka opened this issue Oct 2, 2024 · 2 comments
Open

Make laptop role optional #126

petRUShka opened this issue Oct 2, 2024 · 2 comments

Comments

@petRUShka
Copy link
Contributor

petRUShka commented Oct 2, 2024

Sometimes it is useful to install spark on desktop. In that case, tlp and friends are useless.

My proposal is to add laptop variable and don't apply laptop role if variable is False.

Something like:

  - { role: laptop, tags: ['laptop'], when: "laptop | bool" }
@pigmonkey
Copy link
Owner

Similar to #124, the idea is that you'd clone the repo, create your own branch, and remove whatever roles you don't want from the playbook. I don't think there is any additional value in creating a variable for the role.

If Ansible can reliably detect if a machine is a laptop or not, and stores that in one of its default system vars, I'd be good with adding that as a condition to the role. Similar to how Ansible can detect if it is running on a Thinkpad or not, and how we use that to decide if we should run that role. I haven't looked to see if there is some sort of generic "laptop" variable.

@petRUShka
Copy link
Contributor Author

petRUShka commented Oct 2, 2024

The only idea I have is to check whether the device has battery. Something like this:

shell: '[ -d /sys/class/power_supply/BAT0 ] && echo "Battery found" || echo "No battery"'

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

No branches or pull requests

2 participants