Walgreens Boots Alliance has agreed to buy its rival Rite Aid in a $17.2 billion all-cash deal. If approved by…