Commit Graph

521 Commits

Author SHA1 Message Date
Thomas Woerner
42eaadfbbf New hbacsvc (HBAC Service) management module
There is a new hbacsvc (HBAC Service) management module placed in the plugins
folder:

  plugins/modules/ipahbacsvc.py

The hbacsvc module allows to ensure presence and absence of HBAC Services.

Here is the documentation for the module:

  README-hbacsvc.md

New example playbooks have been added:

  playbooks/hbacsvc/ensure-hbacsvc-absent.yml
  playbooks/hbacsvc/ensure-hbacsvc-present.yml

New tests added for pwpolicy:

  tests/hbacsvc/test_hbacsvc.yml
2019-10-24 14:35:12 +02:00
Thomas Woerner
13eb30f1e2 Merge pull request #132 from t-woerner/ipapwpolicy
Ipapwpolicy
2019-10-22 12:46:10 +02:00
Thomas Woerner
b3fd3a518e New pwpolicy management module
There is a new pwpolicy management module placed in the plugins folder:

  plugins/modules/ipapwpolicy.py

The pwpolicy module allows to ensure presence and absence of pwpolicies for
groups.

Here is the documentation for the module:

  README-pwpolicy.md

New example playbooks have been added:

  playbooks/pwpolicy/pwpolicy_absent.yml
  playbooks/pwpolicy/pwpolicy_present.yml

New tests added for pwpolicy:

  tests/pwpolicy/test_pwpolicy.yml
2019-10-22 12:41:45 +02:00
Thomas Woerner
5d435c375c ansible_freeipa_module: Convert int to string in compare_args_ipa
With IPA 4.5 integers for examle in pwpolicy_find are returned as
integer values. The internally generated value will be converted from
integer to string (using to_text) if the value from find call result
is a string (or unicode for Python2).
2019-10-22 12:41:07 +02:00
Thomas Woerner
ccc001ada0 Merge pull request #133 from rjeffman/sudocmdgrp
New sudocmdgroup management module.
2019-10-22 12:07:17 +02:00
Rafael Guterres Jeffman
fce3935d03 New sudocmdgroup management module.
There is a new sudocmdgroup management module placed in the plugins folder:

plugins/modules/ipasudocmdgroup.py

The sudocmdgroup module allows to add or remove sudo command groups..

The sudocmdgroup module is as compatible as possible to the Ansible upstream
ipa_sudocmdgroup module, and additionally offers to ensure member presence
and absence.

Here is the documentation for the module:

  README-sudocmdgroup.md

New example playbooks have been added:

  playbooks/sudocmd/ensure-sudocmdgroup-is-absent.yml
  playbooks/sudocmd/ensure-sudocmdgroup-is-present.yml
  playbooks/sudocmd/ensure-sudocmd-is-absent-in-sudocmdgroup.yml
  playbooks/sudocmd/ensure-sudocmd-is-present-in-sudocmdgroup.yml

A test playbook is provided in:

  tests/sudocmdgroup/test_sudocmdgroup.yml

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2019-10-22 06:53:37 -03:00
Thomas Woerner
12c4227385 Merge pull request #130 from rjeffman/sudocmd
New sudocmd management module.
2019-10-22 11:44:56 +02:00
Rafael Guterres Jeffman
5d962c06ca New sudocmd management module.
There is a new sudocmd management module placed in the plugins folder:

  plugins/modules/ipasudocmd.py

The sudocmd module allows to add or remove sudo commands.

The sudocmd module is as compatible as possible to the Ansible upstream
ipa_sudocmd module.

Here is the documentation for the module:

  README-sudocmd.md

New example playbooks have been added:

  playbooks/sudocmd/ensure-sudocmd-is-absent.yml
  playbooks/sudocmd/ensure-sudocmd-is-present.yml

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2019-10-22 06:39:30 -03:00
Thomas Woerner
bf664f6861 Merge pull request #131 from t-woerner/ipauser-rework
Ipauser rework
2019-10-22 11:16:31 +02:00
Thomas Woerner
40713e71f9 ipauser: User module extension
The ipauser module now supports all user settings and additionally to ensure
the presence of several users with the new users setting. The users setting
can also be used with other states, but it has to be limited to only contain
the name of the users.

