Walgreens Boots Alliance (WBA 1.97%) is at a crossroads. Its main  business isn't generating much growth, and so the company has been pivoting toward healthcare with plans to open hundreds of primary care clinics at its locations over the next few years. Between this new effort and the company's underwhelming recent results, it may not be a huge surprise that the stock is trading near its 10-year low.

Is this a stock that's too cheap to pass up right now, or is it a risky investment that's likely to fall even lower in the years ahead?

Why Walgreens could be a good buy

A couple of attractive features about Walgreens' stock right now have to do with its incredibly low valuation. At $35, the stock is trading around the levels it was back in 2012. While it has bounced off of its low for the year, this remains an incredibly discounted stock. At around 8 times earnings, the stock is well below the 22 times profits that investors are paying for the average healthcare stock.

And thanks to the discounted share price, Walgreens' dividend yield is also an attractive 5.6% -- more than three times the S&P 500's payout of 1.7%. It has also been increasing its dividend for 47 straight years, and so the odds are good that the dividend income you receive from the stock will rise.

The company's business is also fairly stable, with Walgreens running trusted neighborhood pharmacies that generate recurring traffic. The company recently reported earnings for the second quarter, ended Feb. 28, and revenue was up 3.3% year over year to $34.9 billion. While that's not amazing, with billions invested in VillageMD and the launch of hundreds of primary care clinics coming, Walgreens may have more opportunities for growth in the future.

Why investors should exercise caution

The big risk for investors is that the company may be tying up too much money into a healthcare venture that may not be profitable for years. Its new U.S. healthcare segment contributed $1.6 billion in revenue this past quarter, but it generated a modest gross profit of $110 million (on an adjusted basis). The company's U.S. retail pharmacy business, on other hand, generated an adjusted gross profit of $5.9 billion on revenue of $27.6 billion.

It'll take a while for the healthcare business to grow, but by 2025, Walgreens' goal for the segment is to hit up to $16 billion in revenue. While that sounds encouraging, it also hints at the scale of the expansion and investment that the business may need to commit to that new area of its operations. And that can put a squeeze on its already thin profit margins.

Plus, it may put the dividend at risk. Over the past six quarters, the company has generated $1.2 billion in cash flow from its day-to-day operations. While that's higher than the $829 million it paid out in dividends, that doesn't factor in other outflows for such items as plant, property, and equipment. These totaled an additional $1.1 billion.

There's a fair amount of risk here for investors. If the company's healthcare strategy stumbles or requires more cash flow than the company anticipates, that could spell trouble for not just the dividend, but the stock as well.

Is Walgreens' stock a buy?

If you're a risk-averse investor, you're better off avoiding Walgreens' stock. If, however, you're OK with taking on some risk, this can be a solid stock to buy right now.

Walgreens' reputation for being a trusted neighborhood pharmacy should put it in a strong position to succeed in the launch of primary care clinics and being more of a one-stop shop for consumers. And with a low price-to-earnings multiple, there's a bit of a buffer there, a margin of safety that makes this more of a calculated risk for investors to take.

It's a bit of a contrarian pick at this point, but Walgreens does have the potential to deliver some strong gains. Investors will have to be patient as a lot is riding on its healthcare expansion, and it could take at least a few years to determine how successful that is.