We propose a field-theoretical approach based on the thermodynamic perturbation theory and within it derive a grand thermodynamic potential of the inhomogeneous ionic fluid as a functional of electrostatic potential for an arbitrary reference fluid system. We obtain a modified Poisson–Boltzmann (PB) equation as the Euler–Lagrange equation for the obtained functional. Applying Noether’s theorem to this functional, we derive a general mean-field expression for the stress tensor consistent with the respective modified PB equation. We derive a general expression for the macroscopic force acting on the dielectric or conductive body immersed in an ionic fluid. In particular, we derive a general mean-field expression for the disjoining pressure of an ionic fluid in a slit pore. We apply the developed formalism to describe three ionic fluid models of practical importance: nonpolarizable models (including the well-known PB and Poisson–Fermi equations), polarizable models (ions carry nonzero permanent dipole or static polarizability), and models of ion-dipole mixtures (including the well-known PB–Langevin equation). For these models, we obtain modified PB equations and respective stress tensors, which could be valuable for different applications, where it is necessary to estimate the macroscopic forces acting on the dielectric or conductive bodies (electrodes, colloids, membranes, etc) together with the local electrostatic potential (field) and ionic concentrations.