Afghan President Ashraf Ghani has said that he is open to hold talks with militants who accept peace.