r/sysadmin • • Nov 28 '20

Is scripting (bash/python/powershell) being frowned upon in these days of "configuration management automation" (puppet/ansible etc.)?

How in your environment is "classical" scripting perceived these days? Would you allow a non-admin "superuser" to script some parts of their workflows? Are there any hard limits on what can and cannot be scripted? Or is scripting being decisively phased out?

Configuration automation has gone a long way with tools like puppet or ansible, but if some "superuser" needed to create a couple of python scripts on their Windows desktops, for example to create links each time they create a folder would it allowed to run? No security or some other unexpected issues?

363 Upvotes

281 comments sorted by

View all comments

392

u/guemi IT Manager & DevOps Monkey Nov 28 '20

Scripting and configuration management are tools to do different tasks. So I don't see what either has to do with the other.

205

u/robvas Jack of All Trades Nov 28 '20

Visit the powershell sub sometimes. People try to re-invent the wheel every day :(

249

u/SenTedStevens Nov 28 '20

The more hilarious ones involve questions like, "We have a bunch of domain joined computers. How can I map drives/printers in PowerShell?"

GPOs have been around for a long time. Use that.

192

u/[deleted] Nov 28 '20

"I tried to use GPO to do it, but it didn't work. Now I tell everyone that GPO is flaky and unreliable because I made assumptions about how it works, and when it didn't work that way, I gave up instead of figuring out why"

I've met people with over a decade of windows experience like this. The most common error? Adding computers to a group, adding that group to a GPO, then rage quitting when the GPO didn't get applied to the computers.

34

u/Ssakaa Nov 28 '20

Could be worse, I've known people that think RAID is evil because they once had an issue where they couldn't recover a failed array... that they had no backups on... and after that refused to use it out of the assumption that they could recover from individual disks more reliably if one failed...

They did at least start making backups...

17

u/BrFrancis Nov 28 '20

Why is raid 0 a level? If raid is "redundant array of i-word disks" ... How is there a level of raid that isn't redundant.

What's really evil, is accessing files on network shares using iscsi so you can device mapper them into a raid 10 configuration and present that to a VM. Muahahahahhaha

10

u/Ssakaa Nov 28 '20

I mean, at that point, the word redundant is redundant, isn't it?

Redundant (adj): not or no longer needed or useful; superfluous.

And, the data itself must be superfluous, if someone's going to put it at that much excessive risk, so it sorta fits that the word stays...

→ More replies (1)

10

u/AmericanGeezus Sysadmin Nov 28 '20

Cause there is zero redundancy, duuuuuh.

→ More replies (4)

97

u/jews4beer Sysadmin turned devops turned dev Nov 28 '20

The "I can't figure out how it works therefore it sucks and is an unreliable tool" is a mindset that is pervasive across the entire IT industry.

28

u/CraigAT Nov 28 '20

True. But this also highlights the inability of IT companies to make products that work as users expect.

20

u/skat_in_the_hat Nov 28 '20

Sometimes you have to break the assumed mindset for something to work better. Look at the refusal to use SELinux by admins.

14

u/CraigAT Nov 28 '20

Agreed. The customer is not always right, but sometimes neither is the developer.

14

u/corsicanguppy DevOps Zealot Nov 28 '20

Agreed. Look at SELinux .

→ More replies (1)
→ More replies (8)
→ More replies (2)
→ More replies (2)

17

u/[deleted] Nov 28 '20

[removed] — view removed comment

34

u/Yescek Nov 28 '20

That comment is a bit of a "gotcha". That example doesn't really have enough detail to really get into the specific fix.

Possible solution would be to create an OU specifically for the subset of computers you're trying to apply the GPO to, then link the GPO to said OU.

Would need to make sure your new OU isn't inheriting any GPOs that could potentially conflict though.

15

u/Resolute002 Nov 28 '20

Also for some GPOs they don't take full effect until after restarts. In this era of largely remote work with the pandemic this surprises people all the time.

10

u/StatefulDecay Nov 28 '20

Especially when adding computers to security groups. The PC only checks for what it is a member of at restarts.

18

u/Resolute002 Nov 28 '20

When you add in this pandemic, and computers restarting off site... all of a sudden doing it by PowerShell doesn't seem so stupid.

→ More replies (1)
→ More replies (8)

17

u/Komnos Restitutor Orbis Nov 28 '20

Applying the GPO to whatever OU(s) the computers are in. Applying a GPO to a group is just a filter; it still won't apply to anything outside of the locations it's been linked to, even if they're members of the filtered group.

→ More replies (3)
→ More replies (22)

47

u/da_chicken Systems Analyst Nov 28 '20

I can excuse those. They're almost always places where the institution has no fucking idea what sysadmins actually need to do their job or that are terrified of things like domains. It's always someone trying to manage a network with a boss who doesn't know their ass from a hole in the ground.

The ones that irritate me start with, "I have this GUI that I wrote in Powershell...". Really? Look, just because it's a general purpose scripting language doesn't mean that you should publish an application written with it. C# is pretty easy!

Or the ones that call Read-Host. You know that parameters are there for a reason, right?

13

u/SenTedStevens Nov 28 '20 edited Nov 28 '20

In my first Junior Sys Admin role after I got promoted from help desk, GPOs were the first thing I started implementing. Initially, users got .bat or .vbs logon scripts that mapped resources but they weren't very reliable. We got too many calls from people saying their "L:" drive didn't map and logging out/back in fixed it. With a couple GPOs, that issue practically went away.

I agree with you how some people make fancy GUIs for things.

21

u/tossme68 Nov 28 '20

I love to make fancy GUIs from my scripts, it's not really for my benefit but when I've created a scriptlette with a nice GUI I distribute it to my co-workers. Some are smarter than others but in general I've found that if I add a gui they use the script and if I don't have a GUI they don't use it.

→ More replies (7)
→ More replies (10)
→ More replies (44)
→ More replies (23)

25

u/gordonv Nov 28 '20 edited Nov 28 '20

The tools used for configuration management are higher level abstractions of scripting configs. Config Management Software is merely the deduplication and simplification of scripts.

I'm not down talking config management software. In fact, it's great we can have a unified view and that many people can understand a simplified view of a complex setup. But it sucks that oversimplified software does not touch every need.

Like "systemd" in Ubuntu. It takes a lot of complex tasks and makes them easily identifiable, completable, and hard to screw up.

→ More replies (8)
→ More replies (10)