Gambling, in a colloquial and legal sense, generally refers to putting in money for a game of mostly luck or beyond your control in hopes of getting a payout. The less influence you have over it, the faster the payout (or loss), and the higher the chance is of you coming out at a loss, the more strongly it fits into the understood definition of gambling.
Doing anything that takes a risk isn't gambling. Bending over to tie your shoes is a risk. There's a chance you'll strain your back and be immobile for a week. But if you don't take that chance, you won't be able to work. But if you don't do it stupidly, barring the heavens simply being against you that day, you'll be fine.
Farming is the same. If you're not being careless and the heavens don't decide to destroy your crops, and particularly if you're at a point where you can call it a job, you'll be fine. Once a risk is on a long scale, like farming, it's called an investment.
Either way, you are out to lunch. Your definition is on point, but has nothing do with the discussion taking place.
This is different from speculation (or bending over to tie shoes) in that a risk is being assumed with an outcome in mind.