Commit Graph

89 Commits

Author SHA1 Message Date
Thomas Woerner
20d25d0d43 Replace deprecated include with import_tasks and include_tasks
As the old way to include tasks is deprecated, replace static include
statements with import_tasks and dynamic ones with include_tasks.

Increaded the required ansible version to 2.5.0 to make sure that
include_tasks and import_tasks is working as expected.

Fixes issue #38
2018-11-22 16:26:58 +01:00
Thomas Woerner
dc0d1fc196 ipaclient: Fix gathering of subject_base from server in ipaapi.py module
The api command to get the server config is failing with more recent
freeipa versions. Therefore another way to gather the server config using
api.Backend.rpcclient.forward has been added in case the first version
fails.

The new code is from freeipa commit 8af6accfa5734a7e9a7c92fcf38d5440482413d4
(https://github.com/freeipa/freeipa/commit/8af6accf)
2018-11-21 17:13:15 +01:00
Thomas Woerner
b2583f7078 Ubuntu support added (partly pick from pyguy)
This is a partly pick of the changes done by pyguy for pull request #28.
The unrelated changed on inventory files have been removed and the change
to the README has been adapted to use the "Supported Distributions" section.

The original commits by pyguy in https://github.com/pyguy/ansible-freeipa
are:

commit 1ed1fa845eafd69432b1fd1fc8e5329e4991e84a
Author: pyguy <hr.josheghani@gmail.com>
Date:   Mon Jun 25 17:17:31 2018 +0430

    Ubuntu Support added

commit 9a4a7c84e4af20af27e814aba4fc2c6b8b35ec0f
Author: pyguy <hr.josheghani@gmail.com>
Date:   Sun Jun 24 10:58:07 2018 +0430

    Ubuntu support added
2018-07-23 11:07:23 +02:00
Thomas Woerner
915cc39b31 ipaclient,ipareplica: Set ipaclient_ssh_trust_dns to no by default 2018-07-19 14:15:47 +02:00
Thomas Woerner
695d09aa69 ipaclient: Backup and set hostname explicitly
This is needed to use ipaclient in ipareplica for client deployment.
2018-07-19 14:14:45 +02:00
Thomas Woerner
1b2f6d7e8b ipaclient: Set default_domain in krb5.conf in the same way as ipa-client-install
Set default_domain if not ipadiscovery.dnsok or not ipadiscovery.kdc like it
is done in ipa-client-install.
2018-07-19 13:00:39 +02:00
Thomas Woerner
0154f36a69 Added ipa- prefix to krb5 and sssd roles as these are ansible-freeipa specific
These roles will most likely not work in the common case. Therefore the roles
have been renamed.

The ipa-krpb5 role is used by ipcalient, but the ipa-sssd role is currently
not used.
2018-07-19 12:58:30 +02:00
Siva Paramasivam
720204fe5a var files for CentOS 7 (now that the default is compatible with Fedora not RHEL) 2018-07-06 22:20:05 -07:00
Thomas Woerner
34fe6103db ipaclient/library/ipanss.py: Fixed wrong name in paths.GETENT compat check
The paths.GETENT compat check was using "KDESTROY" instead of "GETENT".
2018-06-28 17:32:07 +02:00
Ian Tewksbury
d6ff55d8c6 ipadiscovery.py - fix typo of timconf to timeconf 2018-06-27 14:23:46 -04:00
Thomas Woerner
86e9496ab6 ipaclient/vars/default.yml: Use python3-libselinux instead of libselinux-python
The python3 bindings should be required and not the python2 bindings as a
default.
2018-06-21 13:14:19 +02:00
Thomas Woerner
1ed9379c9c ipaclient: Fix OTP action plugin to work with python3 bindings
As the action plugin is used with the default python interpreter and
the change to python3 for FreeIPA, the use of OTP was not working anymore.

The ansible_python_interpreter is not automatically used for the module
part of the action plugin. Therefore ansible_python_interpreter needed to
be added to the action plugin call as a new var to make sure that the
module part is used with the proper python version.

Also a new import for the Python2/3 import test has been added to discover
of the server is supporting python2 or python3. The old
ansible_python_interpreter setting is saved before doing this and restored
after the one-time password has been generated on the server.
2018-06-21 13:08:44 +02:00
Thomas Woerner
4063b6caa3 ipaclient: Add support for IPA 4.7 (4.6.90-pre2)
With IPA 4.7 bigger changes have been introduced

Changes:
- Use of timeconf and chrony instead of ntpconf and ntpd.
- A new option ntp_pool has been introduced.
2018-06-21 13:04:32 +02:00
Thomas Woerner
2d6c9bb381 ipaclient/library/ipa_facts.py: Fix version_info for new pre versions
With 4.6.90 pre versions have been introduced. The version parsing in
ipa_facts broke with this as it did not know about pre versions so far.
2018-06-21 12:52:10 +02:00
Thomas Woerner
285790231a ipaclient: Use paths variables for executables used in modules
paths.KDESTROY instead of "kdestroy" and paths.GETENT instead of "getent"

Affected modules:
  roles/ipaclient/library/ipahost.py
  roles/ipaclient/library/ipajoin.py
  roles/ipaclient/library/ipanss.py
2018-06-21 12:48:24 +02:00
Thomas Woerner
1ecc194ca6 ipclient: Move library and action_plugins into ipaclient role directory
The directories library and action_plugins do only contain ipaclient specific
modules and plugins. Therefore these directories should be located in the
ipaclient role directory.
2018-06-21 11:34:50 +02:00
Thomas Woerner
d4b7d4d3e8 Merge pull request #22 from kellinm/no-change-on-python3-test
Capturing python3 check result is not a change
2018-05-18 15:37:28 +02:00
Thomas Woerner
397acc01db ipaclient: Make krb5 DNS lookup possible in cluster environments
krb5 DNS discovery was not possible in cluster environments as the server
list from groups.ipaserver was used all the time. DNS discovery is though
only used if no servers are given.

The new setting ipaclient_no_dns_lookup has been added to make sure that
DNS lookup is used in the first place and can be disabled easily with this
setting. There is also a new way to override servers per client in the
inventory file with ipaclient_servers.

Two new settings have been added:

ipaclient_no_dns_lookup (bool, default: no)
  Set to 'yes' to use groups.ipaserver in cluster environments as servers
  for the clients. This deactivates DNS lookup in krb5.

ipaclient_servers (list of strings, default: undefined)
  Manually override list of servers for example in a cluster environment on
  a per client basis. The list of servers is normally taken from from
  groups.ipaserver in cluster environments.
2018-05-18 15:06:53 +02:00
Thomas Woerner
3e9568e39e ipaclient: Fix krb5 DNS lookup and servers
The krb5 DNS lookup settings krb5_dns_lookup_realm and krb5_dns_lookup_kdc
ans also the servers have not been set properly set if no server has been
specified and discovery succeeded. This has been fixed.

This fixes issue #23.
2018-05-18 14:38:27 +02:00
Kellin
75cd130d4a Capturing python3 check result is not a change
- Do not register a change in the playbook run when registering the
  variable checking for whether or not Python 3 imports work

Signed-off-by: Kellin <kellin@retromud.org>
2018-04-10 21:01:13 -04:00
Thomas Woerner
3e03d7f44d ipaclient/tasks/install: Fix client installation on master within server role
The client role is used also while installing the server. There has been an
issue where the server installation has not been complete because of a
playbook termination in the client.

This has been fixed and the client and also the server are fully configured
in the server installation.
2018-02-09 16:56:53 +01:00
Thomas Woerner
4697a0326d ipaclient/tasks/main.yml: Fix undefined ipaclient_packages error with include_role
The relative import of the distribution specific vars files requires to use
is not working. {{ role_path }} needs to be used to force the load of the
proper files.
2018-01-31 23:46:36 +01:00
Thomas Woerner
3c4e68ef10 ipaclient/tasks/install.yml: Fix possible ipajoin.already_joined undefined issue 2018-01-31 23:46:33 +01:00
Thomas Woerner
ceb4224afe ipaclient/tasks/install.yml: Support client usage in server role
The server role has different setting names:

- groups.ipaserver: groups.ipaservers
- ipaserver_domain: ipaclient_domain
- ipaserver_realm: ipaclient_realm

Both need to be supported to be able to sue the client role within the server
role, but also standalone.
2018-01-31 23:46:31 +01:00
Thomas Woerner
7180d1beff ipaclient,ipaserver: Better names for package tasks 2018-01-29 17:30:11 +01:00
Thomas Woerner
d009b80621 library/ipadiscovery: Add time synchronization calls
Attempt to sync time if on_master is not set and no_ntp is not set: At
first with given or dicovered time servers. If no ntp servers have been
given or discovered, then with the ipa server.

New parameters:
  on_master:
    description: IPA client installation on IPA server
    required: false
    default: false
    type: bool
    default: no
  ntp_servers:
    description: List of NTP servers to use
    required: false
    type: list
    default: []
  no_ntp:
    description: Do not sync time and do not detect time servers
    required: false
    default: false
    type: bool
    default: no

The ntp_servers output parameter is now always an empty list if on_master
or no_ntp is set.
2017-12-06 12:53:19 +01:00
Thomas Woerner
120786672e library/ipadiscovery: Drop unused check parameter 2017-12-06 12:52:46 +01:00
Thomas Woerner
a7e78597c6 Add support for on_master flag
This is needed to be able to use ipaclient role in the server role
2017-12-06 12:46:57 +01:00
Thomas Woerner
86323feb80 roles/ipaclient/tasks/install.yml: Allow to specify different hostname
ipaclient_hostname needs to be specified in the inventory file for the hosts
where the name needs to get changed.

Example:
192.168.1.1 ipaclient_hostname=ipaclient1.mine.local

The option should not be specified in [ipaclients:vars] as all hosts would
get the same name.
2017-11-09 13:20:44 +01:00
Thomas Woerner
bb603fbd9f roles/ipaclient/tasks/uninstall.yml: No need to use python3 test for uninstall 2017-11-09 13:19:58 +01:00
Thomas Woerner
7b51df6c33 roles/ipaclient/tasks/[un]install.yml: Use better formatting for commands 2017-11-09 13:19:08 +01:00
Thomas Woerner
11bf327c64 roles/ipaclient/defaults/main.yml: Do not use false string for bool values 2017-11-09 13:17:42 +01:00
Thomas Woerner
d8ba096eb9 New global ansible_ipa_client utils module
With ansible 2.3.1 it is possible to have one place as an additional utils
module to do all the needed steps to be able to generate the environment for
new and older ipa versions.

The library modules are now a lot smaller.

The minimal ansible version has been increased to 2.3.1.

In the future it might now also be possible to have a special
ansible_ipa_client version for ipa < 4.4 in this utils module.
2017-11-09 13:16:28 +01:00
Thomas Woerner
fb047d7e4e Merge pull request #4 from flo-renaud/simplify_uninstall
Simplify ipaclient uninstall
2017-10-16 14:21:53 +02:00
Thomas Woerner
e3ae3476a5 roles/ipaclient/tasks/install.yml: Add keytab or password required test
The failed test result in ipahost will not be seen because of the no_log
setting to hide the generated password.
2017-10-13 16:38:45 +02:00
Thomas Woerner
8af5a26873 roles/ipaclient/tasks/install.yml: Use ipadiscovery.hostname for ipahost
The use of ansible_fqdn could result in a failure if DNS hostname and IP
do not match.
2017-10-13 16:37:10 +02:00
Thomas Woerner
ccdd43f0b5 Extended python3 test to do an additional client test
The additional client test is needed to make sure that the client is
installed for python3 usage. The ipalib test has not been sufficient.
2017-10-13 16:13:57 +02:00
Florence Blanc-Renaud
a0b8bd39e0 Simplify ipaclient uninstall
Currently ipaclient role is using the module ipaclient only for uninstallation,
and this module contains a lot of unused code.
It is simpler to directly call the command-line
   ipa-client-install --uninstall -U
and remove the ipaclient module.
2017-10-12 09:47:03 +02:00
Florence Blanc-Renaud
92d73ae2b8 Fix otp + force-join usecase
When the client already has a working keytab, use_otp is disabled. This creates
an issue when ipaclient_force_join is set, because the join module is called
with ipaadmin_principal and ipaadmin_password, but these variables may be
undefined if ipaadmin_keytab is used instead.
We should not disable OTP when force-join is specified.
2017-10-11 16:48:26 +02:00
Thomas Woerner
63fd53eb77 Use Python2/3 to detect ansible_python_interpreter
With the test it is not needed to pin down the python interpreter for ansible
modules. It is therefore possible to use a Python2 version on Fedora-27 and
a Python3 version on Fedora-26.
2017-10-10 17:20:59 +02:00
Scott Poore
2183bb68cc change pkinit_anchors to kdc-ca-bundle
In the client krb5.conf setup, a pkinit_anchors entry
was being added for pki-ca-bundle.  This should instead
be kdc-ca-bundle.

Signed-off-by: Scott Poore <spoore@redhat.com>
2017-10-05 11:46:07 -05:00
Thomas Woerner
6482a0d1c3 library/ipatest.py: Drop unused prinipal from module parameters
The principal is not used and needed in the module, therefore it got removed.
2017-10-05 10:39:43 +02:00
Thomas Woerner
c696ea3ebf New module ipafixca to fix a missing ca.crt file.
This is done right ipanss is used as this is failing without the ca.crt file.
2017-10-04 17:40:13 +02:00
Thomas Woerner
a6c8505938 roles/ipaclient/tasks/install.yml: New fail for missing ca.crt file 2017-10-04 17:39:37 +02:00
Thomas Woerner
b51980ee5d roles/ipaclient/tasks/install.yml: New fails, no end_play with ipajoin.changed
The new results from ipatest (krb5_conf_ok and ipa_test_ok) are now used for
additional fails to suggest to enable allow_repair.

The playbook is not ended anymore if ipajoin changed something.
2017-10-04 17:38:23 +02:00
Thomas Woerner
455f5c9811 roles/ipaclient/vars/rhel.yml: Removed unused file 2017-10-04 17:28:06 +02:00
Thomas Woerner
990da8341f ipaclient vars: Renamed ipaclient_package to ipaclient_packages
The rename was needed to be able to have more than one package in the list
of required packages.

For RHEL-7.3 it has been needed to add ipa-admintools to have /usr/bin/ipa
available. libselinux-python has been added for all.
2017-10-04 17:22:40 +02:00
Thomas Woerner
92b824d8d2 roles/ipaclient/tasks/install.yml: ccache cleanup, new always clause
Add big block has been added that contains all steps where the ccache is
created an used. With the block it is possible to add an always clause to
remove the ccachae also in the error case. The cleanup of the ccache is
also done in the beginning to make sure that no ccache leftover will be
used.
2017-10-02 18:54:23 +02:00
Thomas Woerner
895a887701 Add support for Python3 based freeipa versions (F-27+), make Python3 default
Add configuration for F-26, F-27 and RHEL-7 to be Python2 based
2017-10-02 17:12:15 +02:00
Thomas Woerner
cd5b7711f6 roles/ipaclient/tasks/install.yml: Better message for cleanup and stop 2017-09-25 15:59:04 +02:00