Check this code
do_action('user_register', $user_id);
add_action ('user_register', "test");
function test($user_id) {
$user = new WP_User($user_id);
$role_of_user = $user->roles[0];
if($role_of_user == 'your role'){
$my_post = array(
'post_title' => 'My post',
'post_content' => 'This is my post.',
'post_status' => 'publish',
'post_author' => $user_id
);
wp_insert_post( $my_post );
}
}
It will create a post when a user of your defined role
is create by admin i.e from backend.
For profile update i.e if user role is update from some other role to your defined role
add_action( 'profile_update', 'my_profile_update', 10, 2 );
Use profile_update
action and rest of the code same.