ansible-ipa-management/adhoc-ipabinder.yml

43 lines
1.2 KiB
YAML
Raw Normal View History

2021-02-01 08:08:26 +00:00
---
# This playbook is meant to be used with callable variables, like adhoc or AWX.
# What: Creates a binder account for read-only binds
# What is expected:
# -> ipa_binder_name: Bind account name, in the form of name_binder
# -> ipa_binder_password: Bind account password
- name: Create binder account
hosts: "{{ ipaserver|default('all') }}"
2021-02-01 08:08:26 +00:00
become: true
tasks:
- name: "Check for user variables"
2022-03-28 01:54:24 +00:00
ansible.builtin.assert:
2021-02-01 08:08:26 +00:00
that:
- ipa_binder_name | mandatory
- ipa_binder_password | mandatory
success_msg: "Required variables provided"
fail_msg: "We are missing user information"
- name: "Creating bind account template - binder"
2022-03-28 01:54:24 +00:00
ansible.builtin.template:
2022-02-12 21:43:09 +00:00
src: "tmp/binder_template.update"
2021-02-01 08:08:26 +00:00
dest: "/tmp/binder.update"
owner: root
group: root
mode: '0600'
tags:
- users
- name: "Adding in the bind account"
2022-03-28 01:54:24 +00:00
ansible.builtin.command: "/usr/sbin/ipa-ldap-updater /tmp/binder.update"
2021-02-01 08:08:26 +00:00
register: bind_account
changed_when: "bind_account.rc == 0"
tags:
- users
- name: "Remove template"
2022-03-28 01:54:24 +00:00
ansible.builtin.file:
2021-02-01 08:08:26 +00:00
path: "/tmp/binder.update"
state: absent
2022-02-12 21:43:09 +00:00
...