This was a CIA sponsored unexpected attack on Cuba in 1961 which failed due to the strong resistance put up by the Cuban army and people – more. This led to the Cuban Missile crisis the following year, as fear of another attack provoked Fidel to accept Soviet nuclear missiles onto Cuba.
The plot was originally devised under President Eisenhower. When Kennedy won the election and became president in January 1961 he showed an understanding of how the foreign policy of the US had contributed to Fidel Castro’s success, see http://www.presidency.ucsb.edu/ws/?pid=25660. However he decided to go ahead with the plan to launch a surprise invasion of Cuba which the CIA had devised with the help of Cuban exiles who had fled the country with Batista. He hoped to keep the involvement of the US government secret but this was not possible.
The song could be written from several perspectives:
From the perspective of the CIA agent talking to the US president about their plans.
Afterwards when it fails – the US president, Kennedy singing about the embarrassment of the Bay of Pigs fiasco.
From the perspective of Fidel and other Cubans organising troops.
From the perspective of those fighting e.g. the soldiers, or armed Cubans who are called upon to help in times of trouble.
Or from a perspective you have thought of or a combination of these perspectives.