Add-WindowsFeature –Name RDS-RD-Server –IncludeAllSubFeature
Enter code here...$servername=(Get-WmiObject win32_computersystem).DNSHostName+"."+(Get-WmiObject win32_computersystem).Domain- name: Copy Windows Feature installation script win_copy: src: TS_Script1.ps1 dest: c:\temp\TS_Script1.ps1 - name: Install Windows Feature installation script win_shell: c:\temp\TS_Script1.ps1 register: result - name: Reboot from Windows feature install win_reboot: when: result == "Completed"
#Wait for the machine to reboot from installing the windows features- name: Waiting for reboot local_action: shell ansible -u {{ansible_user_id}} -m ping {{ inventory_hostname }} register: result until: result.rc == 0 retries: 30 delay: 10
- name: Copy RDS installation script win_copy: src: TS_Script2_Install_RDS.ps1 dest: c:\temp\TS_Script2_Install_RDS.ps1
- name: Install RDS installation script win_shell: c:\temp\TS_Script2_Install_RDS.ps1 register: RDSInstall - name: Reboot from Windows feature install win_reboot: when: RDSInstall == "Completed"
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/ee20a3da-7b96-461f-8839-435ffd4f9366%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
- name: Install RDS feature
win_feature:
name: RDS-RD-Server
include_sub_features: True
state: present
register: feature_install
- name: Reboot after installing feature
win_reboot:
when: feature_install.reboot_required
- name: Install RDS
script: TS_Script2_Install_RDS.ps1
register: rds_install
# The below will only work if the first thing outputted is a boolean that indicates if it was installed or not
changed_when: rds_install.stdout_lines[0]|bool == True
- name: Reboot after RDS install
win_reboot:
# Same thing here, you would need to make sure the first output object
from your script is a bool that indicates if it was installed or not
when: rds_install.stdout_lines[0]|bool == True