2020-12-10 07:33:09 +00:00
|
|
|
---
|
|
|
|
# This playbook is meant to be used with callable variables, like adhoc or AWX.
|
2020-12-11 07:39:15 +00:00
|
|
|
# What: Creates groups in the idm infrastructure based on the variables provided
|
2021-01-05 22:24:00 +00:00
|
|
|
# You MUST provide an ipa_admin user to run this.
|
|
|
|
# If group is going to be a fas group (exposed in noggin), ensure ipa_fas is
|
|
|
|
# set to true.
|
2020-12-10 07:33:09 +00:00
|
|
|
|
|
|
|
- name: Create our initial users
|
|
|
|
hosts: ipaserver
|
|
|
|
become: false
|
2020-12-21 05:05:52 +00:00
|
|
|
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:
|
2021-01-05 22:24:00 +00:00
|
|
|
- ipa_admin | mandatory
|
2020-12-10 07:33:09 +00:00
|
|
|
- ipaadmin_password | mandatory
|
2020-12-28 02:27:45 +00:00
|
|
|
- ipa_group | mandatory
|
|
|
|
- ipa_description | mandatory
|
2021-01-05 22:51:17 +00:00
|
|
|
- ipa_nonposix | mandatory
|
2020-12-10 07:33:09 +00:00
|
|
|
success_msg: "Required variables provided"
|
|
|
|
fail_msg: "We are missing group information or ipa admin password"
|
|
|
|
|
2021-01-05 22:51:17 +00:00
|
|
|
- name: "Creating New Group"
|
2020-12-12 08:16:44 +00:00
|
|
|
freeipa.ansible_freeipa.ipagroup:
|
2021-01-05 22:24:00 +00:00
|
|
|
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_group }}"
|
|
|
|
description: "{{ ipa_description }}"
|
2021-01-05 22:51:17 +00:00
|
|
|
nonposix: "{{ ipa_nonposix }}"
|
|
|
|
membermanager_user: "{{ ipa_group_manager_user | default(omit) }}"
|
|
|
|
membermanager_group: "{{ ipa_group_manager_group | default(omit) }}"
|
2020-12-10 07:33:09 +00:00
|
|
|
tags:
|
|
|
|
- groups
|
2021-01-05 22:24:00 +00:00
|
|
|
|
|
|
|
- name: "Prepare FAS if required"
|
|
|
|
shell: "set -o pipefail && echo \"{{ ipaadmin_password }}\" | kinit {{ ipa_admin }}"
|
|
|
|
check_mode: false
|
|
|
|
changed_when: "1 != 1"
|
|
|
|
when: ipa_fas
|
|
|
|
|
|
|
|
- name: "Apply FAS"
|
|
|
|
command: "ipa group-mod --fasgroup {{ ipa_group }}"
|
|
|
|
check_mode: false
|
|
|
|
changed_when: "1 != 1"
|
|
|
|
when: ipa_fas
|
2021-08-30 05:02:24 +00:00
|
|
|
...
|