Last active
May 5, 2020 11:07
-
-
Save noonedeadpunk/7876b958563eaf27a9d708959d75bc86 to your computer and use it in GitHub Desktop.
Add hosts to ipa server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Install and configure ipa-client | |
hosts: "{{ hosts }}" | |
tasks: | |
- name: Install ipa-client package | |
package: | |
name: "{{ (ansible_os_family == 'Debian') | ternary('freeipa-client', 'ipa-client') }}" | |
state: installed | |
register: ipa_install | |
- name: Run configuration command | |
command: | |
argv: | |
- ipa-client-install | |
- --mkhomedir | |
- --ssh-trust-dns | |
- "--domain={{ ipa_domain }}" | |
- "--realm={{ ipa_realm | default(ipa_domain | upper) }}" | |
- "--ip-address={{ ipa_address | default(ansible_default_ipv4.address) }}" | |
- "--principal={{ ipa_principal }}" | |
- "--password={{ ipa_password }}" | |
- "--unattended" | |
no_log: true | |
when: (ipa_install is changed) or (ipa_force_configure is defined and ipa_force_configure) | |
vars_prompt: | |
- name: "ipa_domain" | |
prompt: "Domain name for computers" | |
private: no | |
when: ipa_principal is undefined | |
- name: "ipa_principal" | |
prompt: "User authorized to enroll computers" | |
private: no | |
when: ipa_principal is undefined | |
- name: "ipa_password" | |
prompt: "Password for authorized user" | |
private: yes | |
when: ipa_password is undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment