Cameron also found himself locked in a more gracious battle with Justine Greening after she was shifted from transport, a post she had held for 10 months. She was asked to take over international development.
There were also suggestions that Jeremy Hunt, the surprise new health secretary, had been initially listed for the environment department.
At least Ken Clarke, the veteran justice secretary, had the good grace to join the political departure lounge by agreeing to be the minister without portfolio with the right to advise on economics.
Overall the reshuffle represents a clear shift if not quite a lurch to the right.
The appointment of Chris Grayling, initially slated to take over work and pensions, as the new justice secretary could, alongside Hunt's promotion, turn out to be the most significant announcement of a less than seismic cabinet-level reshuffle. (More wide-scale changes will occur at more junior ministerial levels over the next 24 hours.)
Despite his background at Channel 4 and as a former member of the SDP, Grayling knows how to please the party right, and he will take a tougher line on prisons, sentencing and the European convention. Clarke used to say: "Theresa May locks them up and I let them out." That will no longer be quite the set-up.
But Grayling, in the two and a half years left to him, will hardly have the money to start a big prison-building programme. He is more likely to take the payment-by-results model he had developed for the work programme at the Department for Work and Pensions and ensure it is used more widely in punishment in the community.
He will also be more prepared to stage confrontations with the European court of human rights and the European Union. That will please Tory backbenchers eager to see some edge about national sovereignty.
Grayling's departure also ensures that Duncan Smith will see his cherished universal credit model into implementation. But IDS has an iconic status in the Conservative party that will make it more difficult for George Osborne to secure a second round of big welfare cuts planned for next year. Expect to hear of threats of resignation.
But the appointment of Hunt is the most outward-facing decision, designed to rebuild the government's credentials on the NHS after the disaster of the health bill. Cameron simply cannot afford to go into the 2015 election with the whole of the NHS opposed to or confused by his reforms. It marks a strong vote of confidence in Hunt, but his dismissal would have reflected on Cameron and his own relations with the Murdoch empire.
Cameron will be relieved that Lansley, his former boss at Conservative central office, swallowed his pride to take up the post of leader of the House, a position that does not always signal the end of a political career, as Margaret Beckett found out when she was promoted to foreign secretary.
Hunt's departure could also make the government response to the Leveson inquiry's conclusions more even-handed. Leveson's inquiry into media regulation is likely to result in radical proposals that the government will be minded to resist. A response from Hunt, rightly or wrongly, would be seen to be hopelessly tainted.
Osborne, who retains his pre-eminent economic status as chancellor, will be pleased to see Owen Paterson as environment secretary, since he is likely to be open to a second round of relaxation of planning laws. Paterson leaves Northern Ireland with riots on the streets. Osborne will be equally pleased to see Greening leave transport after 11 months, since she was likely to resist his support for a third runway at Heathrow, another key plank of his growth agenda.
Grant Shapps, the new Conservative co-chairman, leaves the housing brief with plans laid for a big social housing programme, due to be announced this week. He will be a ubiquitous performer on TV, relieving some of the ridiculous load placed on Michael Fallon.
For the Liberal Democrats there are no changes at cabinet level, but there are expected to be extensive lower-level changes, with David Laws joining forces with Michael Gove to claim clearer co-ownership of schools and social mobility policy.
guardian.co.uk © Guardian News and Media Limited 2010