95 lines
3.2 KiB
YAML
95 lines
3.2 KiB
YAML
---
|
|
- name: Send notification message via Slack
|
|
delegate_to: localhost
|
|
community.general.slack:
|
|
token: "{{ slack_token }}"
|
|
msg: Starting Ax service on {{ inventory_hostname }}
|
|
|
|
- name: Start Ax service
|
|
ansible.windows.win_service:
|
|
name: aos60$01
|
|
state: started
|
|
start_mode: manual
|
|
|
|
- name: Send notification message via Slack
|
|
delegate_to: localhost
|
|
community.general.slack:
|
|
token: "{{ slack_token }}"
|
|
msg: Starting Model import {{ inventory_hostname }}
|
|
|
|
- name: Import TravelCardDynamicsAX.axmodel
|
|
ansible.windows.win_shell: |
|
|
$null = . 'D:\Program Files\Microsoft Dynamics AX\60\ManagementUtilities\Microsoft.Dynamics.ManagementUtilities.ps1'
|
|
$capture = axutil import /file:D:\IFSAXSystem\Tools\Model\TravelCardDynamicsAX.axmodel /noprompt /conflict:overwrite
|
|
$capture -match "was successfully imported"
|
|
become: true
|
|
register: import_output
|
|
tags:
|
|
- ax_import
|
|
|
|
- name: Display import_output
|
|
debug:
|
|
var: import_output.stdout
|
|
tags:
|
|
- ax_import
|
|
|
|
- name: Send notification message via Slack
|
|
delegate_to: localhost
|
|
community.general.slack:
|
|
token: "{{ slack_token }}"
|
|
msg: "Model import done on {{ inventory_hostname }}: {{ import_output.stdout }}"
|
|
|
|
- name: Send notification message via Slack
|
|
delegate_to: localhost
|
|
community.general.slack:
|
|
token: "{{ slack_token }}"
|
|
msg: setting no install mode on {{ inventory_hostname }}
|
|
|
|
- name: Run Dynamics.ManagementUtilities.ps1 - no install mode
|
|
ansible.windows.win_powershell:
|
|
script: |
|
|
$null = . 'D:\Program Files\Microsoft Dynamics AX\60\ManagementUtilities\Microsoft.Dynamics.ManagementUtilities.ps1'
|
|
$capture = axutil set /noInstallMode
|
|
$capture -match "successfully applied"
|
|
register: output
|
|
failed_when: "'The NoInstallMode has been successfully applied.' not in output.output"
|
|
|
|
- name: Send notification message via Slack
|
|
delegate_to: localhost
|
|
community.general.slack:
|
|
token: "{{ slack_token }}"
|
|
msg: "no install mode set on {{ inventory_hostname }} : {{output.output}}"
|
|
|
|
- name: Send notification message via Slack
|
|
delegate_to: localhost
|
|
community.general.slack:
|
|
token: "{{ slack_token }}"
|
|
msg: get travelCard Version on {{ inventory_hostname }}
|
|
|
|
- name: Get TravelCard version
|
|
ansible.windows.win_powershell:
|
|
script: |
|
|
$output = & 'D:\Program Files\Microsoft Dynamics AX\60\ManagementUtilities\Microsoft.Dynamics.ManagementUtilities.ps1' | axutil list
|
|
$travelCardLine = ($output -split "`n" | Select-String -Pattern "TravelCard ").Line
|
|
$travelCardLineClean = $travelCardLine -replace '.*?(?=TravelCard)', ''
|
|
Write-Output $travelCardLineClean
|
|
register: travel_card_version
|
|
|
|
- name: Send notification message via Slack
|
|
delegate_to: localhost
|
|
community.general.slack:
|
|
token: "{{ slack_token }}"
|
|
msg: "TravelCard Version on {{ inventory_hostname }}: {{ travel_card_version.output }}"
|
|
|
|
- name: Send notification message via Slack
|
|
delegate_to: localhost
|
|
community.general.slack:
|
|
token: "{{ slack_token }}"
|
|
msg: Stopping Ax service on {{ inventory_hostname }}
|
|
|
|
- name: Stop Ax service
|
|
ansible.windows.win_service:
|
|
name: aos60$01
|
|
state: stopped
|
|
start_mode: manual
|