diff --git a/tasks/ansible_user.yml b/tasks/ansible_user.yml index c7566e1..8fc130b 100644 --- a/tasks/ansible_user.yml +++ b/tasks/ansible_user.yml @@ -20,5 +20,3 @@ - 'Ansibles' - 'Administratoren' - 'Benutzer' - - diff --git a/tasks/hostname.yml b/tasks/hostname.yml new file mode 100644 index 0000000..85c0c12 --- /dev/null +++ b/tasks/hostname.yml @@ -0,0 +1,9 @@ +--- +- name: "Change the hostname to {{ inventory_hostname }}" + ansible.windows.win_hostname: + name: "{{ inventory_hostname }}" + register: res + +- name: Reboot + ansible.windows.win_reboot: + when: res.reboot_required diff --git a/tasks/main.yml b/tasks/main.yml index 25cb8bf..47815fb 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,4 +2,8 @@ - name: create Ansible Windows Group and User ansible.builtin.include_tasks: ansible_user.yml +- name: configure hostname + ansible.builtin.include_tasks: hostname.yml +- name: scan for updates + ansible.builtin.include_tasks: updates.yml diff --git a/tasks/updates.yml b/tasks/updates.yml new file mode 100644 index 0000000..f07794a --- /dev/null +++ b/tasks/updates.yml @@ -0,0 +1,9 @@ +--- +- name: Search-only, return list of found updates (if any), log to C:\ansible_updates.txt + ansible.windows.win_updates: + category_names: + - SecurityUpdates + - CriticalUpdates + - UpdateRollups + state: searched + log_path: C:\ansible_updates.txt