Skip to content

Instantly share code, notes, and snippets.

@noonedeadpunk
Last active May 5, 2020 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noonedeadpunk/7876b958563eaf27a9d708959d75bc86 to your computer and use it in GitHub Desktop.
Save noonedeadpunk/7876b958563eaf27a9d708959d75bc86 to your computer and use it in GitHub Desktop.
Add hosts to ipa server
---
- 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