There updated user management module is placed in the plugins folder:

  plugins/modules/ipauser.py

The user module now additionally allows to handle these user settings:

  initials
  principalexpiration
  random
  city
  userstate
  postalcode
  mobile
  pager
  fax
  orgunit
  manager
  carlicense
  sshpubkey
  userauthtype
  userclass
  radius
  radiususer
  departmentnumber
  employeenumber
  employeetype
  preferredlanguage
  certificate
  certmapdata
  noprivate
  nomembers

Here is the updated documentation for the module:

  README-user.md

New example playbooks have been added:

  playbooks/user/user_certificate_absent.yml
  playbooks/user/user_certificate_present.yml
  playbooks/user/user_present.yml
  playbooks/user/users_absent.yml
  playbooks/user/users_certificate_absent.yml
  playbooks/user/users_certificate_present.yml
  playbooks/user/users_present.yml
  plugins/modules/ipauser.py

New tests added for ipauser:

  tests/user/certificate/cert1.der
  tests/user/certificate/cert1.pem
  tests/user/certificate/cert2.der
  tests/user/certificate/cert2.pem
  tests/user/certificate/cert3.der
  tests/user/certificate/cert3.pem
  tests/user/certificate/private1.key
  tests/user/certificate/private2.key
  tests/user/certificate/private3.key
  tests/user/certificate/test_user_certificate.yml
  tests/user/certificate/test_users_certificate.yml
  tests/user/certmapdata/test_user_certmapdata.yml
  tests/user/certmapdata/test_user_certmapdata_issuer_subject.yml
  tests/user/certmapdata/test_users_certmapdata.yml
  tests/user/test_user.yml
  tests/user/test_users.yml
  tests/user/test_users_absent.yml
  tests/user/test_users_invalid_cert.yml
  tests/user/test_users_present.yml
  tests/user/test_users_present_slice.yml
  tests/user/users_absent.json
  tests/user/users_absent.sh
  tests/user/users_present.json
  tests/user/users_present.sh
2019-10-21 15:44:00 +02:00
Thomas Woerner
1428143d73 ansible_freeipa_module: New function api_get_realm
The function api_get_realm is returning the realm of a connected FreeIPA
api. This is needed for proper principal checks in the extended ipauser
module that supports principals now.
2019-10-21 15:43:59 +02:00
Thomas Woerner
8932842288 ansible_freeipa_module: Convert tuple to list in compare_args_ipa
The conversion is needed because older FreeIPA versions are returning
tuples in some cases instead of lists. To be able to compare them the
conversion to a list is needed.
2019-10-21 15:43:58 +02:00
Thomas Woerner
b1a8427132 ansible_freeipa_module: Add missing to_text import for _afm_convert
to_text has not been imported from ansible.module_utils._text but it was
used in _afm_convert. The import has been added.
2019-10-18 16:39:17 +02:00
Thomas Woerner
b16280455c ansible_freeipa_module: New functions module_params_get and _afm_convert
The module_params_get function can and should be used as a replacement of
ansible_module.params.get. For Python2 it is needed to convert parameters
to unicode. Otherwise there will be an error in the FreeIPA API command.

