Ayyub ibn Salama ibn Abd Allah ibn al-Walid ibn al-Walid ibn al-Mughira al-Makhzumi was a notable of Medina in the late Umayyad and early Abbasid period. He belonged to a wealthy family of the locally prominent Banu Makhzum clan of the Quraysh. He is recorded as a witness or participant of political events in Medina during the reigns of caliphs Sulayman, Hisham and al-Mansur, including as a one-time supporter of the Alid revolt of Muhammad al-Nafs al-Zakiyya against the Abbasids.
Ayyub was a member of the household of al-Walid ibn al-Mughira, a rich and prominent family of the Banu Makhzum, a major clan of the Quraysh mainly present in Mecca and Medina. He inherited the wealth of Khalid ibn al-Walid (d. 642), a major commander of the early Muslim conquests of the 630s, when all of the latter's male descendants, who were Ayyub's kinsmen, perished in a plague in Syria during the final years of the Umayyad Caliphate (661–750) or shortly after the establishment of the Abbasid Caliphate in 750. Included in this inheritance were several houses in Medina, where Ayyub was based. Ayyub had marital ties to the Umayyad caliph Hisham ibn Abd al-Malik through Hisham's mother, A'isha, who was the daughter of Ayyub's paternal relative, Hisham ibn Isma'il ibn Hisham ibn al-Walid ibn al-Mughira. Through Ayyub's niece, Umm Salama bint Ya'qub al-Makhzumi, he had familial ties with Caliph Hisham's son, Maslama, and the first Abbasid caliph, al-Saffah, both of whom were married at one point to Umm Salama and had children from her. Al-Saffah's and Umm Salama's daughter, Rayta, married the third Abbasid caliph, al-Mahdi, and gave birth to his sons Ubaydallah and Ali.
Ayyub's marriage to a descendant of Caliph Ali, Fatima bint Abdallah al-Hasan, caused a quarrel between him and her father, as Ayyub asked for her hand from her son, Salih ibn Abd Allah ibn Mu'awiya ibn Ja'far, instead of her father, who claimed to be the only legal intercessor of his daughter. The dispute led to Ayyub's imprisonment by Caliph Hisham. Through the intervention of Ayyub's son, the caliph released Ayyub. Ayyub's great-grandson, Muhammad ibn Khalid ibn Isma'il, was one of the sources used by the historian Umar ibn Shabba (d. 878). The descendants of Ayyub continued to possess the properties of Khalid ibn al-Walid in Medina at the time of Umar ibn Shabba.
Ayyub was a witness to the dismissal and flogging of his friend, Medina's governor Uthman ibn Hayyan al-Murri, by the Umayyad caliph Sulayman ibn Abd al-Malik in 715. He was a defendant of the Islamic prophet Muhammad's great-great-grandson, the Alid Zayd ibn Ali, against claims of financial impropriety by the Umayyad governor of Iraq Khalid al-Qasri . During the revolt of the Alid Muhammad al-Nafs al-Zakiyya against the Abbasid caliph al-Mansur in 762–763, Ayyub gave al-Nafs al-Zakiyya the caliphal oath of allegiance in Medina. When the revolt was suppressed, Ayyub was pardoned when he publicly repented and renounced his oath. Ayyub witnessed al-Mansur's punishment by lashing of a locally prominent ally of al-Nafs al-Zakiyya, Muhammad ibn Abdallah al-Uthmani, a descendant of caliphs Uthman and Ali.