mono-infrastructure/ansible/playbooks/adhoc-ipauser.yml

42 lines
1.3 KiB
YAML
Raw Permalink Normal View History

2020-12-10 07:33:09 +00:00
---
# This playbook is meant to be used with callable variables, like adhoc or AWX.
2020-12-10 07:42:05 +00:00
# What: Creates users in the idm infrastructure based on the variables provided.
2020-12-10 07:33:09 +00:00
- name: Create a User
hosts: ipaserver
become: false
gather_facts: false
2020-12-10 07:33:09 +00:00
vars_files:
2021-01-23 22:51:55 +00:00
- vars/vaults/userman.yml
2020-12-10 07:33:09 +00:00
tasks:
- name: "Checking for user variables"
assert:
that:
- ipa_admin | mandatory
2020-12-10 07:33:09 +00:00
- ipaadmin_password | mandatory
2020-12-28 02:27:45 +00:00
- ipa_name | mandatory
- ipa_first | mandatory
- ipa_last | mandatory
- ipa_email | mandatory
- ipa_password | mandatory
- ipa_title | mandatory
2020-12-10 07:33:09 +00:00
success_msg: "Required variables provided"
fail_msg: "We are missing user information or ipa admin password"
- name: "Creating User Account"
freeipa.ansible_freeipa.ipauser:
ipaadmin_principal: "{{ ipa_admin }}"
2020-12-10 07:33:09 +00:00
ipaadmin_password: "{{ ipaadmin_password }}"
2020-12-28 02:27:45 +00:00
name: "{{ ipa_name }}"
first: "{{ ipa_first }}"
last: "{{ ipa_last }}"
email: "{{ ipa_email }}"
password: "{{ ipa_password }}"
title: "{{ ipa_title }}"
loginshell: "{{ ipa_loginshell|default('/sbin/nologin', True) }}"
2020-12-10 07:33:09 +00:00
update_password: on_create
tags:
- users
...