The private function _afm_convert has been added to do the conversion
recursively.
2019-10-09 12:05:00 +02:00
Thomas Woerner
3390d6742d ansible_freeipa_module: New function api_check_param
api_check_param can be used to verify if params are available for a command
in the used FreeIPA version. The function has been added as api is normally
not imported into modules.
2019-10-09 12:05:00 +02:00
Thomas Woerner
57188c890a ansible_freeipa_module: compare_args_ipa needs to compare lists orderless
The order of lists returned by find commands is not guaranteed. Therefore
lists are now converted to sets to compare them properly.
2019-10-09 12:05:00 +02:00
Thomas Woerner
bc0f211c29 ansible_freeipa_module: api_command should not have extra try clause
api_command is always used within try clause, therefore it is not needed
to have an extra try clause within api_command. Additionally it is needed
to get the dofferent errors in the next level.
2019-10-09 12:04:51 +02:00
Thomas Woerner
6e2fa7e7d6 Merge pull request #125 from tscherf/typo_fixes
fix various typos in README files
2019-10-07 16:09:54 +02:00
Thorsten Scherf
4d5a2c2437 fix various typos in README files 2019-10-07 12:56:51 +02:00
Varun Mylaraiah
74e954b97f Merge pull request #123 from t-woerner/ipagroup-rework
ipagroup: Rework to use same mechanisms as ipahostgroup module
2019-10-02 09:48:07 +05:30
Thomas Woerner
c5e0b1b453 ipagroup: Rework to use same mechanisms as ipahostgroup module
The ipagroup module was not using the failed and completed items in the dict
that is returned with api_command. But it was creating add and remove
lists for users, groups and services. This is not needed if the failures
"already a member" and "not a member" in the result failures are ignored.
Only other failures are reported.
2019-10-01 10:42:07 +02:00
Varun Mylaraiah
00066d2c28 Merge pull request #122 from t-woerner/external-ca-tests
tests/external-signed-ca tests: Fix external-ca.sh to use proper serials
2019-09-27 19:04:32 +05:30
Thomas Woerner
2a197cc7b1 tests/external-signed-ca tests: Fix external-ca.sh to use proper serials
The serial numbers have not been set for the creation of the CA and also
to sign the request. Because of this the local time has been used, which
resulted sometimes in the use of the same time stamp for the CA and the
signing reuqest. The import failed then with same issuer and serial number
error.

The cat to generate the chain.crt has been replaces with openssl x509 calls.

Some comments have also been added.

The script in external-signed-ca-with-manual-copy has been replaced with a
link to the external-signed-ca-with-automatic-copy directory.
2019-09-27 15:25:26 +02:00
Varun Mylaraiah
e8173dd9b5 Merge pull request #119 from t-woerner/hostgroup
New hostgroup management module
2019-09-26 15:29:36 +05:30
Thomas Woerner
0324ffd56d external-ca tests: Fix typo in inventory files
ipaservcer:vars has been changed to ipaserver:vars.
2019-09-25 13:21:08 +02:00
Thomas Woerner
e814b1faf5 ipagroup: Remove unused member_[present,absent] states
The states member_present and member_absent are not used and should also not
be used. This is a remain of the first try to ensure absence and presence
of users (members) in the group. This has been replaced with the setting
action: member.
2019-09-24 12:05:09 +02:00
Thomas Woerner
dd85868cc2 README-group: Fix typo in state description 2019-09-24 12:04:10 +02:00
Thomas Woerner
2abebc683b New hostgroup management module
There is a new hostgroup management module placed in the plugins folder:

  plugins/modules/ipahostgroup.py

The hostgroup module allows to add, remove and disable hosts.

The hostgroup module is as compatible as possible to the Ansible upstream
ipa_hostgroup module, but addtionally offers to ensure member presence and
absence.

Here is the documentation for the module:

  README-hostgroup.md

New example playbooks have been added:

  playbooks/hostgroup/ensure-hostgroup-is-absent.yml
  playbooks/hostgroup/ensure-hostgroup-is-present.yml
  playbooks/hostgroup/ensure-hosts-and-hostgroups-are-absent-in-hostgroup.yml
  playbooks/hostgroup/ensure-hosts-and-hostgroups-are-present-in-hostgroup.yml
2019-09-23 17:30:38 +02:00
Thomas Woerner
74ea40f66f New hostgroup management module
There is a new hostgroup management module placed in the plugins folder:

  plugins/modules/ipahostgroup.py

