I have a list of users from an external source and a remote machine. I want to take the list from the external source and compare it against my current machine's user list and create users for each user that does not exist on the machine.

I have tried this using ansible runner (pseudo-code below):

```
for user in users: 
  updateUsers(user)

```

which will call an Ansible.runner object and make the following call: 

```
ansible.runner.Runner(
  pattern='tools',
  forks=10,
  module_name='user',
  module_args="",
  complex_args=OrderedDict(sorted(dict(name=name, group=group, state=state).items())),
  sudo=True,
).run()

```

For now group and state are defined globally.
My issue is that as this traverses the for-loop, it does indeed create users as I have specified it to do so; the main issue is that it creates users and then the permissions on the home directories of each respective user do not allow the user access to it. So say "joeshmo" was a user: he would not be able to write to his own ~/ dir.

I am looking for some guidance on how I'm doing this.
Is there a way with playbook to dynamically iterate through a file and grab different user names to add them as users to the system without the permission errors?
Is there a way to fix my current script to not have these errors?

Thank you