mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-31 11:54:47 +00:00
ipatopology modules: Use ipaadmin_ prefix for principal and password
The use of password will conflict with the user password setting and is not really descriptive. ipaadmin_principal and ipaadmin_password are also used in the roles.
This commit is contained in:
@@ -50,7 +50,7 @@ Example playbook to add a topology segment wiht default name (cn):
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Add topology segment
|
- name: Add topology segment
|
||||||
ipatopologysegment:
|
ipatopologysegment:
|
||||||
password: MyPassword123
|
ipaadmin_password: MyPassword123
|
||||||
suffix: domain
|
suffix: domain
|
||||||
left: ipareplica1.test.local
|
left: ipareplica1.test.local
|
||||||
right: ipareplica2.test.local
|
right: ipareplica2.test.local
|
||||||
@@ -70,7 +70,7 @@ Example playbook to delete a topology segment:
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Delete topology segment
|
- name: Delete topology segment
|
||||||
ipatopologysegment:
|
ipatopologysegment:
|
||||||
password: MyPassword123
|
ipaadmin_password: MyPassword123
|
||||||
suffix: domain
|
suffix: domain
|
||||||
left: ipareplica1.test.local
|
left: ipareplica1.test.local
|
||||||
right: ipareplica2.test.local
|
right: ipareplica2.test.local
|
||||||
@@ -90,7 +90,7 @@ Example playbook to reinitialize a topology segment:
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Reinitialize topology segment
|
- name: Reinitialize topology segment
|
||||||
ipatopologysegment:
|
ipatopologysegment:
|
||||||
password: MyPassword123
|
ipaadmin_password: MyPassword123
|
||||||
suffix: domain
|
suffix: domain
|
||||||
left: ipareplica1.test.local
|
left: ipareplica1.test.local
|
||||||
right: ipareplica2.test.local
|
right: ipareplica2.test.local
|
||||||
@@ -111,7 +111,7 @@ Example playbook to verify a topology suffix:
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Verify topology suffix
|
- name: Verify topology suffix
|
||||||
ipatopologysuffix:
|
ipatopologysuffix:
|
||||||
password: MyPassword123
|
ipaadmin_password: MyPassword123
|
||||||
suffix: domain
|
suffix: domain
|
||||||
state: verified
|
state: verified
|
||||||
```
|
```
|
||||||
@@ -136,7 +136,7 @@ Example playbook to add a list of topology segments:
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Add topology segment
|
- name: Add topology segment
|
||||||
ipatopologysegment:
|
ipatopologysegment:
|
||||||
password: "{{ ipaadmin_password }}"
|
ipaadmin_password: "{{ ipaadmin_password }}"
|
||||||
suffix: "{{ item.suffix }}"
|
suffix: "{{ item.suffix }}"
|
||||||
name: "{{ item.name | default(omit) }}"
|
name: "{{ item.name | default(omit) }}"
|
||||||
left: "{{ item.left }}"
|
left: "{{ item.left }}"
|
||||||
@@ -157,8 +157,8 @@ ipatopologysegment
|
|||||||
|
|
||||||
Variable | Description | Required
|
Variable | Description | Required
|
||||||
-------- | ----------- | --------
|
-------- | ----------- | --------
|
||||||
`principal` | The admin principal is a string and defaults to `admin` | no
|
`ipaadmin_principal` | The admin principal is a string and defaults to `admin` | no
|
||||||
`password` | The admin password is a string and is required if there is no admin ticket available on the node | no
|
`ipaadmin_password` | The admin password is a string and is required if there is no admin ticket available on the node | no
|
||||||
`suffix` | The topology suffix to be used, this can either be `domain`, `ca` or `domain+ca` | yes
|
`suffix` | The topology suffix to be used, this can either be `domain`, `ca` or `domain+ca` | yes
|
||||||
`name` \| `cn` | The topology segment name (cn) is the unique identifier for a segment. | no
|
`name` \| `cn` | The topology segment name (cn) is the unique identifier for a segment. | no
|
||||||
`left` \| `leftnode` | The left replication node string - an IPA server | no
|
`left` \| `leftnode` | The left replication node string - an IPA server | no
|
||||||
@@ -174,8 +174,8 @@ Verify FreeIPA topology suffix
|
|||||||
|
|
||||||
Variable | Description | Required
|
Variable | Description | Required
|
||||||
-------- | ----------- | --------
|
-------- | ----------- | --------
|
||||||
`principal` | The admin principal is a string and defaults to `admin` | no
|
`ipaadmin_principal` | The admin principal is a string and defaults to `admin` | no
|
||||||
`password` | The admin password is a string and is required if there is no admin ticket available on the node | no
|
`ipaadmin_password` | The admin password is a string and is required if there is no admin ticket available on the node | no
|
||||||
`suffix` | The topology suffix to be used, this can either be `domain` or `ca` | yes
|
`suffix` | The topology suffix to be used, this can either be `domain` or `ca` | yes
|
||||||
`state` | The state to ensure. It can only be `verified` | yes
|
`state` | The state to ensure. It can only be `verified` | yes
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Add topology segment
|
- name: Add topology segment
|
||||||
ipatopologysegment:
|
ipatopologysegment:
|
||||||
password: MyPassword123
|
ipaadmin_password: MyPassword123
|
||||||
suffix: domain
|
suffix: domain
|
||||||
left: ipareplica1.test.local
|
left: ipareplica1.test.local
|
||||||
right: ipareplica2.test.local
|
right: ipareplica2.test.local
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Add topology segment
|
- name: Add topology segment
|
||||||
ipatopologysegment:
|
ipatopologysegment:
|
||||||
password: "{{ ipaadmin_password }}"
|
ipaadmin_password: "{{ ipaadmin_password }}"
|
||||||
suffix: "{{ item.suffix }}"
|
suffix: "{{ item.suffix }}"
|
||||||
name: "{{ item.name | default(omit) }}"
|
name: "{{ item.name | default(omit) }}"
|
||||||
left: "{{ item.left }}"
|
left: "{{ item.left }}"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Add topology segment
|
- name: Add topology segment
|
||||||
ipatopologysegment:
|
ipatopologysegment:
|
||||||
password: "{{ ipaadmin_password }}"
|
ipaadmin_password: "{{ ipaadmin_password }}"
|
||||||
suffix: "{{ item.suffix }}"
|
suffix: "{{ item.suffix }}"
|
||||||
name: "{{ item.name | default(omit) }}"
|
name: "{{ item.name | default(omit) }}"
|
||||||
left: "{{ item.left }}"
|
left: "{{ item.left }}"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Delete topology segment
|
- name: Delete topology segment
|
||||||
ipatopologysegment:
|
ipatopologysegment:
|
||||||
password: MyPassword123
|
ipaadmin_password: MyPassword123
|
||||||
suffix: domain
|
suffix: domain
|
||||||
left: ipareplica1.test.local
|
left: ipareplica1.test.local
|
||||||
right: ipareplica2.test.local
|
right: ipareplica2.test.local
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Add topology segment
|
- name: Add topology segment
|
||||||
ipatopologysegment:
|
ipatopologysegment:
|
||||||
password: "{{ ipaadmin_password }}"
|
ipaadmin_password: "{{ ipaadmin_password }}"
|
||||||
suffix: "{{ item.suffix }}"
|
suffix: "{{ item.suffix }}"
|
||||||
name: "{{ item.name | default(omit) }}"
|
name: "{{ item.name | default(omit) }}"
|
||||||
left: "{{ item.left }}"
|
left: "{{ item.left }}"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Reinitialize topology segment
|
- name: Reinitialize topology segment
|
||||||
ipatopologysegment:
|
ipatopologysegment:
|
||||||
password: MyPassword123
|
ipaadmin_password: MyPassword123
|
||||||
suffix: domain
|
suffix: domain
|
||||||
left: ipareplica1.test.local
|
left: ipareplica1.test.local
|
||||||
right: ipareplica2.test.local
|
right: ipareplica2.test.local
|
||||||
|
|||||||
@@ -6,6 +6,6 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Verify topology suffix
|
- name: Verify topology suffix
|
||||||
ipatopologysuffix:
|
ipatopologysuffix:
|
||||||
password: MyPassword123
|
ipaadmin_password: MyPassword123
|
||||||
suffix: domain
|
suffix: domain
|
||||||
state: verified
|
state: verified
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ module: ipatopologysegment
|
|||||||
short description: Manage FreeIPA topology segments
|
short description: Manage FreeIPA topology segments
|
||||||
description: Manage FreeIPA topology segments
|
description: Manage FreeIPA topology segments
|
||||||
options:
|
options:
|
||||||
principal:
|
ipaadmin_principal:
|
||||||
description: The admin principal
|
description: The admin principal
|
||||||
default: admin
|
default: admin
|
||||||
password:
|
ipaadmin_password:
|
||||||
description: The admin password
|
description: The admin password
|
||||||
required: false
|
required: false
|
||||||
suffix:
|
suffix:
|
||||||
@@ -173,8 +173,8 @@ def find_left_right_cn(module, suffix, left, right, name):
|
|||||||
def main():
|
def main():
|
||||||
ansible_module = AnsibleModule(
|
ansible_module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
principal=dict(type="str", default="admin"),
|
ipaadmin_principal=dict(type="str", default="admin"),
|
||||||
password=dict(type="str", required=False, no_log=True),
|
ipaadmin_password=dict(type="str", required=False, no_log=True),
|
||||||
suffix=dict(choices=["domain", "ca", "domain+ca"], required=True),
|
suffix=dict(choices=["domain", "ca", "domain+ca"], required=True),
|
||||||
name=dict(type="str", aliases=["cn"], default=None),
|
name=dict(type="str", aliases=["cn"], default=None),
|
||||||
left=dict(type="str", aliases=["leftnode"], default=None),
|
left=dict(type="str", aliases=["leftnode"], default=None),
|
||||||
@@ -192,8 +192,8 @@ def main():
|
|||||||
|
|
||||||
# Get parameters
|
# Get parameters
|
||||||
|
|
||||||
principal = ansible_module.params.get("principal")
|
ipaadmin_principal = ansible_module.params.get("ipaadmin_principal")
|
||||||
password = ansible_module.params.get("password")
|
ipaadmin_password = ansible_module.params.get("ipaadmin_password")
|
||||||
suffixes = ansible_module.params.get("suffix")
|
suffixes = ansible_module.params.get("suffix")
|
||||||
name = ansible_module.params.get("name")
|
name = ansible_module.params.get("name")
|
||||||
left = ansible_module.params.get("left")
|
left = ansible_module.params.get("left")
|
||||||
@@ -214,8 +214,9 @@ def main():
|
|||||||
ccache_dir = None
|
ccache_dir = None
|
||||||
ccache_name = None
|
ccache_name = None
|
||||||
try:
|
try:
|
||||||
if not valid_creds(principal):
|
if not valid_creds(ipaadmin_principal):
|
||||||
ccache_dir, ccache_name = temp_kinit(principal, password)
|
ccache_dir, ccache_name = temp_kinit(ipaadmin_principal,
|
||||||
|
ipaadmin_password)
|
||||||
api_connect()
|
api_connect()
|
||||||
|
|
||||||
commands = []
|
commands = []
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ module: ipatopologysuffix
|
|||||||
short description: Verify FreeIPA topology suffix
|
short description: Verify FreeIPA topology suffix
|
||||||
description: Verify FreeIPA topology suffix
|
description: Verify FreeIPA topology suffix
|
||||||
options:
|
options:
|
||||||
principal:
|
ipaadmin_principal:
|
||||||
description: The admin principal
|
description: The admin principal
|
||||||
default: admin
|
default: admin
|
||||||
password:
|
ipaadmin_password:
|
||||||
description: The admin password
|
description: The admin password
|
||||||
required: false
|
required: false
|
||||||
suffix:
|
suffix:
|
||||||
@@ -66,8 +66,8 @@ from ansible.module_utils.ansible_freeipa_module import execute_api_command
|
|||||||
def main():
|
def main():
|
||||||
ansible_module = AnsibleModule(
|
ansible_module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
principal=dict(type="str", default="admin"),
|
ipaadmin_principal=dict(type="str", default="admin"),
|
||||||
password=dict(type="str", required=False, no_log=True),
|
ipaadmin_password=dict(type="str", required=False, no_log=True),
|
||||||
suffix=dict(choices=["domain", "ca"], required=True),
|
suffix=dict(choices=["domain", "ca"], required=True),
|
||||||
state=dict(type="str", default="verified",
|
state=dict(type="str", default="verified",
|
||||||
choices=["verified"]),
|
choices=["verified"]),
|
||||||
@@ -79,8 +79,8 @@ def main():
|
|||||||
|
|
||||||
# Get parameters
|
# Get parameters
|
||||||
|
|
||||||
principal = ansible_module.params.get("principal")
|
ipaadmin_principal = ansible_module.params.get("ipaadmin_principal")
|
||||||
password = ansible_module.params.get("password")
|
ipaadmin_password = ansible_module.params.get("ipaadmin_password")
|
||||||
suffix = ansible_module.params.get("suffix")
|
suffix = ansible_module.params.get("suffix")
|
||||||
state = ansible_module.params.get("state")
|
state = ansible_module.params.get("state")
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ def main():
|
|||||||
|
|
||||||
# Execute command
|
# Execute command
|
||||||
|
|
||||||
execute_api_command(ansible_module, principal, password,
|
execute_api_command(ansible_module, ipaadmin_principal, ipaadmin_password,
|
||||||
command, to_text(suffix), args)
|
command, to_text(suffix), args)
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
|
|||||||
Reference in New Issue
Block a user