The hostgroup module allows to add, remove and disable hosts.

The hostgroup module is as compatible as possible to the Ansible upstream
ipa_hostgroup module, but addtionally offers to ensure member presence and
absence.

Here is the documentation for the module:

  README-hostgroup.md

New example playbooks have been added:

  playbooks/hostgroup/ensure-hostgroup-is-absent.yml
  playbooks/hostgroup/ensure-hostgroup-is-present.yml
  playbooks/hostgroup/ensure-hosts-and-hostgroups-are-absent-in-hostgroup.yml
  playbooks/hostgroup/ensure-hosts-and-hostgroups-are-present-in-hostgroup.yml
2019-09-23 17:08:38 +02:00
Thomas Woerner
8a56962ce6 Update README files for proper description of states
With Ansible there is no add or remove user, there is only ensure presence
or absence of users. The descriptions have been adapted to make sure that
the description is correct now.
2019-09-10 10:13:43 +02:00
Thomas Woerner
4fc722f73b New host management module
There is a new user management module placed in the plugins folder:

  plugins/modules/ipauser.py

The host module allows to add, remove and disable hosts.

The host module is as compatible as possible to the Ansible upstream
ipa_host` module, but addtionally offers to disable hosts.

Here is the documentation for the module:

  README-host.md

New example playbooks have been added:

  playbooks/host/add-host.yml
  playbooks/host/delete-host.yml
  playbooks/host/disable-host.yml
2019-09-09 23:35:05 +02:00
Thomas Woerner
5bb44245c6 ansible_ipa_client: Drop import of configure_nsswitch_database
configure_nsswitch_database has been removed with the freeipa commit

41ef8fba31

The 4.4 compatibility hack leads to a ALREADY installed error in
ipaclient_test because of the removal. This affects ipaclient and
ipareplica roles and also the ipaclient deployment part in ipaserver.

configure_nsswitch_database is not used any more in ipaclient role modules
and therefore simply can be removed from ansible_ipa_client.
2019-09-04 14:47:01 +02:00
Thomas Woerner
f4680ceb5a utils/ansible-ipa-[server,replica,client]-install: New --ansible-verbose option
This option defines the verbose level for the internal ansible-playbook
run.
2019-08-15 21:29:03 +02:00
Thomas Woerner
3a3fb51109 utils/ansible-ipa-server-install: Add deprecated (unused) --domain-level option
This is option is used in test scripts.
2019-08-15 17:32:42 +02:00
Thomas Woerner
09ab29b4e7 ansible_freeipa_module: Add support for GSSAPI
The GSSAPI can be enabled in the management modules with either the
KRB5CCNAME or the KRB5_CLIENT_KTNAME environment variable.

For KRB5CCNAME it is needed to create a ccache file

  kinit admin@TEST.LOCAL -c /root/admin.ccache

that is transferred to the nodes (here into /root) and activated in the
playbook with

  environment:
    KRB5CCNAME: /root/admin.ccache

For KRB5_CLIENT_KTNAME a admin keytab has to be generated

  ipa-getkeytab -s ipaserver.test.local -p admin@TEST.LOCAL -k \
  /root/admin.keytab

that is transferred to the nodes (here into /root) and activated in the
playbook with

  environment:
    KRB5_CLIENT_KTNAME: /root/admin.keytab

It will be needed to set ipaadmin_principal if the admin principal is not
admin.

The management modules can be used without a password in this case.
2019-08-12 19:18:06 +02:00
Thomas Woerner
c69d0bc53f ansible_freeipa_module: Add ansible module argument to valid_creds function
For debug and error reporting it is needed to have the ansible module also
in the valid_creds function.
2019-08-12 19:18:05 +02:00
Thomas Woerner
455ca83ef5 ipauser, ipagroup: Fix typo in only one error message 2019-08-12 19:18:04 +02:00
Thomas Woerner
1d5b5d38b7 utils/ansible-ipa-[server,replica,client]-install: New --become-method option
This option is the same as the --become-method option with ansible-playbook.
If this option is set, become_method will be set in the generated playbook.
2019-08-06 12:42:21 +02:00
Thomas Woerner
d43b4429e6 utils/ansible-ipa-[server,replica,client]-install: Print excessive args
Excessive args are printed now. The simple print of the message too many
arguments was not helping.
2019-08-06 12:39:03 +02:00
Thomas Woerner
45af7348fe utils/ansible-ipa-[server,replica,client]-install: Add p.wait() for returncode
The p.wait() call has been missing in the normal case, therefore no proper
returncode has been returned.
2019-08-06 11:32:55 +02:00
Thomas Woerner
b636ab3112 utils/ansible-ipa-[server,replica,client]-install: New --playbook-dir option
If the --playbook-dir option is used, the inventory and playbook files will
be generated in this directory. The files will not be removed after the
playbook processing ended.

If the directory does not exist an error message will be printed and the
utility will not continue.
2019-08-06 09:17:59 +02:00
Thomas Woerner
ff08ee7ee6 ipaserver_test,ipareplica_prepare: Do not return _pkcs12_file settings
These settings are file descriptors if external certificates are used and
are not used later in the roles. Therefore these settings have been removed.

Fixes: #110 (Ansible error with external certificates)
2019-07-30 11:48:31 +02:00
Thomas Woerner
ab25078b47 ansible-ipa-*-install: Get continuous output working for python2 also
The used code for continuous output from the ansible-playbook call was
only working for Python2. The output has only been printed when the command
finised. This code has been replaced with code that is working with Python2
and Python3.
2019-07-29 13:03:24 +02:00
Thomas Woerner
781ac6e90b ansible-ipa-client-install: The proper option is ipaclient-install-packages
The wrong name has been used for the option of _install_packages.
2019-07-29 13:02:30 +02:00
Thomas Woerner
5179514e0c ansible-ipa-*-install: Use /usr/bin/python by default, fix _install_packages
/usr/bin/python should be used by default. Fixed typo in _install_packages
setting in the inventory file.
2019-07-29 12:33:25 +02:00
Thomas Woerner
203735e143 Utils scripts: ansible-ipa-[server,replica,client]-install
These are utils scripts to do a server,replica or client deployment and
undeployment using the ansible roles. A client inventory and playbook is
generated by the script which is then used with ansible-playbook.

The command line options or the normal command line installers
ipa-server-install, ipa-replica-install and ipa-client-install are all
supported also by these scripts.

Additonally to the commadn line of the normal installers it is needed to
add the fqdn of the host to be installed.

It is needed that the ansible-freeipa roles are available and also usable
by ansible.
2019-07-29 11:57:51 +02:00
Varun Mylaraiah
01b2f8efcf Merge pull request #108 from t-woerner/topologysegment_reinitialize
ipatopologysegment: Fail if given entry can not be found for reinitia…
2019-07-26 23:08:52 +05:30
Thomas Woerner
c212b43516 ipatopologysegment: Fail for missing entry with reinitialized
Currently it is ignored if the entry for reinitialized can not be found if
the name or left and right are not correct. Now there is a failure in this
case.

Fixes: #107 (Reinitialize are failed to find the node in ipatopology ..)
Signed-off-by: Thomas Woerner <twoerner@redhat.com>
2019-07-26 19:30:11 +02:00
Varun Mylaraiah
f786658606 Merge pull request #109 from t-woerner/topologysegment_add
ipatopologysegment: Store suffix for commands in command list
2019-07-26 22:50:09 +05:30
Thomas Woerner
e4497c18e9 ipatopologysegment: Store suffix for commands in command list
With adding the domain and ca suffixes with `suffix: domain+ca` only ca
has been added as the suffix was only used from the last command. The
suffix is now stored together with the command and the argument. This
will fix this error.

Fixes: #106 (Last suffix adding twice in the list of topology segments)
2019-07-26 18:33:41 +02:00