refactor ♻️: Improve Ansible expect module usage for Samba DNS operations
Updated the Ansible expect modules from 'ansible.builtin.expect' to 'community.general.expect' to improve readability and maintainability. This change ensures consistent usage of the community.general module, making it easier to manage and update the playbook in the future.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
msg: "{{ addc_reverse_zone_name }} {{ addc_ansible_host }} {{ addc_admin_password }} {{ addc_ip_last_octet }} {{ addc_hostname }} {{ addc_auth_domain }}"
|
||||
|
||||
- name: "Create the reverse DNS zone {{ addc_reverse_zone_name }}"
|
||||
ansible.builtin.expect:
|
||||
community.general.expect:
|
||||
command: "samba-tool dns zonecreate {{ addc_ansible_host }} {{ addc_reverse_zone_name }} -U Administrator"
|
||||
responses:
|
||||
# Use the '(?i)' flag for case-insensitive matching of the prompt.
|
||||
@@ -18,7 +18,7 @@
|
||||
no_log: false # Highly recommended to prevent the password from appearing in logs
|
||||
|
||||
- name: "Create the PTR (reverse) DNS record"
|
||||
ansible.builtin.expect:
|
||||
community.general.expect:
|
||||
# Command syntax: samba-tool dns add <server> <zone> <record_name> PTR <target_fqdn>
|
||||
command: >
|
||||
samba-tool dns add {{ addc_ansible_host }}
|
||||
@@ -42,7 +42,7 @@
|
||||
msg: 'Samba Shares found: {{ smbclient_output.stdout }}'
|
||||
|
||||
- name: "Verify Samba AD authentication by accessing the netlogon share"
|
||||
ansible.builtin.expect:
|
||||
community.general.expect:
|
||||
# Command to run: smbclient //localhost/netlogon -UAdministrator -c 'ls'
|
||||
# The -c 'ls' command lists files on the share.
|
||||
command: smbclient //localhost/netlogon -UAdministrator -c 'ls'
|
||||
@@ -99,7 +99,7 @@
|
||||
var: ptr_record_check.stdout
|
||||
|
||||
- name: "Verify Kerberos authentication using kinit"
|
||||
ansible.builtin.expect:
|
||||
community.general.expect:
|
||||
# Command to run: kinit administrator
|
||||
command: kinit administrator
|
||||
responses:
|
||||
|
||||
Reference in New Issue
Block a user