The author of Homo Deus is clearly an atheist and I am not, but that does not prevent me from finding his analysis of the human condition fascinating and very insightful. Here is what he writes on pg. 234-235 of his book. (The first paragraph describes quite well the mental world I live in and marks me as "premodern". So be it.)
Many of you will probably be more comfortable describing yourself as "modern". Your world view will be described in the second paragraph. However, if you're feeling smug about being "modern", don't neglect to read the last paragraph:
"In exchange for giving up power, premodern humans believed that their lives gained meaning. It really mattered whether they fought bravely on the battlefield, whether they supported the lawful king, whether they ate forbidden foods for breakfast or whether they had an affair with the next-door neighbour. This of course created some inconveniences, but it gave humans psychological protection against disasters. If something terrible happened — such as war, plague or drought — people consoled themselves that ‘We all play a role in some great cosmic drama devised by the gods or by the laws of nature. We are not privy to the script, but we can rest assured that everything happens for a purpose. Even this terrible war, plague and drought have their place in the greater scheme of things. Furthermore, we can count on the playwright that the story surely has a good and meaningful ending. So even the war, plague and drought will work out for the best — if not here and now, then in the afterlife.’ "