Q:

Single/simple way to set indentation to 2 for all modes

I'm a bit confused about setting indentation for different modes in Emacs.

It seems you have to explicitly set indentation for each mode
Some modes use setq-default, some use setq and some use add-hook
Indentation variables are inconsistently named

My question:
Is there a single indentation variable I can set that all modes inherit as a default?
If not, is there a shorter and more correct way to set up my indentation than listed below?
(setq-default tab-width 2)
(setq-default sh-basic-offset 2)
(setq-default sh-indentation 2) ;; workaround for bug in 25.3.1
(setq c-basic-offset 2
      css-indent-offset 2
      js-indent-level 2)
(add-hook 'php-mode-hook '(lambda ()
                            (setq c-basic-offset 2)))
(add-hook 'ess-mode-hook '(lambda ()
                            (setq ess-indent-offset 2)))

A:

No, there isn't.  Unlike other text editors and IDEs where all language support comes from one hand Emacs is a hodge-podge of modes of wildly varying quality.  Every mode may define its own way of customizing indentation (note the may, some modes deliberately ignore that topic), so unless you go the DIY route, it's perfectly normal to end up with that kind of init file.
If you forego the smart indentation feature, you could define your own indentation command that just inserts an indentation block.  That would be kind of silly (there are programming languages where indentation is more complicated, such as the Lisp and ML family), but give you the consistency you seek for.

