To what extent were mathematicians in previous centuries aware of the lack of rigour in their methods? By modern standards, much of pre-modern mathematics isn't rigorous. Famous examples include Euler's solution to the Basel problem or literally anything involving sets before Cantor and Russel came along, when a "set" was simply a handwaving notion of "all things that have some property", later found to be quite problematic.
To what extent were the mathematicians of the past aware of these shortcomings? Did they even feel mathematics needed to be a rigorous subject, or was there an idea that anything goes as long as it works?
I feel this question is not just of historical interest. Modern mathematics is usually judged (by modern mathematics) to be rigorous, but we have no reason to believe we are able to assess our methods correctly unless our predecessors were capable of assessing theirs.
 A: Lagrange launched a contest at the end of the 18th century whose goal was to clarify the notions of infinity and infinitesimal. There was no clear winner, but Lazare Carnot submitted an entry which eventually became a popular book. This is only one episodes illustrating the fact that rigor has indeed been a concern historically. 
A century earlier, there was a debate at the French academy focusing on similar issues, opposing Rolle and Varignon. 
In the 19th century, Cauchy lists rigor as one of the objectives of his approach to analysis.
So to answer your question, mathematicians in previous centuries were aware of lack of rigor, but in most cases attributed it to their predecessors only. This seems to be the case today, as well.
A: It is a little known fact that much of Bernhardt Riemann's work had remained un-rigorous until Hilbert's arrival on the mathematical scene some fifty years after Riemann's death.  Riemann was aware of his shortcomings, but many before him were not.  Did you know that complex numbers were not properly accepted until the nineteenth century?  The historian D.T. Whiteside considered Newton's first proposition in the Principia to be problemmatic.  According to Michael Atiyah, it took hundreds of years after Newton's death for calculus to be made properly rigorous.  It is worth pointing out that in Newton's day, Euclidean geometry was considered to be more rigorous than the new-fangled algebraic approach introduced by Descartes (according to historian of mathematics S. Hollingdale).  Also, Euler was ignorant of the fact that he had made some completely incorrect deductions concerning alternating series.  Of course, we know from the correspondence of G.H. Hardy that the great Ramanujan did not possess properly rigorous proofs for several of his 4000+ theorems.  In the nineteenth century there was at least one mathematician who had erroneously believed during his lifetime he had correctly proved a special case of Fermat's last theorem.  According to Felix Klein, even the great Gauss did not appear to be to concerned about being rigorous when he was involved with more practically inclined investigations.  But Gauss was well aware of this. 
A: First of all it is not really historically meaningful to phrase the question "To what extent.."  and "aware of lack of rigour". To really know the answer we would surely need a time machine, which we do not have (at least I don't.) Additionally, the question also deals with awareness which is a delicate and debatable subject even in its own field, namely psychology. So let's assume you are aware of your own thoughts and feeling and your own knowledge. But are you aware of thoughts and of feelings of someone else? How can you be sure you are? And even more, How can you be aware of the things you do not know? 
History and the Scientific process should be understood in the context they occurred. The mathematicians of previous times where trying to lay their grasp of the world mathematically with the syntactical tools they had or could invent. Understandably, there are a lot of tools and concepts that where developed after their time which they could not use in their research.
So, removing the psychological notion which is only can be answered with conjectures and guessworks. It is logical to say that their proofs and mathematical language and deduction was just rigour enough to be accepted by their contemporaries, and than re-examined and change like in other scientific areas Like claimed by Popper and then Kuhn.
Wikipedia has what seems to be a really good, yet short, description of the term rigour in the context of mathematics and its historical context. The key thing you can take from this answer is that historical events and peoples thoughts (and feelings) are heavily influenced by their time and contextual frame. I hope this answer explain and give you some of the necessary information and a viable direction to understand these concepts in clear way.
