From ea7ef6e0f0dbd34f7f778a4f7d29d2b72219a609 Mon Sep 17 00:00:00 2001 From: "ansible-code-bot[bot]" <145416087+ansible-code-bot[bot]@users.noreply.github.com> Date: Thu, 12 Sep 2024 09:27:25 +0000 Subject: [PATCH] Fix ansible-lint rule violations --- apt_update_upgrade.yml | 2 +- backupubu.yml | 98 ++++---- clone_ubu1.yml | 18 +- create_vm.yml | 1 - install_zabbix_agent.yml | 2 +- inventory/inventory.yml | 64 ++--- list-hyperv-vms.yml | 5 +- list_proxmox.yml | 25 +- nmap.yml | 6 +- oldstuff/Clean_up.yaml | 57 +++-- oldstuff/Import-ax-modelstore.yaml | 57 +++-- oldstuff/ansible-krb-install.yaml | 90 +++---- oldstuff/install-Bo_and_Ax.yaml | 147 ++++++------ oldstuff/install-axinstall-new.yaml | 194 ++++++++-------- oldstuff/install-boinstall.yaml | 60 ++--- .../install-boinstall_and_axinstall-new.yaml | 215 +++++++++-------- oldstuff/install-boinstall_and_axinstall.yaml | 147 ++++++------ oldstuff/install-notepadplus.yaml | 57 +++-- oldstuff/old/OLD_run-ax-Cilcompile.yaml | 57 +++-- oldstuff/old/install-v12.0.yaml | 147 ++++++------ oldstuff/start-AX.yaml | 58 ++--- oldstuff/start.yaml | 158 ++++++------- oldstuff/stop-AX.yaml | 59 +++-- oldstuff/stop.yaml | 157 ++++++------- oldstuff/tasks/Clean-up_Test.yaml | 42 ++-- .../Postinstalls/install-PI43972_CWS.yaml | 36 +-- .../Postinstalls/install-PI43976_CWS.yaml | 36 +-- .../Postinstalls/install-PI43980_CWS.yaml | 24 +- .../Postinstalls/install-PI43981_CWS.yaml | 24 +- .../Postinstalls/install-PI46769_CWS.yaml | 24 +- .../Postinstalls/install-PI46777_CWS.yaml | 24 +- .../Postinstalls/install-PI46792_MDL.yaml | 42 ++-- .../Postinstalls/install-PI46810_BORIS.yaml | 22 +- .../Postinstalls/install-PI46810_CWS.yaml | 22 +- .../tasks/Postinstalls/install-PI46838.yaml | 98 ++++---- .../Postinstalls/install-PI46849_MDL.yaml | 36 ++- .../v.12/install-PI43972_CWS.yaml | 36 +-- .../v.12/install-PI43976_CWS.yaml | 36 +-- .../v.12/install-PI43980_CWS.yaml | 24 +- .../v.12/install-PI43981_CWS.yaml | 24 +- .../v.12/install-PI46769_CWS.yaml | 24 +- .../v.12/install-PI46777_CWS.yaml | 24 +- .../v.12/install-PI46792_MDL.yaml | 42 ++-- .../v.12/install-PI46810_BORIS.yaml | 22 +- .../v.12/install-PI46810_CWS.yaml | 22 +- .../Postinstalls/v.12/install-PI46838.yaml | 98 ++++---- .../v.12/install-PI46849_MDL.yaml | 36 ++- .../v.12/install-axinstall-v12.0-TestA.yaml | 151 ++++++------ .../v.12/install-axinstall-v12.0-TestC.yaml | 151 ++++++------ .../v.12/install-boinstall-v12.0-TestA.yaml | 171 +++++++------- .../v.12/install-boinstall-v12.0-TestC.yaml | 171 +++++++------- .../v.12/install-boinstall-v12.0_HF.yaml | 171 +++++++------- oldstuff/tasks/grab-config.yaml | 38 +-- ...ll-TravelCardDeployTravelCardServices.yaml | 71 +++--- .../tasks/install-axinstall-cilcompile.yaml | 219 +++++++++--------- ...xinstall-deployposttravelcardservices.yaml | 122 +++++----- .../tasks/install-axinstall-importmodel.yaml | 189 ++++++++------- .../tasks/install-axinstall-sqlreindex.yaml | 53 ++--- .../install-axinstall-xppcompileall.yaml | 205 ++++++++-------- oldstuff/tasks/install-axinstall.yaml | 151 ++++++------ oldstuff/tasks/install-boinstall.yaml | 169 +++++++------- oldstuff/tasks/install-notepadplus.yaml | 104 ++++----- .../old/install-axinstall-v12.0-TestA.yaml | 151 ++++++------ .../old/install-axinstall-v12.0-TestC.yaml | 151 ++++++------ .../old/install-boinstall-v12.0-TestA.yaml | 171 +++++++------- .../old/install-boinstall-v12.0-TestC.yaml | 171 +++++++------- .../tasks/old/install-boinstall-v12.0_HF.yaml | 171 +++++++------- oldstuff/tasks/reboot.yaml | 18 +- oldstuff/tasks/start-aos.yaml | 24 +- oldstuff/tasks/start-ifsbo.yaml | 64 ++--- oldstuff/tasks/start-iis.yaml | 18 +- oldstuff/tasks/stop-aos.yaml | 24 +- oldstuff/tasks/stop-ifsbo.yaml | 73 +++--- oldstuff/tasks/stop-iis.yaml | 18 +- oldstuff/tasks/task-failed-slack.yaml | 18 +- oldstuff/tasks/test-log4net.yaml | 32 +-- oldstuff/tasks/uninstall-axinstall-pom.yaml | 22 +- oldstuff/tasks/uninstall-axinstall.yaml | 46 ++-- oldstuff/tasks/uninstall-boinstall.yaml | 76 +++--- oldstuff/template-install.yaml | 139 ++++++----- oldstuff/test-connectivity.yaml | 30 +-- oldstuff/test-grabconfig.yaml | 68 +++--- oldstuff/test-log4net.yaml | 19 +- oldstuff/test-windows.yaml | 31 ++- oldstuff/uninstall-axinstall.yaml | 89 ++++--- oldstuff/uninstall-boinstall.yaml | 72 +++--- oldstuff/uninstall.yaml | 109 +++++---- remove_vm.yml | 31 ++- roles/shutdown-role/meta/main.yml | 13 +- roles/unifi_dhcp_clients_list/meta/main.yml | 13 +- roles/unifi_dhcp_clients_list/tasks/main.yml | 2 +- roles/zabbix_agent/defaults/main.yml | 13 +- roles/zabbix_agent/meta/main.yml | 13 +- roles/zabbix_agent/tasks/main.yml | 78 +++---- show_portforwarding_rules.yml | 12 +- shutdown_windows.yml | 1 + test_zabbix_connection.yml | 10 +- unifi-dhcp-clients-list.yml | 12 +- verify_ssh.yml | 2 +- wake-and-update-ubuntu.yml | 78 +++---- zabbix-agent.yml | 2 +- zabbix-host.yml | 40 ++-- zabbix_network.yml | 8 +- 103 files changed, 3396 insertions(+), 3572 deletions(-) diff --git a/apt_update_upgrade.yml b/apt_update_upgrade.yml index 9deca5c..8efc185 100644 --- a/apt_update_upgrade.yml +++ b/apt_update_upgrade.yml @@ -29,7 +29,7 @@ - name: Reboot the system if a reboot is required ansible.builtin.reboot: - msg: "Reboot initiated by Ansible because updates require a restart" + msg: Reboot initiated by Ansible because updates require a restart connect_timeout: 5 reboot_timeout: 600 pre_reboot_delay: 0 diff --git a/backupubu.yml b/backupubu.yml index 38b62f5..ddb0e70 100644 --- a/backupubu.yml +++ b/backupubu.yml @@ -6,129 +6,129 @@ - vault.yml vars: - backup_dir: "/home" - nas_target_base: "/volume1/Backup" - cron_time: "0 17 * * 0" # This represents every Sunday at 17:00 + backup_dir: /home + nas_target_base: /volume1/Backup + cron_time: "0 17 * * 0" # This represents every Sunday at 17:00 hostname: "{{ ansible_hostname }}" - cron_name: "Wake NAS and Backup to Synology NAS" + cron_name: Wake NAS and Backup to Synology NAS ssh_key_paths: - - "/home/alex/.ssh/id_ed25519.pub" - - "/home/alex/.ssh/id_rsa.pub" - - "/home/alex/.ssh/id_ecdsa.pub" - - "/home/alex/.ssh/id_dsa.pub" + - /home/alex/.ssh/id_ed25519.pub + - /home/alex/.ssh/id_rsa.pub + - /home/alex/.ssh/id_ecdsa.pub + - /home/alex/.ssh/id_dsa.pub tasks: - name: Update apt cache - apt: - update_cache: yes - become: yes + become: true + ansible.builtin.apt: + update_cache: true - name: Ensure rsync is installed - apt: + become: true + ansible.builtin.apt: name: rsync state: present - become: yes - name: Ensure etherwake is installed - apt: + become: true + ansible.builtin.apt: name: etherwake state: present - become: yes - name: Find network interface with 192.168.1.x IP address - shell: ip -o -4 addr list | grep '192.168.1.' | awk '{print $2}' register: network_interface + ansible.builtin.shell: ip -o -4 addr list | grep '192.168.1.' | awk '{print $2}' - name: Set network_interface fact - set_fact: + ansible.builtin.set_fact: network_interface: "{{ network_interface.stdout }}" - name: Find existing SSH public key - stat: - path: "{{ item }}" with_items: "{{ ssh_key_paths }}" register: ssh_key_check + ansible.builtin.stat: + path: "{{ item }}" - name: Set SSH key path - set_fact: - ssh_key_path: "{{ ssh_key_check.results | selectattr('stat.exists', 'equalto', true) | map(attribute='item') | first }}" when: ssh_key_check.results | selectattr('stat.exists', 'equalto', true) | length > 0 + ansible.builtin.set_fact: + ssh_key_path: "{{ ssh_key_check.results | selectattr('stat.exists', 'equalto', true) | map(attribute='item') | first }}" - name: Debug SSH key path - debug: + ansible.builtin.debug: msg: "SSH key path: {{ ssh_key_path }}" - name: Read the SSH public key - slurp: - src: "{{ ssh_key_path }}" register: ssh_pub_key when: ssh_key_path is defined + ansible.builtin.slurp: + src: "{{ ssh_key_path }}" - name: Ensure .ssh directory exists on the NAS - command: "ssh alex@alex-ds414.localdomain 'mkdir -p ~/.ssh && chmod 700 ~/.ssh'" - ignore_errors: yes + ignore_errors: true + ansible.builtin.command: ssh alex@alex-ds414.localdomain 'mkdir -p ~/.ssh && chmod 700 ~/.ssh' - name: Add the SSH public key to the NAS authorized_keys - command: "ssh alex@alex-ds414.localdomain 'echo {{ ssh_pub_key.content | b64decode }} >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys'" when: ssh_key_path is defined + ansible.builtin.command: ssh alex@alex-ds414.localdomain 'echo {{ ssh_pub_key.content | b64decode }} >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys' - name: Show debug info for rsync_user and rsync_password - debug: + ansible.builtin.debug: msg: "rsync_user: {{ rsync_user }}, rsync_password: {{ rsync_password }}" - name: Wake up the NAS - command: sudo etherwake -i {{ network_interface }} 00:11:32:43:FA:11 async: 0 poll: 0 - become: yes + become: true + ansible.builtin.command: sudo etherwake -i {{ network_interface }} 00:11:32:43:FA:11 - name: Wait for 1 minute to allow NAS to start up initially - wait_for: + ansible.builtin.wait_for: timeout: 60 - name: Check if NAS is reachable via SSH - command: "ssh -o BatchMode=yes -o ConnectTimeout=5 alex@alex-ds414.localdomain echo 'SSH connection successful'" register: nas_ping_result - ignore_errors: yes + ignore_errors: true + ansible.builtin.command: ssh -o BatchMode=yes -o ConnectTimeout=5 alex@alex-ds414.localdomain echo 'SSH connection successful' - name: Fail if the NAS is not reachable via SSH - fail: - msg: "NAS is not reachable via SSH. Exiting." when: nas_ping_result.rc != 0 + ansible.builtin.fail: + msg: NAS is not reachable via SSH. Exiting. - name: Perform the test rsync - command: rsync -av --dry-run --delete {{ backup_dir }}/ alex@alex-ds414.localdomain:{{ nas_target_base }}/{{ hostname }}/ register: rsync_test - ignore_errors: yes + ignore_errors: true failed_when: rsync_test.rc not in [0, 23] + ansible.builtin.command: rsync -av --dry-run --delete {{ backup_dir }}/ alex@alex-ds414.localdomain:{{ nas_target_base }}/{{ hostname }}/ - name: Fail if the rsync test fails for reasons other than permission issues - fail: - msg: "rsync test failed for reasons other than permission issues. Exiting." when: rsync_test.rc not in [0, 23] + ansible.builtin.fail: + msg: rsync test failed for reasons other than permission issues. Exiting. - name: Perform the backup using rsync - command: rsync -av --delete {{ backup_dir }}/ alex@alex-ds414.localdomain:{{ nas_target_base }}/{{ hostname }}/ when: rsync_test.rc in [0, 23] - ignore_errors: yes + ignore_errors: true failed_when: rsync_test.rc not in [0, 23] + ansible.builtin.command: rsync -av --delete {{ backup_dir }}/ alex@alex-ds414.localdomain:{{ nas_target_base }}/{{ hostname }}/ - name: Check if cron job exists - cron: + register: cron_present + ignore_errors: true + ansible.builtin.cron: name: "{{ cron_name }}" state: present - register: cron_present - ignore_errors: yes - name: Add cron job for backup if not present - cron: + when: rsync_test.rc in [0, 23] and (cron_present is not defined or cron_present is failed) + become: true + ansible.builtin.cron: name: "{{ cron_name }}" minute: "{{ cron_time.split()[0] }}" hour: "{{ cron_time.split()[1] }}" day: "{{ cron_time.split()[2] }}" month: "{{ cron_time.split()[3] }}" weekday: "{{ cron_time.split()[4] }}" - job: "sudo etherwake -i {{ network_interface }} 00:11:32:43:FA:11 && sleep 300 && rsync -av --delete /home/ alex@alex-ds414.localdomain:{{ nas_target_base }}/{{ hostname }}/" - when: rsync_test.rc in [0, 23] and (cron_present is not defined or cron_present is failed) - become: yes - + job: sudo etherwake -i {{ network_interface }} 00:11:32:43:FA:11 && sleep 300 && rsync -av --delete /home/ alex@alex-ds414.localdomain:{{ nas_target_base + }}/{{ hostname }}/ diff --git a/clone_ubu1.yml b/clone_ubu1.yml index 33d7555..6be313f 100644 --- a/clone_ubu1.yml +++ b/clone_ubu1.yml @@ -3,14 +3,14 @@ hosts: proxmox.localdomain gather_facts: false vars: - api_host: "192.168.1.162" - api_user: "root@pam" - api_token_id: "mytoki" - api_token_secret: "ea5114f5-ed39-4277-ac09-a32984be5bc9" - proxmox_node: "pve" # Add your Proxmox node name here + api_host: 192.168.1.162 + api_user: root@pam + api_token_id: mytoki + api_token_secret: ea5114f5-ed39-4277-ac09-a32984be5bc9 + proxmox_node: pve # Add your Proxmox node name here vars_prompt: - name: new_vm_name - prompt: "Enter the name for the new VM" + prompt: Enter the name for the new VM private: false tasks: - name: List all VMs and templates @@ -43,11 +43,11 @@ api_token_id: "{{ api_token_id }}" api_token_secret: "{{ api_token_secret }}" api_host: "{{ api_host }}" - clone: "ubu-srv01" + clone: ubu-srv01 name: "{{ new_vm_name }}" node: "{{ proxmox_node }}" - storage: "local" - format: "qcow2" + storage: local + format: qcow2 full: true timeout: 240 validate_certs: false diff --git a/create_vm.yml b/create_vm.yml index c818808..973cd83 100644 --- a/create_vm.yml +++ b/create_vm.yml @@ -19,4 +19,3 @@ name: "{{ vm_name }}" node: "{{ node_name }}" state: present - diff --git a/install_zabbix_agent.yml b/install_zabbix_agent.yml index 56b110a..933524e 100644 --- a/install_zabbix_agent.yml +++ b/install_zabbix_agent.yml @@ -83,7 +83,7 @@ port: "{{ zabbix_port | default(10050) }}" tls_connect: 2 tls_accept: 2 - tls_psk_identity: "PSK-{{ inventory_hostname }}" + tls_psk_identity: PSK-{{ inventory_hostname }} tls_psk: "{{ zabbix_psk.stdout }}" proxy: "{{ zabbix_proxy | default(omit) }}" become: false diff --git a/inventory/inventory.yml b/inventory/inventory.yml index ddbc596..5ed0632 100644 --- a/inventory/inventory.yml +++ b/inventory/inventory.yml @@ -6,30 +6,30 @@ all: ubu.localdomain: ansible_host: 192.168.1.23 ansible_user: alex - ansible_ssh_pass: "Aase#1234!" - ansible_become_pass: "Aase#1234!" - zabbix_host_groups: "Linux servers" - zabbix_link_template: "Template OS Linux" - zabbix_agent_psk: "1d3b2f634a975a68df1ac903daa4d10d5b00a3d95c33463cffb402f5e39be75f" + ansible_ssh_pass: Aase#1234! + ansible_become_pass: Aase#1234! + zabbix_host_groups: Linux servers + zabbix_link_template: Template OS Linux + zabbix_agent_psk: 1d3b2f634a975a68df1ac903daa4d10d5b00a3d95c33463cffb402f5e39be75f raspii.localdomain: ansible_host: 192.168.1.24 ansible_user: alex ansible_python_interpreter: /usr/bin/python3 - ansible_ssh_pass: "Aase#1234!" - ansible_become_pass: "Aase#1234!" - zabbix_host_groups: "Linux servers" - zabbix_link_template: "Template OS Linux" - zabbix_agent_psk: "1d3b2f634a975a68df1ac903daa4d10d5b00a3d95c33463cffb402f5e39be75f" + ansible_ssh_pass: Aase#1234! + ansible_become_pass: Aase#1234! + zabbix_host_groups: Linux servers + zabbix_link_template: Template OS Linux + zabbix_agent_psk: 1d3b2f634a975a68df1ac903daa4d10d5b00a3d95c33463cffb402f5e39be75f proxmox.localdomain: ansible_host: 192.168.1.162 ansible_user: root ansible_password: Aase#1234! ansible_python_interpreter: /root/proxmoxer_env/bin/python - ansible_ssh_pass: "Aase#1234!" - ansible_become_pass: "Aase#1234!" - zabbix_host_groups: "Linux servers" - zabbix_link_template: "Template OS Linux" - zabbix_agent_psk: "1d3b2f634a975a68df1ac903daa4d10d5b00a3d95c33463cffb402f5e39be75f" + ansible_ssh_pass: Aase#1234! + ansible_become_pass: Aase#1234! + zabbix_host_groups: Linux servers + zabbix_link_template: Template OS Linux + zabbix_agent_psk: 1d3b2f634a975a68df1ac903daa4d10d5b00a3d95c33463cffb402f5e39be75f vars: proxmox_host: 192.168.1.162 proxmox_user: root@pam @@ -44,30 +44,30 @@ all: ansible_host: 192.168.1.144 ansible_user: alex ansible_python_interpreter: /usr/bin/python3 - ansible_ssh_pass: "Aase#1234!" - ansible_become_pass: "Aase#1234!" - zabbix_host_groups: "Linux servers" - zabbix_link_template: "Template OS Linux" - zabbix_agent_psk: "1d3b2f634a975a68df1ac903daa4d10d5b00a3d95c33463cffb402f5e39be75f" + ansible_ssh_pass: Aase#1234! + ansible_become_pass: Aase#1234! + zabbix_host_groups: Linux servers + zabbix_link_template: Template OS Linux + zabbix_agent_psk: 1d3b2f634a975a68df1ac903daa4d10d5b00a3d95c33463cffb402f5e39be75f alex-ds414.localdomain: ansible_host: 192.168.1.113 ansible_user: alexadmin ansible_python_interpreter: /usr/bin/python3 ansible_password: $ZD7P=.X2@e,Ju; - # network_devices: - # hosts: - # USG-PRO-4: - # ansible_host: 192.168.1.1 - # ansible_user: alexpolo - # ansible_password: o3vTbA3WBlmghEOg - # ansible_network_os: vyos.vyos + # network_devices: + # hosts: + # USG-PRO-4: + # ansible_host: 192.168.1.1 + # ansible_user: alexpolo + # ansible_password: o3vTbA3WBlmghEOg + # ansible_network_os: vyos.vyos other_devices: hosts: localhost-live.localdomain: ansible_host: 192.168.1.10 - ansible_ssh_pass: "Aase#1234!" - ansible_become_pass: "Aase#1234!" - zabbix_host_groups: "Linux servers" - zabbix_link_template: "Template OS Linux" - zabbix_agent_psk: "1d3b2f634a975a68df1ac903daa4d10d5b00a3d95c33463cffb402f5e39be75f" + ansible_ssh_pass: Aase#1234! + ansible_become_pass: Aase#1234! + zabbix_host_groups: Linux servers + zabbix_link_template: Template OS Linux + zabbix_agent_psk: 1d3b2f634a975a68df1ac903daa4d10d5b00a3d95c33463cffb402f5e39be75f diff --git a/list-hyperv-vms.yml b/list-hyperv-vms.yml index b120fc8..e5d57b4 100644 --- a/list-hyperv-vms.yml +++ b/list-hyperv-vms.yml @@ -3,15 +3,14 @@ hosts: homeserver.localdomain gather_facts: false vars: - winrmadmin_username: "ansible_user" - winrmadmin_password: "YourStrongPasswordHere" + winrmadmin_username: ansible_user + winrmadmin_password: YourStrongPasswordHere tasks: - name: Get WinRM credentials from Ansible Vault ansible.builtin.include_vars: file: /home/alex/git/ansible/credentials.yml name: vault_vars - - name: List Hyper-V virtual machines ansible.windows.win_shell: | Get-VM | Select-Object Name, State, MemoryAssigned, ProcessorCount, Uptime diff --git a/list_proxmox.yml b/list_proxmox.yml index d46bef9..40f1fd0 100644 --- a/list_proxmox.yml +++ b/list_proxmox.yml @@ -1,13 +1,13 @@ --- - name: List VMs, Templates, and ISOs on Proxmox hosts: proxmox.localdomain - gather_facts: no + gather_facts: false vars: - api_host: "192.168.1.162" - api_user: "root@pam" - api_token_id: "mytoki" - api_token_secret: "ea5114f5-ed39-4277-ac09-a32984be5bc9" - proxmox_node: "pve" # Add your Proxmox node name here + api_host: 192.168.1.162 + api_user: root@pam + api_token_id: mytoki + api_token_secret: ea5114f5-ed39-4277-ac09-a32984be5bc9 + proxmox_node: pve # Add your Proxmox node name here tasks: - name: List all VMs community.general.proxmox_vm_info: @@ -15,11 +15,11 @@ api_user: "{{ api_user }}" api_token_id: "{{ api_token_id }}" api_token_secret: "{{ api_token_secret }}" - validate_certs: no + validate_certs: false register: vms_info - name: Print VM info - debug: + ansible.builtin.debug: var: vms_info - name: List all nodes @@ -28,11 +28,11 @@ api_user: "{{ api_user }}" api_token_id: "{{ api_token_id }}" api_token_secret: "{{ api_token_secret }}" - validate_certs: no + validate_certs: false register: nodes_info - name: Print node info - debug: + ansible.builtin.debug: var: nodes_info - name: List all ISOs @@ -41,12 +41,11 @@ api_user: "{{ api_user }}" api_token_id: "{{ api_token_id }}" api_token_secret: "{{ api_token_secret }}" - validate_certs: no + validate_certs: false storage: local node: "{{ proxmox_node }}" register: isos_info - name: Print ISO info - debug: + ansible.builtin.debug: var: isos_info - diff --git a/nmap.yml b/nmap.yml index ce08076..e2f2215 100644 --- a/nmap.yml +++ b/nmap.yml @@ -3,9 +3,9 @@ plugin: ansible.builtin.nmap strict: false address: 192.168.1.0/24 exclude: 192.168.1.1 -command: '-sn' +command: -sn keyed_groups: - - prefix: 'os_' - key: 'os' + - prefix: os_ + key: os compose: ansible_host: ip diff --git a/oldstuff/Clean_up.yaml b/oldstuff/Clean_up.yaml index f8ebcbe..9702b0b 100644 --- a/oldstuff/Clean_up.yaml +++ b/oldstuff/Clean_up.yaml @@ -1,29 +1,28 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting playbook Clean-up_Task.yaml - -## Clean-up_Task -- name: Clean-up_Task - hosts: Note_install - gather_facts: false - tasks: - - block: - - include: tasks/Clean-up_Test.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: All done +--- +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting playbook Clean-up_Task.yaml + +## Clean-up_Task +- name: Clean-up_Task + hosts: Note_install + gather_facts: false + tasks: + - block: + - include: tasks/Clean-up_Test.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: All done diff --git a/oldstuff/Import-ax-modelstore.yaml b/oldstuff/Import-ax-modelstore.yaml index a0e158c..e5b29e3 100644 --- a/oldstuff/Import-ax-modelstore.yaml +++ b/oldstuff/Import-ax-modelstore.yaml @@ -1,29 +1,28 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting playbook install-axinstall-importmodel.yaml - -## install-axinstall-importmodel -- name: install-axinstall-importmodel - hosts: AOS_POM - gather_facts: false - tasks: - - block: - - include: tasks/install-axinstall-importmodel.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: All done +--- +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting playbook install-axinstall-importmodel.yaml + +## install-axinstall-importmodel +- name: install-axinstall-importmodel + hosts: AOS_POM + gather_facts: false + tasks: + - block: + - include: tasks/install-axinstall-importmodel.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: All done diff --git a/oldstuff/ansible-krb-install.yaml b/oldstuff/ansible-krb-install.yaml index 5d4e700..c5856e8 100644 --- a/oldstuff/ansible-krb-install.yaml +++ b/oldstuff/ansible-krb-install.yaml @@ -1,45 +1,45 @@ ---- -# playbooks/winrm_kerberos.yml -# @version v1.00_2020-DEC-20 -# @author Kevin Jeffery - -- name: Install WinRM Kerberos Dependencies - hosts: localhost - tasks: - - name: Start - debug: - msg: "{{ ansible_date_time.date }} {{ ansible_date_time.time }}" - - - name: Install Required Packages - RedHat/CentOS - vars: - ansible_python_interpreter: /usr/bin/python2 - yum: - name: - - gcc - - python-devel - - python3-devel - - krb5-devel - - krb5-libs - - krb5-workstation - state: latest - update_cache: yes - become: yes - when: (ansible_os_family == "RedHat" or ansible_os_family == "CentOS") and ansible_distribution_version is version('8.0', 'lt') - - - name: Install Required Packages - Debian/Ubuntu - apt: - name: - - python-dev - - python3-dev - - libkrb5-dev - - krb5-user - state: latest - update_cache: yes - become: yes - when: ansible_os_family == "Debian" - - - name: Install python winrm wrapper - pip: - name: "pywinrm[kerberos]" - state: latest - become: yes +--- +# playbooks/winrm_kerberos.yml +# @version v1.00_2020-DEC-20 +# @author Kevin Jeffery + +- name: Install WinRM Kerberos Dependencies + hosts: localhost + tasks: + - name: Start + debug: + msg: "{{ ansible_date_time.date }} {{ ansible_date_time.time }}" + + - name: Install Required Packages - RedHat/CentOS + vars: + ansible_python_interpreter: /usr/bin/python2 + yum: + name: + - gcc + - python-devel + - python3-devel + - krb5-devel + - krb5-libs + - krb5-workstation + state: latest + update_cache: true + become: true + when: (ansible_os_family == "RedHat" or ansible_os_family == "CentOS") and ansible_distribution_version is version('8.0', 'lt') + + - name: Install Required Packages - Debian/Ubuntu + apt: + name: + - python-dev + - python3-dev + - libkrb5-dev + - krb5-user + state: latest + update_cache: true + become: true + when: ansible_os_family == "Debian" + + - name: Install python winrm wrapper + pip: + name: pywinrm[kerberos] + state: latest + become: true diff --git a/oldstuff/install-Bo_and_Ax.yaml b/oldstuff/install-Bo_and_Ax.yaml index a9f833b..75649a7 100644 --- a/oldstuff/install-Bo_and_Ax.yaml +++ b/oldstuff/install-Bo_and_Ax.yaml @@ -1,77 +1,70 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - vars: - playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\u0000',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting {{ playbook_file }} - -## BOInstall -- name: Install BOInstall - hosts: BOInstall - gather_facts: false - tasks: - - block: - - include: tasks/install-boinstall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -## AxInstall -- name: Install AXInstall - hosts: AOS - gather_facts: false - tasks: - - block: - - include: tasks/install-axinstall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -## Post-installs - -# AXInstall example - -#- name: AXInstall Post-Installation tasks -# hosts: AOS_POM -# gather_facts: false -# tasks: -# - block: -# - include: tasks/install-axinstall-cilcompile.yaml -# rescue: -# - include: tasks/task-failed-slack.yaml - - -# BOInstall example - -#- name: Install PI46849_MDL -# hosts: MDL -# gather_facts: false -# tasks: -# - block: -# - include: tasks/install-PI46849_MDL.yaml -# rescue: -# - include: tasks/task-failed-slack.yaml - - -# PI46867_CWS_DBIFS_APP -# - Skip because default BOInstall is BOInstall_120.81.2.0_120-81-2-0.exe - -# PI46869_APP_API_BorisWeb -# - Skip because default BOInstall is BOInstall_120.81.2.0_120-81-2-0.exe - - - - -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: All done +--- +- name: Slack + hosts: localhost + gather_facts: false + vars: + playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\0',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting {{ playbook_file }} + +## BOInstall +- name: Install BOInstall + hosts: BOInstall + gather_facts: false + tasks: + - block: + - include: tasks/install-boinstall.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall +- name: Install AXInstall + hosts: AOS + gather_facts: false + tasks: + - block: + - include: tasks/install-axinstall.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## Post-installs + +# AXInstall example + +#- name: AXInstall Post-Installation tasks +# hosts: AOS_POM +# gather_facts: false +# tasks: +# - block: +# - include: tasks/install-axinstall-cilcompile.yaml +# rescue: +# - include: tasks/task-failed-slack.yaml + +# BOInstall example + +#- name: Install PI46849_MDL +# hosts: MDL +# gather_facts: false +# tasks: +# - block: +# - include: tasks/install-PI46849_MDL.yaml +# rescue: +# - include: tasks/task-failed-slack.yaml + +# PI46867_CWS_DBIFS_APP +# - Skip because default BOInstall is BOInstall_120.81.2.0_120-81-2-0.exe + +# PI46869_APP_API_BorisWeb +# - Skip because default BOInstall is BOInstall_120.81.2.0_120-81-2-0.exe + +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: All done diff --git a/oldstuff/install-axinstall-new.yaml b/oldstuff/install-axinstall-new.yaml index aca9c14..a7a3ad8 100644 --- a/oldstuff/install-axinstall-new.yaml +++ b/oldstuff/install-axinstall-new.yaml @@ -1,97 +1,97 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - vars: - playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\u0000',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting {{ playbook_file }} - -## AxInstall install-axinstall -- name: Install AXInstall - hosts: AOS - gather_facts: false - tags: [install_axinstall] - tasks: - - block: - - include: tasks/install-axinstall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -## AxInstall install-axinstall-importmodel -- name: install-axinstall-importmodel - hosts: AOS_POM - gather_facts: false - serial: 1 - tasks: - - block: - - include: tasks/install-axinstall-importmodel.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -## AxInstall install-axinstall-xppcompileall -- name: Install install-axinstall-xppcompileall - hosts: AOS_POM - gather_facts: false - serial: 1 - tasks: - - block: - - include: tasks/install-axinstall-xppcompileall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -## AxInstall install-axinstall-cilcompile -- name: Install install-axinstall-cilcompile - hosts: AOS_POM - gather_facts: false - serial: 1 - tasks: - - block: - - include: tasks/install-axinstall-cilcompile.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -## AxInstall install-axinstall-deployposttravelcardservices -- name: install-axinstall-deployposttravelcardservices - hosts: AOS_POM - gather_facts: false - serial: 1 - tasks: - - block: - - include: tasks/install-axinstall-deployposttravelcardservices.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -## AxInstall install-axinstall-TravelCardDeployTravelCardServices -- name: install-axinstall-TravelCardDeployTravelCardServices - hosts: AOS - gather_facts: false - serial: 1 - tasks: - - block: - - include: tasks/install-axinstall-TravelCardDeployTravelCardServices.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -## AxInstall install-axinstall-sqlreindex.yaml -- name: install-axinstall-sqlreindex.yaml - hosts: SQL - gather_facts: false - serial: 1 - tasks: - - block: - - include: tasks/install-axinstall-sqlreindex.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: AX install all done +--- +- name: Slack + hosts: localhost + gather_facts: false + vars: + playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\0',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting {{ playbook_file }} + +## AxInstall install-axinstall +- name: Install AXInstall + hosts: AOS + gather_facts: false + tags: [install_axinstall] + tasks: + - block: + - include: tasks/install-axinstall.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall install-axinstall-importmodel +- name: install-axinstall-importmodel + hosts: AOS_POM + gather_facts: false + serial: 1 + tasks: + - block: + - include: tasks/install-axinstall-importmodel.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall install-axinstall-xppcompileall +- name: Install install-axinstall-xppcompileall + hosts: AOS_POM + gather_facts: false + serial: 1 + tasks: + - block: + - include: tasks/install-axinstall-xppcompileall.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall install-axinstall-cilcompile +- name: Install install-axinstall-cilcompile + hosts: AOS_POM + gather_facts: false + serial: 1 + tasks: + - block: + - include: tasks/install-axinstall-cilcompile.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall install-axinstall-deployposttravelcardservices +- name: install-axinstall-deployposttravelcardservices + hosts: AOS_POM + gather_facts: false + serial: 1 + tasks: + - block: + - include: tasks/install-axinstall-deployposttravelcardservices.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall install-axinstall-TravelCardDeployTravelCardServices +- name: install-axinstall-TravelCardDeployTravelCardServices + hosts: AOS + gather_facts: false + serial: 1 + tasks: + - block: + - include: tasks/install-axinstall-TravelCardDeployTravelCardServices.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall install-axinstall-sqlreindex.yaml +- name: install-axinstall-sqlreindex.yaml + hosts: SQL + gather_facts: false + serial: 1 + tasks: + - block: + - include: tasks/install-axinstall-sqlreindex.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: AX install all done diff --git a/oldstuff/install-boinstall.yaml b/oldstuff/install-boinstall.yaml index 5053193..e3c932e 100644 --- a/oldstuff/install-boinstall.yaml +++ b/oldstuff/install-boinstall.yaml @@ -1,30 +1,30 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - vars: - playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\u0000',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting {{ playbook_file }} - -## BOInstall -- name: Install BOInstall - hosts: BOInstall - gather_facts: false - tasks: - - block: - - include: tasks/install-boinstall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: All done +--- +- name: Slack + hosts: localhost + gather_facts: false + vars: + playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\0',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting {{ playbook_file }} + +## BOInstall +- name: Install BOInstall + hosts: BOInstall + gather_facts: false + tasks: + - block: + - include: tasks/install-boinstall.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: All done diff --git a/oldstuff/install-boinstall_and_axinstall-new.yaml b/oldstuff/install-boinstall_and_axinstall-new.yaml index 619d585..cde43c0 100644 --- a/oldstuff/install-boinstall_and_axinstall-new.yaml +++ b/oldstuff/install-boinstall_and_axinstall-new.yaml @@ -1,108 +1,107 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - vars: - playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\u0000',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting {{ playbook_file }} - -## BOInstall -- name: Install BOInstall - hosts: BOInstall - gather_facts: false - tasks: - - block: - - include: tasks/install-boinstall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -## AxInstall install-axinstall -- name: Install AXInstall - hosts: AOS - gather_facts: false - tags: [install_axinstall] - tasks: - - block: - - include: tasks/install-axinstall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -## AxInstall install-axinstall-importmodel -- name: install-axinstall-importmodel - hosts: AOS_POM - gather_facts: false - serial: 1 - tasks: - - block: - - include: tasks/install-axinstall-importmodel.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -## AxInstall install-axinstall-xppcompileall -- name: Install install-axinstall-xppcompileall - hosts: AOS_POM - gather_facts: false - serial: 1 - tasks: - - block: - - include: tasks/install-axinstall-xppcompileall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -## AxInstall install-axinstall-cilcompile -- name: Install install-axinstall-cilcompile - hosts: AOS_POM - gather_facts: false - serial: 1 - tasks: - - block: - - include: tasks/install-axinstall-cilcompile.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -## AxInstall install-axinstall-deployposttravelcardservices -- name: install-axinstall-deployposttravelcardservices - hosts: AOS_POM - gather_facts: false - serial: 1 - tasks: - - block: - - include: tasks/install-axinstall-deployposttravelcardservices.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -## AxInstall install-axinstall-TravelCardDeployTravelCardServices -- name: install-axinstall-TravelCardDeployTravelCardServices - hosts: AOS - gather_facts: false - serial: 1 - tasks: - - block: - - include: tasks/install-axinstall-TravelCardDeployTravelCardServices.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -## AxInstall install-axinstall-sqlreindex.yaml -- name: install-axinstall-sqlreindex.yaml - hosts: SQL - gather_facts: false - serial: 1 - tasks: - - block: - - include: tasks/install-axinstall-sqlreindex.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: AX install all done +--- +- name: Slack + hosts: localhost + gather_facts: false + vars: + playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\0',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting {{ playbook_file }} + +## BOInstall +- name: Install BOInstall + hosts: BOInstall + gather_facts: false + tasks: + - block: + - include: tasks/install-boinstall.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall install-axinstall +- name: Install AXInstall + hosts: AOS + gather_facts: false + tags: [install_axinstall] + tasks: + - block: + - include: tasks/install-axinstall.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall install-axinstall-importmodel +- name: install-axinstall-importmodel + hosts: AOS_POM + gather_facts: false + serial: 1 + tasks: + - block: + - include: tasks/install-axinstall-importmodel.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall install-axinstall-xppcompileall +- name: Install install-axinstall-xppcompileall + hosts: AOS_POM + gather_facts: false + serial: 1 + tasks: + - block: + - include: tasks/install-axinstall-xppcompileall.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall install-axinstall-cilcompile +- name: Install install-axinstall-cilcompile + hosts: AOS_POM + gather_facts: false + serial: 1 + tasks: + - block: + - include: tasks/install-axinstall-cilcompile.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall install-axinstall-deployposttravelcardservices +- name: install-axinstall-deployposttravelcardservices + hosts: AOS_POM + gather_facts: false + serial: 1 + tasks: + - block: + - include: tasks/install-axinstall-deployposttravelcardservices.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall install-axinstall-TravelCardDeployTravelCardServices +- name: install-axinstall-TravelCardDeployTravelCardServices + hosts: AOS + gather_facts: false + serial: 1 + tasks: + - block: + - include: tasks/install-axinstall-TravelCardDeployTravelCardServices.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall install-axinstall-sqlreindex.yaml +- name: install-axinstall-sqlreindex.yaml + hosts: SQL + gather_facts: false + serial: 1 + tasks: + - block: + - include: tasks/install-axinstall-sqlreindex.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: AX install all done diff --git a/oldstuff/install-boinstall_and_axinstall.yaml b/oldstuff/install-boinstall_and_axinstall.yaml index a9f833b..75649a7 100644 --- a/oldstuff/install-boinstall_and_axinstall.yaml +++ b/oldstuff/install-boinstall_and_axinstall.yaml @@ -1,77 +1,70 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - vars: - playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\u0000',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting {{ playbook_file }} - -## BOInstall -- name: Install BOInstall - hosts: BOInstall - gather_facts: false - tasks: - - block: - - include: tasks/install-boinstall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -## AxInstall -- name: Install AXInstall - hosts: AOS - gather_facts: false - tasks: - - block: - - include: tasks/install-axinstall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -## Post-installs - -# AXInstall example - -#- name: AXInstall Post-Installation tasks -# hosts: AOS_POM -# gather_facts: false -# tasks: -# - block: -# - include: tasks/install-axinstall-cilcompile.yaml -# rescue: -# - include: tasks/task-failed-slack.yaml - - -# BOInstall example - -#- name: Install PI46849_MDL -# hosts: MDL -# gather_facts: false -# tasks: -# - block: -# - include: tasks/install-PI46849_MDL.yaml -# rescue: -# - include: tasks/task-failed-slack.yaml - - -# PI46867_CWS_DBIFS_APP -# - Skip because default BOInstall is BOInstall_120.81.2.0_120-81-2-0.exe - -# PI46869_APP_API_BorisWeb -# - Skip because default BOInstall is BOInstall_120.81.2.0_120-81-2-0.exe - - - - -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: All done +--- +- name: Slack + hosts: localhost + gather_facts: false + vars: + playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\0',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting {{ playbook_file }} + +## BOInstall +- name: Install BOInstall + hosts: BOInstall + gather_facts: false + tasks: + - block: + - include: tasks/install-boinstall.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall +- name: Install AXInstall + hosts: AOS + gather_facts: false + tasks: + - block: + - include: tasks/install-axinstall.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## Post-installs + +# AXInstall example + +#- name: AXInstall Post-Installation tasks +# hosts: AOS_POM +# gather_facts: false +# tasks: +# - block: +# - include: tasks/install-axinstall-cilcompile.yaml +# rescue: +# - include: tasks/task-failed-slack.yaml + +# BOInstall example + +#- name: Install PI46849_MDL +# hosts: MDL +# gather_facts: false +# tasks: +# - block: +# - include: tasks/install-PI46849_MDL.yaml +# rescue: +# - include: tasks/task-failed-slack.yaml + +# PI46867_CWS_DBIFS_APP +# - Skip because default BOInstall is BOInstall_120.81.2.0_120-81-2-0.exe + +# PI46869_APP_API_BorisWeb +# - Skip because default BOInstall is BOInstall_120.81.2.0_120-81-2-0.exe + +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: All done diff --git a/oldstuff/install-notepadplus.yaml b/oldstuff/install-notepadplus.yaml index 4fec8eb..1ec92aa 100644 --- a/oldstuff/install-notepadplus.yaml +++ b/oldstuff/install-notepadplus.yaml @@ -1,29 +1,28 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting playbook install_note.yaml - -## install note -- name: install_note - hosts: Note_install - gather_facts: false - tasks: - - block: - - include: tasks/install-notepadplus.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: All done +--- +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting playbook install_note.yaml + +## install note +- name: install_note + hosts: Note_install + gather_facts: false + tasks: + - block: + - include: tasks/install-notepadplus.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: All done diff --git a/oldstuff/old/OLD_run-ax-Cilcompile.yaml b/oldstuff/old/OLD_run-ax-Cilcompile.yaml index 698d2cc..ad1dd9c 100644 --- a/oldstuff/old/OLD_run-ax-Cilcompile.yaml +++ b/oldstuff/old/OLD_run-ax-Cilcompile.yaml @@ -1,29 +1,28 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting playbook install-axinstall-cilcompile.yaml - -## install-axinstall-cilcompile -- name: install-axinstall-cilcompile - hosts: AOS_POM - gather_facts: false - tasks: - - block: - - include: tasks/install-axinstall-cilcompile.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: All done +--- +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting playbook install-axinstall-cilcompile.yaml + +## install-axinstall-cilcompile +- name: install-axinstall-cilcompile + hosts: AOS_POM + gather_facts: false + tasks: + - block: + - include: tasks/install-axinstall-cilcompile.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: All done diff --git a/oldstuff/old/install-v12.0.yaml b/oldstuff/old/install-v12.0.yaml index a9f833b..75649a7 100644 --- a/oldstuff/old/install-v12.0.yaml +++ b/oldstuff/old/install-v12.0.yaml @@ -1,77 +1,70 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - vars: - playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\u0000',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting {{ playbook_file }} - -## BOInstall -- name: Install BOInstall - hosts: BOInstall - gather_facts: false - tasks: - - block: - - include: tasks/install-boinstall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -## AxInstall -- name: Install AXInstall - hosts: AOS - gather_facts: false - tasks: - - block: - - include: tasks/install-axinstall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -## Post-installs - -# AXInstall example - -#- name: AXInstall Post-Installation tasks -# hosts: AOS_POM -# gather_facts: false -# tasks: -# - block: -# - include: tasks/install-axinstall-cilcompile.yaml -# rescue: -# - include: tasks/task-failed-slack.yaml - - -# BOInstall example - -#- name: Install PI46849_MDL -# hosts: MDL -# gather_facts: false -# tasks: -# - block: -# - include: tasks/install-PI46849_MDL.yaml -# rescue: -# - include: tasks/task-failed-slack.yaml - - -# PI46867_CWS_DBIFS_APP -# - Skip because default BOInstall is BOInstall_120.81.2.0_120-81-2-0.exe - -# PI46869_APP_API_BorisWeb -# - Skip because default BOInstall is BOInstall_120.81.2.0_120-81-2-0.exe - - - - -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: All done +--- +- name: Slack + hosts: localhost + gather_facts: false + vars: + playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\0',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting {{ playbook_file }} + +## BOInstall +- name: Install BOInstall + hosts: BOInstall + gather_facts: false + tasks: + - block: + - include: tasks/install-boinstall.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall +- name: Install AXInstall + hosts: AOS + gather_facts: false + tasks: + - block: + - include: tasks/install-axinstall.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## Post-installs + +# AXInstall example + +#- name: AXInstall Post-Installation tasks +# hosts: AOS_POM +# gather_facts: false +# tasks: +# - block: +# - include: tasks/install-axinstall-cilcompile.yaml +# rescue: +# - include: tasks/task-failed-slack.yaml + +# BOInstall example + +#- name: Install PI46849_MDL +# hosts: MDL +# gather_facts: false +# tasks: +# - block: +# - include: tasks/install-PI46849_MDL.yaml +# rescue: +# - include: tasks/task-failed-slack.yaml + +# PI46867_CWS_DBIFS_APP +# - Skip because default BOInstall is BOInstall_120.81.2.0_120-81-2-0.exe + +# PI46869_APP_API_BorisWeb +# - Skip because default BOInstall is BOInstall_120.81.2.0_120-81-2-0.exe + +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: All done diff --git a/oldstuff/start-AX.yaml b/oldstuff/start-AX.yaml index a6733f0..b0477b4 100644 --- a/oldstuff/start-AX.yaml +++ b/oldstuff/start-AX.yaml @@ -1,29 +1,29 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - vars: - playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\u0000',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting {{ playbook_file }} - -- name: Start AOS - hosts: AOS - gather_facts: false - tasks: - - block: - - include: tasks/start-aos.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: All done \ No newline at end of file +--- +- name: Slack + hosts: localhost + gather_facts: false + vars: + playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\0',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting {{ playbook_file }} + +- name: Start AOS + hosts: AOS + gather_facts: false + tasks: + - block: + - include: tasks/start-aos.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: All done diff --git a/oldstuff/start.yaml b/oldstuff/start.yaml index b15ce58..294c769 100644 --- a/oldstuff/start.yaml +++ b/oldstuff/start.yaml @@ -1,84 +1,74 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - vars: - playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\u0000',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting {{ playbook_file }} - - -- name: Start AOS - hosts: AOS - gather_facts: false - tasks: - - block: - - include: tasks/start-aos.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - - -- name: Start BCM_CLUSTER - hosts: BCM_CLUSTER - gather_facts: false - tasks: - - block: - - include: tasks/start-ifsbo.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - - -- name: Start APP - hosts: APP - gather_facts: false - tasks: - - block: - - include: tasks/start-iis.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -- name: Start DPS, FAS, MDL, SPS, TCS - hosts: DPS, FAS, MDL, SPS, TCS - gather_facts: false - tasks: - - block: - - include: tasks/start-ifsbo.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -- name: Start WEB, API - hosts: WEB, API - gather_facts: false - tasks: - - block: - - include: tasks/start-iis.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -#- name: Start Nagios -# hosts: SMC -# tasks: -# - name: podman start nagios -# command: podman start nagios - -# - name: podman start n2a -# command: podman start n2a - - - -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: All done \ No newline at end of file +--- +- name: Slack + hosts: localhost + gather_facts: false + vars: + playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\0',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting {{ playbook_file }} + +- name: Start AOS + hosts: AOS + gather_facts: false + tasks: + - block: + - include: tasks/start-aos.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Start BCM_CLUSTER + hosts: BCM_CLUSTER + gather_facts: false + tasks: + - block: + - include: tasks/start-ifsbo.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Start APP + hosts: APP + gather_facts: false + tasks: + - block: + - include: tasks/start-iis.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Start DPS, FAS, MDL, SPS, TCS + hosts: DPS, FAS, MDL, SPS, TCS + gather_facts: false + tasks: + - block: + - include: tasks/start-ifsbo.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Start WEB, API + hosts: WEB, API + gather_facts: false + tasks: + - block: + - include: tasks/start-iis.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +#- name: Start Nagios +# hosts: SMC +# tasks: +# - name: podman start nagios +# command: podman start nagios + +# - name: podman start n2a +# command: podman start n2a + +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: All done diff --git a/oldstuff/stop-AX.yaml b/oldstuff/stop-AX.yaml index 4d1c4fe..23786c7 100644 --- a/oldstuff/stop-AX.yaml +++ b/oldstuff/stop-AX.yaml @@ -1,30 +1,29 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - vars: - playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\u0000',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting {{ playbook_file }} - -- name: Stop AOS - hosts: AOS - gather_facts: false - tasks: - - block: - - include: tasks/stop-aos.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: All done +--- +- name: Slack + hosts: localhost + gather_facts: false + vars: + playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\0',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting {{ playbook_file }} + +- name: Stop AOS + hosts: AOS + gather_facts: false + tasks: + - block: + - include: tasks/stop-aos.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: All done diff --git a/oldstuff/stop.yaml b/oldstuff/stop.yaml index ac3a03a..215c32d 100644 --- a/oldstuff/stop.yaml +++ b/oldstuff/stop.yaml @@ -1,81 +1,76 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - vars: - playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\u0000',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting {{ playbook_file }} - -#- name: Stop N2A -# hosts: SMC -# tasks: -# - name: podman stop n2a -# command: podman stop n2a - -# - name: podman stop nagios -# command: podman stop nagios - -- name: Stop WEB, API - hosts: WEB, API - gather_facts: false - tasks: - - block: - - include: tasks/stop-iis.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -- name: Stop DPS, FAS, MDL, SPS, TCS - hosts: DPS, FAS, MDL, SPS, TCS - gather_facts: false - tasks: - - block: - - include: tasks/stop-ifsbo.yaml - - include: tasks/reboot.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -- name: Stop APP - hosts: APP - gather_facts: false - tasks: - - block: - - include: tasks/stop-iis.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -- name: Stop BCM_CLUSTER - hosts: BCM_CLUSTER - gather_facts: false - tasks: - - block: - - include: tasks/stop-ifsbo.yaml - - include: tasks/reboot.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -- name: Stop AOS - hosts: AOS - gather_facts: false - tasks: - - block: - - include: tasks/stop-aos.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: All done +--- +- name: Slack + hosts: localhost + gather_facts: false + vars: + playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\0',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting {{ playbook_file }} + +#- name: Stop N2A +# hosts: SMC +# tasks: +# - name: podman stop n2a +# command: podman stop n2a + +# - name: podman stop nagios +# command: podman stop nagios + +- name: Stop WEB, API + hosts: WEB, API + gather_facts: false + tasks: + - block: + - include: tasks/stop-iis.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Stop DPS, FAS, MDL, SPS, TCS + hosts: DPS, FAS, MDL, SPS, TCS + gather_facts: false + tasks: + - block: + - include: tasks/stop-ifsbo.yaml + - include: tasks/reboot.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Stop APP + hosts: APP + gather_facts: false + tasks: + - block: + - include: tasks/stop-iis.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Stop BCM_CLUSTER + hosts: BCM_CLUSTER + gather_facts: false + tasks: + - block: + - include: tasks/stop-ifsbo.yaml + - include: tasks/reboot.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Stop AOS + hosts: AOS + gather_facts: false + tasks: + - block: + - include: tasks/stop-aos.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: All done diff --git a/oldstuff/tasks/Clean-up_Test.yaml b/oldstuff/tasks/Clean-up_Test.yaml index 515e2a3..4735711 100644 --- a/oldstuff/tasks/Clean-up_Test.yaml +++ b/oldstuff/tasks/Clean-up_Test.yaml @@ -1,21 +1,21 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Running Clean-up on {{ inventory_hostname }} - -- name: Running Clean-up Scripts - ansible.windows.win_powershell: - script: | - #Script to Clean-up - - #Creating Directory - New-Item -Path 'D:\software\Archive' -ItemType Directory - - $Users = 'ThalesAdmin','Installserveruser' - - #Moving files to path (ThalesAdmin,Installserveruser) - foreach ($user in $Users) { - Get-ChildItem -Exclude *.lnk -Path "C:\Users\$user\Desktop\" -Recurse | Move-Item -Verbose -Force -Destination "D:\software\Archive" - } \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Running Clean-up on {{ inventory_hostname }} + +- name: Running Clean-up Scripts + ansible.windows.win_powershell: + script: |- + #Script to Clean-up + + #Creating Directory + New-Item -Path 'D:\software\Archive' -ItemType Directory + + $Users = 'ThalesAdmin','Installserveruser' + + #Moving files to path (ThalesAdmin,Installserveruser) + foreach ($user in $Users) { + Get-ChildItem -Exclude *.lnk -Path "C:\Users\$user\Desktop\" -Recurse | Move-Item -Verbose -Force -Destination "D:\software\Archive" + } diff --git a/oldstuff/tasks/Postinstalls/install-PI43972_CWS.yaml b/oldstuff/tasks/Postinstalls/install-PI43972_CWS.yaml index 1f1dd2a..5178527 100644 --- a/oldstuff/tasks/Postinstalls/install-PI43972_CWS.yaml +++ b/oldstuff/tasks/Postinstalls/install-PI43972_CWS.yaml @@ -1,18 +1,18 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI43972 (CWS) on {{ inventory_hostname }} - -- name: Copy _BaseLayout.cshtml - win_copy: - src: ~/ansible/install/PostInstalls/PI43972_CWS/_BaseLayout.cshtml - dest: D:\IFSBOSystem\WebSite\CWS\Views\Shared\ - backup: yes - -- name: Copy Renew.cshtml - win_copy: - src: ~/ansible/install/PostInstalls/PI43972_CWS/Renew.cshtml - dest: D:\IFSBOSystem\WebSite\CWS\Views\SeasonPass\ - backup: yes +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI43972 (CWS) on {{ inventory_hostname }} + +- name: Copy _BaseLayout.cshtml + win_copy: + src: ~/ansible/install/PostInstalls/PI43972_CWS/_BaseLayout.cshtml + dest: D:\IFSBOSystem\WebSite\CWS\Views\Shared\ + backup: true + +- name: Copy Renew.cshtml + win_copy: + src: ~/ansible/install/PostInstalls/PI43972_CWS/Renew.cshtml + dest: D:\IFSBOSystem\WebSite\CWS\Views\SeasonPass\ + backup: true diff --git a/oldstuff/tasks/Postinstalls/install-PI43976_CWS.yaml b/oldstuff/tasks/Postinstalls/install-PI43976_CWS.yaml index cff3b5c..a044a80 100644 --- a/oldstuff/tasks/Postinstalls/install-PI43976_CWS.yaml +++ b/oldstuff/tasks/Postinstalls/install-PI43976_CWS.yaml @@ -1,18 +1,18 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI43976 (CWS) on {{ inventory_hostname }} - -- name: Copy ui-icons_444444_256x240.png - win_copy: - src: ~/ansible/install/PostInstalls/PI43976_CWSWEB/ui-icons_444444_256x240.png - dest: D:\IFSBOSystem\WebSite\CWS\App_Themes\CWS\images\ - backup: yes - -- name: Copy ui-icons_555555_256x240.png - win_copy: - src: ~/ansible/install/PostInstalls/PI43976_CWSWEB/ui-icons_555555_256x240.png - dest: D:\IFSBOSystem\WebSite\CWS\App_Themes\CWS\images\ - backup: yes \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI43976 (CWS) on {{ inventory_hostname }} + +- name: Copy ui-icons_444444_256x240.png + win_copy: + src: ~/ansible/install/PostInstalls/PI43976_CWSWEB/ui-icons_444444_256x240.png + dest: D:\IFSBOSystem\WebSite\CWS\App_Themes\CWS\images\ + backup: true + +- name: Copy ui-icons_555555_256x240.png + win_copy: + src: ~/ansible/install/PostInstalls/PI43976_CWSWEB/ui-icons_555555_256x240.png + dest: D:\IFSBOSystem\WebSite\CWS\App_Themes\CWS\images\ + backup: true diff --git a/oldstuff/tasks/Postinstalls/install-PI43980_CWS.yaml b/oldstuff/tasks/Postinstalls/install-PI43980_CWS.yaml index f6e3e96..aedbb84 100644 --- a/oldstuff/tasks/Postinstalls/install-PI43980_CWS.yaml +++ b/oldstuff/tasks/Postinstalls/install-PI43980_CWS.yaml @@ -1,12 +1,12 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI43980 (CWS) on {{ inventory_hostname }} - -- name: Copy CWSDictionary.xml - win_copy: - src: ~/ansible/install/PostInstalls/PI43980_DBIFS_CWSWEB/CWSDictionary.xml - dest: D:\IFSBOSystem\WebSite\CWS\App_Data\CWSDictionary.xml - backup: yes +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI43980 (CWS) on {{ inventory_hostname }} + +- name: Copy CWSDictionary.xml + win_copy: + src: ~/ansible/install/PostInstalls/PI43980_DBIFS_CWSWEB/CWSDictionary.xml + dest: D:\IFSBOSystem\WebSite\CWS\App_Data\CWSDictionary.xml + backup: true diff --git a/oldstuff/tasks/Postinstalls/install-PI43981_CWS.yaml b/oldstuff/tasks/Postinstalls/install-PI43981_CWS.yaml index 67e8b47..cc407dd 100644 --- a/oldstuff/tasks/Postinstalls/install-PI43981_CWS.yaml +++ b/oldstuff/tasks/Postinstalls/install-PI43981_CWS.yaml @@ -1,12 +1,12 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI43981 (CWS) on {{ inventory_hostname }} - -- name: Copy CWS.dll - win_copy: - src: ~/ansible/install/PostInstalls/PI43981_CWSWEB/CWS.dll - dest: D:\IFSBOSystem\WebSite\CWS\bin\ - backup: yes \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI43981 (CWS) on {{ inventory_hostname }} + +- name: Copy CWS.dll + win_copy: + src: ~/ansible/install/PostInstalls/PI43981_CWSWEB/CWS.dll + dest: D:\IFSBOSystem\WebSite\CWS\bin\ + backup: true diff --git a/oldstuff/tasks/Postinstalls/install-PI46769_CWS.yaml b/oldstuff/tasks/Postinstalls/install-PI46769_CWS.yaml index e016b14..ef3e9bd 100644 --- a/oldstuff/tasks/Postinstalls/install-PI46769_CWS.yaml +++ b/oldstuff/tasks/Postinstalls/install-PI46769_CWS.yaml @@ -1,12 +1,12 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI46769 (CWS) on {{ inventory_hostname }} - -- name: Copy CWS.dll - win_copy: - src: ~/ansible/install/PostInstalls/PI46769_CWSWEB/CWS.dll - dest: D:\IFSBOSystem\WebSite\CWS\bin\ - backup: yes \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI46769 (CWS) on {{ inventory_hostname }} + +- name: Copy CWS.dll + win_copy: + src: ~/ansible/install/PostInstalls/PI46769_CWSWEB/CWS.dll + dest: D:\IFSBOSystem\WebSite\CWS\bin\ + backup: true diff --git a/oldstuff/tasks/Postinstalls/install-PI46777_CWS.yaml b/oldstuff/tasks/Postinstalls/install-PI46777_CWS.yaml index 5b2066d..ff87bb9 100644 --- a/oldstuff/tasks/Postinstalls/install-PI46777_CWS.yaml +++ b/oldstuff/tasks/Postinstalls/install-PI46777_CWS.yaml @@ -1,12 +1,12 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI46777 (CWS) on {{ inventory_hostname }} - -- name: Copy MyInformation.cshtml - win_copy: - src: ~/ansible/install/PostInstalls/PI46777_CWSWEB/MyInformation.cshtml - dest: D:\IFSBOSystem\WebSite\CWS\Views\CustomerManagement\MyInformation.cshtml - backup: yes +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI46777 (CWS) on {{ inventory_hostname }} + +- name: Copy MyInformation.cshtml + win_copy: + src: ~/ansible/install/PostInstalls/PI46777_CWSWEB/MyInformation.cshtml + dest: D:\IFSBOSystem\WebSite\CWS\Views\CustomerManagement\MyInformation.cshtml + backup: true diff --git a/oldstuff/tasks/Postinstalls/install-PI46792_MDL.yaml b/oldstuff/tasks/Postinstalls/install-PI46792_MDL.yaml index 60c73f6..8257fbf 100644 --- a/oldstuff/tasks/Postinstalls/install-PI46792_MDL.yaml +++ b/oldstuff/tasks/Postinstalls/install-PI46792_MDL.yaml @@ -1,21 +1,21 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI46792 (MDL) on {{ inventory_hostname }} - -- name: Copy DCP_CMNDeEncoder_P.dll - win_copy: - src: ~/ansible/install/PostInstalls/PI46792_MDL/DCP_CMNDeEncoder_P.dll - dest: D:\IFSBOSystem\bin\DCP_CMNDeEncoder_P.dll - backup: yes - -- name: Copy Register_DCP_CMNDeEncoder_P_FileProcessor.bat - win_copy: - src: ~/ansible/install/PostInstalls/PI46792_MDL/Register_DCP_CMNDeEncoder_P_FileProcessor.bat - dest: D:\IFSBOSystem\bin\Register_DCP_CMNDeEncoder_P_FileProcessor.bat - backup: yes - -- name: Register dll - win_command: D:\IFSBOSystem\bin\Register_DCP_CMNDeEncoder_P_FileProcessor.bat \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI46792 (MDL) on {{ inventory_hostname }} + +- name: Copy DCP_CMNDeEncoder_P.dll + win_copy: + src: ~/ansible/install/PostInstalls/PI46792_MDL/DCP_CMNDeEncoder_P.dll + dest: D:\IFSBOSystem\bin\DCP_CMNDeEncoder_P.dll + backup: true + +- name: Copy Register_DCP_CMNDeEncoder_P_FileProcessor.bat + win_copy: + src: ~/ansible/install/PostInstalls/PI46792_MDL/Register_DCP_CMNDeEncoder_P_FileProcessor.bat + dest: D:\IFSBOSystem\bin\Register_DCP_CMNDeEncoder_P_FileProcessor.bat + backup: true + +- name: Register dll + win_command: D:\IFSBOSystem\bin\Register_DCP_CMNDeEncoder_P_FileProcessor.bat diff --git a/oldstuff/tasks/Postinstalls/install-PI46810_BORIS.yaml b/oldstuff/tasks/Postinstalls/install-PI46810_BORIS.yaml index 0faa4df..30d0a46 100644 --- a/oldstuff/tasks/Postinstalls/install-PI46810_BORIS.yaml +++ b/oldstuff/tasks/Postinstalls/install-PI46810_BORIS.yaml @@ -1,11 +1,11 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI46810 (BORIS) on {{ inventory_hostname }} -- name: Copy BorisDictionary.xml - win_copy: - src: ~/ansible/install/PostInstalls/PI46810_DBIFS_CWSWEB_BORISWEB/BorisDictionary.xml - dest: D:\IFSBOSystem\WebSite\Boris\App_Data\BorisDictionary.xml - backup: yes \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI46810 (BORIS) on {{ inventory_hostname }} +- name: Copy BorisDictionary.xml + win_copy: + src: ~/ansible/install/PostInstalls/PI46810_DBIFS_CWSWEB_BORISWEB/BorisDictionary.xml + dest: D:\IFSBOSystem\WebSite\Boris\App_Data\BorisDictionary.xml + backup: true diff --git a/oldstuff/tasks/Postinstalls/install-PI46810_CWS.yaml b/oldstuff/tasks/Postinstalls/install-PI46810_CWS.yaml index 3dc4eee..18dde9d 100644 --- a/oldstuff/tasks/Postinstalls/install-PI46810_CWS.yaml +++ b/oldstuff/tasks/Postinstalls/install-PI46810_CWS.yaml @@ -1,11 +1,11 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI46810 (CWS) on {{ inventory_hostname }} -- name: Copy CWSDictionary.xml - win_copy: - src: ~/ansible/install/PostInstalls/PI46810_DBIFS_CWSWEB_BORISWEB/CWSDictionary.xml - dest: D:\IFSBOSystem\WebSite\CWS\App_Data\CWSDictionary.xml - backup: yes \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI46810 (CWS) on {{ inventory_hostname }} +- name: Copy CWSDictionary.xml + win_copy: + src: ~/ansible/install/PostInstalls/PI46810_DBIFS_CWSWEB_BORISWEB/CWSDictionary.xml + dest: D:\IFSBOSystem\WebSite\CWS\App_Data\CWSDictionary.xml + backup: true diff --git a/oldstuff/tasks/Postinstalls/install-PI46838.yaml b/oldstuff/tasks/Postinstalls/install-PI46838.yaml index 01bbd72..15ef645 100644 --- a/oldstuff/tasks/Postinstalls/install-PI46838.yaml +++ b/oldstuff/tasks/Postinstalls/install-PI46838.yaml @@ -1,50 +1,48 @@ ---- -- 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: auto - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting Xpo import PI46838 {{ inventory_hostname }} - -- name: Run Ax32.exe CIL compile - ansible.windows.win_powershell: - script: | - iex "cmd /c 'D:\Program Files (x86)\Microsoft Dynamics AX\60\Client\bin\Ax32.exe' -aotImportFile=D:\software\PI46838_AXPOM_REP\PI46838.xpo" - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting CIL compile on {{ inventory_hostname }} - -- name: Run Ax32.exe CIL compile - ansible.windows.win_powershell: - script: | - iex "cmd /c 'D:\Program Files (x86)\Microsoft Dynamics AX\60\Client\bin\Ax32.exe' -startupcmd=CompileIL" - - -- 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: auto +--- +- 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: auto + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting Xpo import PI46838 {{ inventory_hostname }} + +- name: Run Ax32.exe CIL compile + ansible.windows.win_powershell: + script: | + iex "cmd /c 'D:\Program Files (x86)\Microsoft Dynamics AX\60\Client\bin\Ax32.exe' -aotImportFile=D:\software\PI46838_AXPOM_REP\PI46838.xpo" + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting CIL compile on {{ inventory_hostname }} + +- name: Run Ax32.exe CIL compile + ansible.windows.win_powershell: + script: | + iex "cmd /c 'D:\Program Files (x86)\Microsoft Dynamics AX\60\Client\bin\Ax32.exe' -startupcmd=CompileIL" + + +- 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: auto diff --git a/oldstuff/tasks/Postinstalls/install-PI46849_MDL.yaml b/oldstuff/tasks/Postinstalls/install-PI46849_MDL.yaml index 3aa11c8..453aa99 100644 --- a/oldstuff/tasks/Postinstalls/install-PI46849_MDL.yaml +++ b/oldstuff/tasks/Postinstalls/install-PI46849_MDL.yaml @@ -1,19 +1,17 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI46849_MDL on {{ inventory_hostname }} - - -- name: Stop Housekeeping Agent - ansible.windows.win_service: - name: IFSHouseKeepingAgent - state: stopped - - -- name: Copy IFS.HouseKeeping.Agent.exe - win_copy: - src: ~/ansible/install/PostInstalls/PI46849_MDL/IFS.HouseKeeping.Agent.exe - dest: D:\IFSBOSystem\bin\IFS.HouseKeeping.Agent.exe - backup: yes +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI46849_MDL on {{ inventory_hostname }} + +- name: Stop Housekeeping Agent + ansible.windows.win_service: + name: IFSHouseKeepingAgent + state: stopped + +- name: Copy IFS.HouseKeeping.Agent.exe + win_copy: + src: ~/ansible/install/PostInstalls/PI46849_MDL/IFS.HouseKeeping.Agent.exe + dest: D:\IFSBOSystem\bin\IFS.HouseKeeping.Agent.exe + backup: true diff --git a/oldstuff/tasks/Postinstalls/v.12/install-PI43972_CWS.yaml b/oldstuff/tasks/Postinstalls/v.12/install-PI43972_CWS.yaml index 1f1dd2a..5178527 100644 --- a/oldstuff/tasks/Postinstalls/v.12/install-PI43972_CWS.yaml +++ b/oldstuff/tasks/Postinstalls/v.12/install-PI43972_CWS.yaml @@ -1,18 +1,18 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI43972 (CWS) on {{ inventory_hostname }} - -- name: Copy _BaseLayout.cshtml - win_copy: - src: ~/ansible/install/PostInstalls/PI43972_CWS/_BaseLayout.cshtml - dest: D:\IFSBOSystem\WebSite\CWS\Views\Shared\ - backup: yes - -- name: Copy Renew.cshtml - win_copy: - src: ~/ansible/install/PostInstalls/PI43972_CWS/Renew.cshtml - dest: D:\IFSBOSystem\WebSite\CWS\Views\SeasonPass\ - backup: yes +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI43972 (CWS) on {{ inventory_hostname }} + +- name: Copy _BaseLayout.cshtml + win_copy: + src: ~/ansible/install/PostInstalls/PI43972_CWS/_BaseLayout.cshtml + dest: D:\IFSBOSystem\WebSite\CWS\Views\Shared\ + backup: true + +- name: Copy Renew.cshtml + win_copy: + src: ~/ansible/install/PostInstalls/PI43972_CWS/Renew.cshtml + dest: D:\IFSBOSystem\WebSite\CWS\Views\SeasonPass\ + backup: true diff --git a/oldstuff/tasks/Postinstalls/v.12/install-PI43976_CWS.yaml b/oldstuff/tasks/Postinstalls/v.12/install-PI43976_CWS.yaml index cff3b5c..a044a80 100644 --- a/oldstuff/tasks/Postinstalls/v.12/install-PI43976_CWS.yaml +++ b/oldstuff/tasks/Postinstalls/v.12/install-PI43976_CWS.yaml @@ -1,18 +1,18 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI43976 (CWS) on {{ inventory_hostname }} - -- name: Copy ui-icons_444444_256x240.png - win_copy: - src: ~/ansible/install/PostInstalls/PI43976_CWSWEB/ui-icons_444444_256x240.png - dest: D:\IFSBOSystem\WebSite\CWS\App_Themes\CWS\images\ - backup: yes - -- name: Copy ui-icons_555555_256x240.png - win_copy: - src: ~/ansible/install/PostInstalls/PI43976_CWSWEB/ui-icons_555555_256x240.png - dest: D:\IFSBOSystem\WebSite\CWS\App_Themes\CWS\images\ - backup: yes \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI43976 (CWS) on {{ inventory_hostname }} + +- name: Copy ui-icons_444444_256x240.png + win_copy: + src: ~/ansible/install/PostInstalls/PI43976_CWSWEB/ui-icons_444444_256x240.png + dest: D:\IFSBOSystem\WebSite\CWS\App_Themes\CWS\images\ + backup: true + +- name: Copy ui-icons_555555_256x240.png + win_copy: + src: ~/ansible/install/PostInstalls/PI43976_CWSWEB/ui-icons_555555_256x240.png + dest: D:\IFSBOSystem\WebSite\CWS\App_Themes\CWS\images\ + backup: true diff --git a/oldstuff/tasks/Postinstalls/v.12/install-PI43980_CWS.yaml b/oldstuff/tasks/Postinstalls/v.12/install-PI43980_CWS.yaml index f6e3e96..aedbb84 100644 --- a/oldstuff/tasks/Postinstalls/v.12/install-PI43980_CWS.yaml +++ b/oldstuff/tasks/Postinstalls/v.12/install-PI43980_CWS.yaml @@ -1,12 +1,12 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI43980 (CWS) on {{ inventory_hostname }} - -- name: Copy CWSDictionary.xml - win_copy: - src: ~/ansible/install/PostInstalls/PI43980_DBIFS_CWSWEB/CWSDictionary.xml - dest: D:\IFSBOSystem\WebSite\CWS\App_Data\CWSDictionary.xml - backup: yes +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI43980 (CWS) on {{ inventory_hostname }} + +- name: Copy CWSDictionary.xml + win_copy: + src: ~/ansible/install/PostInstalls/PI43980_DBIFS_CWSWEB/CWSDictionary.xml + dest: D:\IFSBOSystem\WebSite\CWS\App_Data\CWSDictionary.xml + backup: true diff --git a/oldstuff/tasks/Postinstalls/v.12/install-PI43981_CWS.yaml b/oldstuff/tasks/Postinstalls/v.12/install-PI43981_CWS.yaml index 67e8b47..cc407dd 100644 --- a/oldstuff/tasks/Postinstalls/v.12/install-PI43981_CWS.yaml +++ b/oldstuff/tasks/Postinstalls/v.12/install-PI43981_CWS.yaml @@ -1,12 +1,12 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI43981 (CWS) on {{ inventory_hostname }} - -- name: Copy CWS.dll - win_copy: - src: ~/ansible/install/PostInstalls/PI43981_CWSWEB/CWS.dll - dest: D:\IFSBOSystem\WebSite\CWS\bin\ - backup: yes \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI43981 (CWS) on {{ inventory_hostname }} + +- name: Copy CWS.dll + win_copy: + src: ~/ansible/install/PostInstalls/PI43981_CWSWEB/CWS.dll + dest: D:\IFSBOSystem\WebSite\CWS\bin\ + backup: true diff --git a/oldstuff/tasks/Postinstalls/v.12/install-PI46769_CWS.yaml b/oldstuff/tasks/Postinstalls/v.12/install-PI46769_CWS.yaml index e016b14..ef3e9bd 100644 --- a/oldstuff/tasks/Postinstalls/v.12/install-PI46769_CWS.yaml +++ b/oldstuff/tasks/Postinstalls/v.12/install-PI46769_CWS.yaml @@ -1,12 +1,12 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI46769 (CWS) on {{ inventory_hostname }} - -- name: Copy CWS.dll - win_copy: - src: ~/ansible/install/PostInstalls/PI46769_CWSWEB/CWS.dll - dest: D:\IFSBOSystem\WebSite\CWS\bin\ - backup: yes \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI46769 (CWS) on {{ inventory_hostname }} + +- name: Copy CWS.dll + win_copy: + src: ~/ansible/install/PostInstalls/PI46769_CWSWEB/CWS.dll + dest: D:\IFSBOSystem\WebSite\CWS\bin\ + backup: true diff --git a/oldstuff/tasks/Postinstalls/v.12/install-PI46777_CWS.yaml b/oldstuff/tasks/Postinstalls/v.12/install-PI46777_CWS.yaml index 5b2066d..ff87bb9 100644 --- a/oldstuff/tasks/Postinstalls/v.12/install-PI46777_CWS.yaml +++ b/oldstuff/tasks/Postinstalls/v.12/install-PI46777_CWS.yaml @@ -1,12 +1,12 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI46777 (CWS) on {{ inventory_hostname }} - -- name: Copy MyInformation.cshtml - win_copy: - src: ~/ansible/install/PostInstalls/PI46777_CWSWEB/MyInformation.cshtml - dest: D:\IFSBOSystem\WebSite\CWS\Views\CustomerManagement\MyInformation.cshtml - backup: yes +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI46777 (CWS) on {{ inventory_hostname }} + +- name: Copy MyInformation.cshtml + win_copy: + src: ~/ansible/install/PostInstalls/PI46777_CWSWEB/MyInformation.cshtml + dest: D:\IFSBOSystem\WebSite\CWS\Views\CustomerManagement\MyInformation.cshtml + backup: true diff --git a/oldstuff/tasks/Postinstalls/v.12/install-PI46792_MDL.yaml b/oldstuff/tasks/Postinstalls/v.12/install-PI46792_MDL.yaml index 60c73f6..8257fbf 100644 --- a/oldstuff/tasks/Postinstalls/v.12/install-PI46792_MDL.yaml +++ b/oldstuff/tasks/Postinstalls/v.12/install-PI46792_MDL.yaml @@ -1,21 +1,21 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI46792 (MDL) on {{ inventory_hostname }} - -- name: Copy DCP_CMNDeEncoder_P.dll - win_copy: - src: ~/ansible/install/PostInstalls/PI46792_MDL/DCP_CMNDeEncoder_P.dll - dest: D:\IFSBOSystem\bin\DCP_CMNDeEncoder_P.dll - backup: yes - -- name: Copy Register_DCP_CMNDeEncoder_P_FileProcessor.bat - win_copy: - src: ~/ansible/install/PostInstalls/PI46792_MDL/Register_DCP_CMNDeEncoder_P_FileProcessor.bat - dest: D:\IFSBOSystem\bin\Register_DCP_CMNDeEncoder_P_FileProcessor.bat - backup: yes - -- name: Register dll - win_command: D:\IFSBOSystem\bin\Register_DCP_CMNDeEncoder_P_FileProcessor.bat \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI46792 (MDL) on {{ inventory_hostname }} + +- name: Copy DCP_CMNDeEncoder_P.dll + win_copy: + src: ~/ansible/install/PostInstalls/PI46792_MDL/DCP_CMNDeEncoder_P.dll + dest: D:\IFSBOSystem\bin\DCP_CMNDeEncoder_P.dll + backup: true + +- name: Copy Register_DCP_CMNDeEncoder_P_FileProcessor.bat + win_copy: + src: ~/ansible/install/PostInstalls/PI46792_MDL/Register_DCP_CMNDeEncoder_P_FileProcessor.bat + dest: D:\IFSBOSystem\bin\Register_DCP_CMNDeEncoder_P_FileProcessor.bat + backup: true + +- name: Register dll + win_command: D:\IFSBOSystem\bin\Register_DCP_CMNDeEncoder_P_FileProcessor.bat diff --git a/oldstuff/tasks/Postinstalls/v.12/install-PI46810_BORIS.yaml b/oldstuff/tasks/Postinstalls/v.12/install-PI46810_BORIS.yaml index 0faa4df..30d0a46 100644 --- a/oldstuff/tasks/Postinstalls/v.12/install-PI46810_BORIS.yaml +++ b/oldstuff/tasks/Postinstalls/v.12/install-PI46810_BORIS.yaml @@ -1,11 +1,11 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI46810 (BORIS) on {{ inventory_hostname }} -- name: Copy BorisDictionary.xml - win_copy: - src: ~/ansible/install/PostInstalls/PI46810_DBIFS_CWSWEB_BORISWEB/BorisDictionary.xml - dest: D:\IFSBOSystem\WebSite\Boris\App_Data\BorisDictionary.xml - backup: yes \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI46810 (BORIS) on {{ inventory_hostname }} +- name: Copy BorisDictionary.xml + win_copy: + src: ~/ansible/install/PostInstalls/PI46810_DBIFS_CWSWEB_BORISWEB/BorisDictionary.xml + dest: D:\IFSBOSystem\WebSite\Boris\App_Data\BorisDictionary.xml + backup: true diff --git a/oldstuff/tasks/Postinstalls/v.12/install-PI46810_CWS.yaml b/oldstuff/tasks/Postinstalls/v.12/install-PI46810_CWS.yaml index 3dc4eee..18dde9d 100644 --- a/oldstuff/tasks/Postinstalls/v.12/install-PI46810_CWS.yaml +++ b/oldstuff/tasks/Postinstalls/v.12/install-PI46810_CWS.yaml @@ -1,11 +1,11 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI46810 (CWS) on {{ inventory_hostname }} -- name: Copy CWSDictionary.xml - win_copy: - src: ~/ansible/install/PostInstalls/PI46810_DBIFS_CWSWEB_BORISWEB/CWSDictionary.xml - dest: D:\IFSBOSystem\WebSite\CWS\App_Data\CWSDictionary.xml - backup: yes \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI46810 (CWS) on {{ inventory_hostname }} +- name: Copy CWSDictionary.xml + win_copy: + src: ~/ansible/install/PostInstalls/PI46810_DBIFS_CWSWEB_BORISWEB/CWSDictionary.xml + dest: D:\IFSBOSystem\WebSite\CWS\App_Data\CWSDictionary.xml + backup: true diff --git a/oldstuff/tasks/Postinstalls/v.12/install-PI46838.yaml b/oldstuff/tasks/Postinstalls/v.12/install-PI46838.yaml index 01bbd72..15ef645 100644 --- a/oldstuff/tasks/Postinstalls/v.12/install-PI46838.yaml +++ b/oldstuff/tasks/Postinstalls/v.12/install-PI46838.yaml @@ -1,50 +1,48 @@ ---- -- 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: auto - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting Xpo import PI46838 {{ inventory_hostname }} - -- name: Run Ax32.exe CIL compile - ansible.windows.win_powershell: - script: | - iex "cmd /c 'D:\Program Files (x86)\Microsoft Dynamics AX\60\Client\bin\Ax32.exe' -aotImportFile=D:\software\PI46838_AXPOM_REP\PI46838.xpo" - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting CIL compile on {{ inventory_hostname }} - -- name: Run Ax32.exe CIL compile - ansible.windows.win_powershell: - script: | - iex "cmd /c 'D:\Program Files (x86)\Microsoft Dynamics AX\60\Client\bin\Ax32.exe' -startupcmd=CompileIL" - - -- 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: auto +--- +- 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: auto + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting Xpo import PI46838 {{ inventory_hostname }} + +- name: Run Ax32.exe CIL compile + ansible.windows.win_powershell: + script: | + iex "cmd /c 'D:\Program Files (x86)\Microsoft Dynamics AX\60\Client\bin\Ax32.exe' -aotImportFile=D:\software\PI46838_AXPOM_REP\PI46838.xpo" + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting CIL compile on {{ inventory_hostname }} + +- name: Run Ax32.exe CIL compile + ansible.windows.win_powershell: + script: | + iex "cmd /c 'D:\Program Files (x86)\Microsoft Dynamics AX\60\Client\bin\Ax32.exe' -startupcmd=CompileIL" + + +- 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: auto diff --git a/oldstuff/tasks/Postinstalls/v.12/install-PI46849_MDL.yaml b/oldstuff/tasks/Postinstalls/v.12/install-PI46849_MDL.yaml index 3aa11c8..453aa99 100644 --- a/oldstuff/tasks/Postinstalls/v.12/install-PI46849_MDL.yaml +++ b/oldstuff/tasks/Postinstalls/v.12/install-PI46849_MDL.yaml @@ -1,19 +1,17 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing PI46849_MDL on {{ inventory_hostname }} - - -- name: Stop Housekeeping Agent - ansible.windows.win_service: - name: IFSHouseKeepingAgent - state: stopped - - -- name: Copy IFS.HouseKeeping.Agent.exe - win_copy: - src: ~/ansible/install/PostInstalls/PI46849_MDL/IFS.HouseKeeping.Agent.exe - dest: D:\IFSBOSystem\bin\IFS.HouseKeeping.Agent.exe - backup: yes +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing PI46849_MDL on {{ inventory_hostname }} + +- name: Stop Housekeeping Agent + ansible.windows.win_service: + name: IFSHouseKeepingAgent + state: stopped + +- name: Copy IFS.HouseKeeping.Agent.exe + win_copy: + src: ~/ansible/install/PostInstalls/PI46849_MDL/IFS.HouseKeeping.Agent.exe + dest: D:\IFSBOSystem\bin\IFS.HouseKeeping.Agent.exe + backup: true diff --git a/oldstuff/tasks/Postinstalls/v.12/install-axinstall-v12.0-TestA.yaml b/oldstuff/tasks/Postinstalls/v.12/install-axinstall-v12.0-TestA.yaml index df8f0da..16f0130 100644 --- a/oldstuff/tasks/Postinstalls/v.12/install-axinstall-v12.0-TestA.yaml +++ b/oldstuff/tasks/Postinstalls/v.12/install-axinstall-v12.0-TestA.yaml @@ -1,81 +1,70 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Copying AXInstall files to {{ inventory_hostname }} - -- name: Prepare install target - ansible.windows.win_file: - path: D:\AXInstall - state: directory - -- name: Copy {{AXInstall}} - win_copy: - src: ~/ansible/install/{{AXInstall}} - dest: D:\AXInstall\{{AXInstall}} - -- name: Copy Config - win_copy: - src: ~/ansible/install/config/v12.0/rejtesta.local/{{ inventory_hostname.split('.')[0]|upper }}/ - dest: D:\AXInstall\Config - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting AXInstall on {{ inventory_hostname }} - -- name: Run {{AXInstall}} - ansible.windows.win_powershell: - script: | - iex "cmd /c D:\AXInstall\{{AXInstall}} /PlatFormFilesPath=D:\AXInstall\Config /ForceReboot=False /S" - Start-Sleep -Seconds 30 - Get-Process AXInstall | Wait-Process - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Checking final errorstatus 0 on {{ inventory_hostname }} - -- name: Final errorstatus - ansible.windows.win_powershell: - script: | - $newestLog = Get-Item D:\IFSAXSystem\InstallLog\AXInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 - $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' - if($result.Matches[0].Groups[1].Value -ne 0) { - $Ansible.Failed = $true - } - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Rebooting {{ inventory_hostname }} - -- name: Reboot - win_reboot: - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Cleaning up AXInstall files on {{ inventory_hostname }} - -- name: Clean up - ansible.windows.win_file: - path: D:\AXInstall - state: absent \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Copying AXInstall files to {{ inventory_hostname }} + +- name: Prepare install target + ansible.windows.win_file: + path: D:\AXInstall + state: directory + +- name: Copy {{AXInstall}} + win_copy: + src: ~/ansible/install/{{AXInstall}} + dest: D:\AXInstall\{{AXInstall}} + +- name: Copy Config + win_copy: + src: ~/ansible/install/config/v12.0/rejtesta.local/{{ inventory_hostname.split('.')[0]|upper }}/ + dest: D:\AXInstall\Config + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting AXInstall on {{ inventory_hostname }} + +- name: Run {{AXInstall}} + ansible.windows.win_powershell: + script: | + iex "cmd /c D:\AXInstall\{{AXInstall}} /PlatFormFilesPath=D:\AXInstall\Config /ForceReboot=False /S" + Start-Sleep -Seconds 30 + Get-Process AXInstall | Wait-Process + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Checking final errorstatus 0 on {{ inventory_hostname }} + +- name: Final errorstatus + ansible.windows.win_powershell: + script: | + $newestLog = Get-Item D:\IFSAXSystem\InstallLog\AXInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 + $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' + if($result.Matches[0].Groups[1].Value -ne 0) { + $Ansible.Failed = $true + } + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Rebooting {{ inventory_hostname }} + +- name: Reboot + win_reboot: +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Cleaning up AXInstall files on {{ inventory_hostname }} + +- name: Clean up + ansible.windows.win_file: + path: D:\AXInstall + state: absent diff --git a/oldstuff/tasks/Postinstalls/v.12/install-axinstall-v12.0-TestC.yaml b/oldstuff/tasks/Postinstalls/v.12/install-axinstall-v12.0-TestC.yaml index e2f35e4..39ff6ef 100644 --- a/oldstuff/tasks/Postinstalls/v.12/install-axinstall-v12.0-TestC.yaml +++ b/oldstuff/tasks/Postinstalls/v.12/install-axinstall-v12.0-TestC.yaml @@ -1,81 +1,70 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Copying AXInstall files to {{ inventory_hostname }} - -- name: Prepare install target - ansible.windows.win_file: - path: D:\AXInstall - state: directory - -- name: Copy {{AXInstall}} - win_copy: - src: ~/ansible/install/{{AXInstall}} - dest: D:\AXInstall\{{AXInstall}} - -- name: Copy Config - win_copy: - src: ~/ansible/install/config/v12.0/rejtestc.local/{{ inventory_hostname.split('.')[0]|upper }}/ - dest: D:\AXInstall\Config - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting AXInstall on {{ inventory_hostname }} - -- name: Run {{AXInstall}} - ansible.windows.win_powershell: - script: | - iex "cmd /c D:\AXInstall\{{AXInstall}} /PlatFormFilesPath=D:\AXInstall\Config /ForceReboot=False /S" - Start-Sleep -Seconds 30 - Get-Process AXInstall | Wait-Process - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Checking final errorstatus 0 on {{ inventory_hostname }} - -- name: Final errorstatus - ansible.windows.win_powershell: - script: | - $newestLog = Get-Item D:\IFSAXSystem\InstallLog\AXInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 - $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' - if($result.Matches[0].Groups[1].Value -ne 0) { - $Ansible.Failed = $true - } - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Rebooting {{ inventory_hostname }} - -- name: Reboot - win_reboot: - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Cleaning up AXInstall files on {{ inventory_hostname }} - -- name: Clean up - ansible.windows.win_file: - path: D:\AXInstall - state: absent \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Copying AXInstall files to {{ inventory_hostname }} + +- name: Prepare install target + ansible.windows.win_file: + path: D:\AXInstall + state: directory + +- name: Copy {{AXInstall}} + win_copy: + src: ~/ansible/install/{{AXInstall}} + dest: D:\AXInstall\{{AXInstall}} + +- name: Copy Config + win_copy: + src: ~/ansible/install/config/v12.0/rejtestc.local/{{ inventory_hostname.split('.')[0]|upper }}/ + dest: D:\AXInstall\Config + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting AXInstall on {{ inventory_hostname }} + +- name: Run {{AXInstall}} + ansible.windows.win_powershell: + script: | + iex "cmd /c D:\AXInstall\{{AXInstall}} /PlatFormFilesPath=D:\AXInstall\Config /ForceReboot=False /S" + Start-Sleep -Seconds 30 + Get-Process AXInstall | Wait-Process + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Checking final errorstatus 0 on {{ inventory_hostname }} + +- name: Final errorstatus + ansible.windows.win_powershell: + script: | + $newestLog = Get-Item D:\IFSAXSystem\InstallLog\AXInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 + $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' + if($result.Matches[0].Groups[1].Value -ne 0) { + $Ansible.Failed = $true + } + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Rebooting {{ inventory_hostname }} + +- name: Reboot + win_reboot: +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Cleaning up AXInstall files on {{ inventory_hostname }} + +- name: Clean up + ansible.windows.win_file: + path: D:\AXInstall + state: absent diff --git a/oldstuff/tasks/Postinstalls/v.12/install-boinstall-v12.0-TestA.yaml b/oldstuff/tasks/Postinstalls/v.12/install-boinstall-v12.0-TestA.yaml index c264d81..fdb973a 100644 --- a/oldstuff/tasks/Postinstalls/v.12/install-boinstall-v12.0-TestA.yaml +++ b/oldstuff/tasks/Postinstalls/v.12/install-boinstall-v12.0-TestA.yaml @@ -1,89 +1,82 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Copying BOInstall files to {{ inventory_hostname }} - -- name: Prepare install target - ansible.windows.win_file: - path: D:\BOInstall - state: directory - -- name: Copy BOInstall - win_copy: - src: ~/ansible/install/{{BOInstall}} - dest: D:\BOInstall\{{BOInstall}} - -- name: Copy Config - win_copy: - src: ~/ansible/install/config/v12.0/rejtesta.local/{{ inventory_hostname.split('.')[0]|upper }}/ - dest: D:\BOInstall\Config - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting BOInstall on {{ inventory_hostname }} - -- name: Run BOInstall - ansible.windows.win_powershell: - script: | - iex "cmd /c D:\BOInstall\{{BOInstall}} /PlatFormFilesPath=D:\BOInstall\Config /ForceReboot=False /S" - Start-Sleep -Seconds 30 - Get-Process BOInstall | Wait-Process - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Checking final errorstatus 0 on {{ inventory_hostname }} - -- name: Final errorstatus - ansible.windows.win_powershell: - script: | - $newestLog = Get-Item D:\IFSBOSystem\InstallLog\BOInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 - $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' - if($result.Matches[0].Groups[1].Value -ne 0) { - $Ansible.Failed = $true - } - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Running fixlog4net on {{ inventory_hostname }} - -- name: Copy fixlog4net - win_copy: - src: ~/ansible/install/fixlog4net.ps1 - dest: D:\BOInstall\fixlog4net.ps1 - -- name: Run fixlog4net - ansible.windows.win_powershell: - script: | - D:\BOInstall\fixlog4net.ps1 - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Rebooting {{ inventory_hostname }} - -- name: Reboot - win_reboot: - -- name: Clean up - ansible.windows.win_file: - path: D:\BOInstall - state: absent \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Copying BOInstall files to {{ inventory_hostname }} + +- name: Prepare install target + ansible.windows.win_file: + path: D:\BOInstall + state: directory + +- name: Copy BOInstall + win_copy: + src: ~/ansible/install/{{BOInstall}} + dest: D:\BOInstall\{{BOInstall}} + +- name: Copy Config + win_copy: + src: ~/ansible/install/config/v12.0/rejtesta.local/{{ inventory_hostname.split('.')[0]|upper }}/ + dest: D:\BOInstall\Config + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting BOInstall on {{ inventory_hostname }} + +- name: Run BOInstall + ansible.windows.win_powershell: + script: | + iex "cmd /c D:\BOInstall\{{BOInstall}} /PlatFormFilesPath=D:\BOInstall\Config /ForceReboot=False /S" + Start-Sleep -Seconds 30 + Get-Process BOInstall | Wait-Process + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Checking final errorstatus 0 on {{ inventory_hostname }} + +- name: Final errorstatus + ansible.windows.win_powershell: + script: | + $newestLog = Get-Item D:\IFSBOSystem\InstallLog\BOInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 + $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' + if($result.Matches[0].Groups[1].Value -ne 0) { + $Ansible.Failed = $true + } + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Running fixlog4net on {{ inventory_hostname }} + +- name: Copy fixlog4net + win_copy: + src: ~/ansible/install/fixlog4net.ps1 + dest: D:\BOInstall\fixlog4net.ps1 + +- name: Run fixlog4net + ansible.windows.win_powershell: + script: | + D:\BOInstall\fixlog4net.ps1 + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Rebooting {{ inventory_hostname }} + +- name: Reboot + win_reboot: + +- name: Clean up + ansible.windows.win_file: + path: D:\BOInstall + state: absent diff --git a/oldstuff/tasks/Postinstalls/v.12/install-boinstall-v12.0-TestC.yaml b/oldstuff/tasks/Postinstalls/v.12/install-boinstall-v12.0-TestC.yaml index 58e93f4..99e5dee 100644 --- a/oldstuff/tasks/Postinstalls/v.12/install-boinstall-v12.0-TestC.yaml +++ b/oldstuff/tasks/Postinstalls/v.12/install-boinstall-v12.0-TestC.yaml @@ -1,89 +1,82 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Copying BOInstall files to {{ inventory_hostname }} - -- name: Prepare install target - ansible.windows.win_file: - path: D:\BOInstall - state: directory - -- name: Copy BOInstall - win_copy: - src: ~/ansible/install/{{BOInstall}} - dest: D:\BOInstall\{{BOInstall}} - -- name: Copy Config - win_copy: - src: ~/ansible/install/config/v12.0/rejtestc.local/{{ inventory_hostname.split('.')[0]|upper }}/ - dest: D:\BOInstall\Config - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting BOInstall on {{ inventory_hostname }} - -- name: Run BOInstall - ansible.windows.win_powershell: - script: | - iex "cmd /c D:\BOInstall\{{BOInstall}} /PlatFormFilesPath=D:\BOInstall\Config /ForceReboot=False /S" - Start-Sleep -Seconds 30 - Get-Process BOInstall | Wait-Process - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Checking final errorstatus 0 on {{ inventory_hostname }} - -- name: Final errorstatus - ansible.windows.win_powershell: - script: | - $newestLog = Get-Item D:\IFSBOSystem\InstallLog\BOInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 - $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' - if($result.Matches[0].Groups[1].Value -ne 0) { - $Ansible.Failed = $true - } - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Running fixlog4net on {{ inventory_hostname }} - -- name: Copy fixlog4net - win_copy: - src: ~/ansible/install/fixlog4net.ps1 - dest: D:\BOInstall\fixlog4net.ps1 - -- name: Run fixlog4net - ansible.windows.win_powershell: - script: | - D:\BOInstall\fixlog4net.ps1 - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Rebooting {{ inventory_hostname }} - -- name: Reboot - win_reboot: - -- name: Clean up - ansible.windows.win_file: - path: D:\BOInstall - state: absent \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Copying BOInstall files to {{ inventory_hostname }} + +- name: Prepare install target + ansible.windows.win_file: + path: D:\BOInstall + state: directory + +- name: Copy BOInstall + win_copy: + src: ~/ansible/install/{{BOInstall}} + dest: D:\BOInstall\{{BOInstall}} + +- name: Copy Config + win_copy: + src: ~/ansible/install/config/v12.0/rejtestc.local/{{ inventory_hostname.split('.')[0]|upper }}/ + dest: D:\BOInstall\Config + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting BOInstall on {{ inventory_hostname }} + +- name: Run BOInstall + ansible.windows.win_powershell: + script: | + iex "cmd /c D:\BOInstall\{{BOInstall}} /PlatFormFilesPath=D:\BOInstall\Config /ForceReboot=False /S" + Start-Sleep -Seconds 30 + Get-Process BOInstall | Wait-Process + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Checking final errorstatus 0 on {{ inventory_hostname }} + +- name: Final errorstatus + ansible.windows.win_powershell: + script: | + $newestLog = Get-Item D:\IFSBOSystem\InstallLog\BOInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 + $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' + if($result.Matches[0].Groups[1].Value -ne 0) { + $Ansible.Failed = $true + } + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Running fixlog4net on {{ inventory_hostname }} + +- name: Copy fixlog4net + win_copy: + src: ~/ansible/install/fixlog4net.ps1 + dest: D:\BOInstall\fixlog4net.ps1 + +- name: Run fixlog4net + ansible.windows.win_powershell: + script: | + D:\BOInstall\fixlog4net.ps1 + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Rebooting {{ inventory_hostname }} + +- name: Reboot + win_reboot: + +- name: Clean up + ansible.windows.win_file: + path: D:\BOInstall + state: absent diff --git a/oldstuff/tasks/Postinstalls/v.12/install-boinstall-v12.0_HF.yaml b/oldstuff/tasks/Postinstalls/v.12/install-boinstall-v12.0_HF.yaml index c264d81..fdb973a 100644 --- a/oldstuff/tasks/Postinstalls/v.12/install-boinstall-v12.0_HF.yaml +++ b/oldstuff/tasks/Postinstalls/v.12/install-boinstall-v12.0_HF.yaml @@ -1,89 +1,82 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Copying BOInstall files to {{ inventory_hostname }} - -- name: Prepare install target - ansible.windows.win_file: - path: D:\BOInstall - state: directory - -- name: Copy BOInstall - win_copy: - src: ~/ansible/install/{{BOInstall}} - dest: D:\BOInstall\{{BOInstall}} - -- name: Copy Config - win_copy: - src: ~/ansible/install/config/v12.0/rejtesta.local/{{ inventory_hostname.split('.')[0]|upper }}/ - dest: D:\BOInstall\Config - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting BOInstall on {{ inventory_hostname }} - -- name: Run BOInstall - ansible.windows.win_powershell: - script: | - iex "cmd /c D:\BOInstall\{{BOInstall}} /PlatFormFilesPath=D:\BOInstall\Config /ForceReboot=False /S" - Start-Sleep -Seconds 30 - Get-Process BOInstall | Wait-Process - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Checking final errorstatus 0 on {{ inventory_hostname }} - -- name: Final errorstatus - ansible.windows.win_powershell: - script: | - $newestLog = Get-Item D:\IFSBOSystem\InstallLog\BOInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 - $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' - if($result.Matches[0].Groups[1].Value -ne 0) { - $Ansible.Failed = $true - } - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Running fixlog4net on {{ inventory_hostname }} - -- name: Copy fixlog4net - win_copy: - src: ~/ansible/install/fixlog4net.ps1 - dest: D:\BOInstall\fixlog4net.ps1 - -- name: Run fixlog4net - ansible.windows.win_powershell: - script: | - D:\BOInstall\fixlog4net.ps1 - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Rebooting {{ inventory_hostname }} - -- name: Reboot - win_reboot: - -- name: Clean up - ansible.windows.win_file: - path: D:\BOInstall - state: absent \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Copying BOInstall files to {{ inventory_hostname }} + +- name: Prepare install target + ansible.windows.win_file: + path: D:\BOInstall + state: directory + +- name: Copy BOInstall + win_copy: + src: ~/ansible/install/{{BOInstall}} + dest: D:\BOInstall\{{BOInstall}} + +- name: Copy Config + win_copy: + src: ~/ansible/install/config/v12.0/rejtesta.local/{{ inventory_hostname.split('.')[0]|upper }}/ + dest: D:\BOInstall\Config + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting BOInstall on {{ inventory_hostname }} + +- name: Run BOInstall + ansible.windows.win_powershell: + script: | + iex "cmd /c D:\BOInstall\{{BOInstall}} /PlatFormFilesPath=D:\BOInstall\Config /ForceReboot=False /S" + Start-Sleep -Seconds 30 + Get-Process BOInstall | Wait-Process + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Checking final errorstatus 0 on {{ inventory_hostname }} + +- name: Final errorstatus + ansible.windows.win_powershell: + script: | + $newestLog = Get-Item D:\IFSBOSystem\InstallLog\BOInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 + $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' + if($result.Matches[0].Groups[1].Value -ne 0) { + $Ansible.Failed = $true + } + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Running fixlog4net on {{ inventory_hostname }} + +- name: Copy fixlog4net + win_copy: + src: ~/ansible/install/fixlog4net.ps1 + dest: D:\BOInstall\fixlog4net.ps1 + +- name: Run fixlog4net + ansible.windows.win_powershell: + script: | + D:\BOInstall\fixlog4net.ps1 + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Rebooting {{ inventory_hostname }} + +- name: Reboot + win_reboot: + +- name: Clean up + ansible.windows.win_file: + path: D:\BOInstall + state: absent diff --git a/oldstuff/tasks/grab-config.yaml b/oldstuff/tasks/grab-config.yaml index 6341874..ff3a811 100644 --- a/oldstuff/tasks/grab-config.yaml +++ b/oldstuff/tasks/grab-config.yaml @@ -1,19 +1,19 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Grabbing config from {{ inventory_hostname }} - -- name: Prepare install target - ansible.windows.win_file: - path: D:\BackUp_Config - state: directory - -- name: Copy grab_config.cmd - win_copy: - src: ~/ansible/install/grab_config.cmd - dest: D:\BackUp_Config\grab_config.cmd - -- name: Run grab_config - win_command: D:\BackUp_Config\grab_config.cmd {{epoch}} \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Grabbing config from {{ inventory_hostname }} + +- name: Prepare install target + ansible.windows.win_file: + path: D:\BackUp_Config + state: directory + +- name: Copy grab_config.cmd + win_copy: + src: ~/ansible/install/grab_config.cmd + dest: D:\BackUp_Config\grab_config.cmd + +- name: Run grab_config + win_command: D:\BackUp_Config\grab_config.cmd {{epoch}} diff --git a/oldstuff/tasks/install-axinstall-TravelCardDeployTravelCardServices.yaml b/oldstuff/tasks/install-axinstall-TravelCardDeployTravelCardServices.yaml index 9f68622..471e6aa 100644 --- a/oldstuff/tasks/install-axinstall-TravelCardDeployTravelCardServices.yaml +++ b/oldstuff/tasks/install-axinstall-TravelCardDeployTravelCardServices.yaml @@ -1,36 +1,35 @@ -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Deploying TravelCard Services on {{ inventory_hostname }} - -- name: Copy TravelCardDeployTravelCardServices script - win_copy: - src: ~/ansible/install/{{AOS_Deploy_TravelService}} - dest: D:\software\TravelCardDeployTravelCardServices.cmd - -- name: Run TravelCardDeployTravelCardServices script - win_command: cmd.exe /c "cd /d D:\software && call TravelCardDeployTravelCardServices.cmd" - register: script_result - changed_when: false - failed_when: "'Execution of TravelCardDeployTravelCardServices done' not in script_result.stdout" - -- name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: "Deployed TravelCard Services on {{ inventory_hostname }} : {{ 'Success' if script_result else 'Failed' }}" - when: script_result is defined - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: stopping AX on {{ inventory_hostname }} - -- name: Start Ax service - ansible.windows.win_service: - name: "aos60$01" - state: stopped - start_mode: auto - - +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Deploying TravelCard Services on {{ inventory_hostname }} + +- name: Copy TravelCardDeployTravelCardServices script + win_copy: + src: ~/ansible/install/{{AOS_Deploy_TravelService}} + dest: D:\software\TravelCardDeployTravelCardServices.cmd + +- name: Run TravelCardDeployTravelCardServices script + win_command: cmd.exe /c "cd /d D:\software && call TravelCardDeployTravelCardServices.cmd" + register: script_result + changed_when: false + failed_when: "'Execution of TravelCardDeployTravelCardServices done' not in script_result.stdout" + +- name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: "Deployed TravelCard Services on {{ inventory_hostname }} : {{ 'Success' if script_result else 'Failed' }}" + when: script_result is defined + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: stopping AX on {{ inventory_hostname }} + +- name: Start Ax service + ansible.windows.win_service: + name: aos60$01 + state: stopped + start_mode: auto diff --git a/oldstuff/tasks/install-axinstall-cilcompile.yaml b/oldstuff/tasks/install-axinstall-cilcompile.yaml index 0ef323f..d2498e0 100644 --- a/oldstuff/tasks/install-axinstall-cilcompile.yaml +++ b/oldstuff/tasks/install-axinstall-cilcompile.yaml @@ -1,112 +1,107 @@ -- 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: auto - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting CIL compile on {{ inventory_hostname }} - - -#- name: Compile CIL using Invoke-AxaptaServerCmd -# ansible.windows.win_shell: | -# $null = . 'D:\Program Files\Microsoft Dynamics AX\60\ManagementUtilities\Microsoft.Dynamics.ManagementUtilities.ps1' -# $AOSInstanceName = (Get-WmiObject -Class "MicrosoftDynamicsAX|InstalledAOSInstances" -Namespace "root\MicrosoftDynamicsAX").InstanceName -# $output = Invoke-AxaptaServerCmd -Server $AOSInstanceName -Command "CompileIL" -# register: cil_compile_output -# tags: -# - ax_compile_cil - -- name: Compile CIL using AX32.exe - win_shell: | - $startupCmd = "-startupcmd=CompileIL" - $createDesktopA = @" - [DllImport("user32.dll", SetLastError = true)] - public static extern IntPtr CreateDesktopA(string lpszDesktop, IntPtr lpszDevice, IntPtr pDevmode, uint dwFlags, uint dwDesiredAccess, IntPtr lpsa); - "@ - Add-Type -MemberDefinition $createDesktopA -Name "NativeMethods" -Namespace "Win32" - $desktop = [Win32.NativeMethods]::CreateDesktopA("CustomDesktop", [IntPtr]::Zero, [IntPtr]::Zero, 0, 0x10000000, [IntPtr]::Zero) - $job = Start-Job -ScriptBlock {Start-Process -FilePath "ax32.exe" -ArgumentList "-startupcmd=CompileIL" -Wait} - Wait-Job $job - register: cil_compile_output - tags: - - ax_compile_cil - -- name: Check CIL compilation result - win_shell: | - $logFilePath = "D:\Program Files\Microsoft Dynamics AX\60\Server\TravelCardDynamicsAX\bin\XppIL\Dynamics.Ax.Application.dll.log" - if (Test-Path $logFilePath) { - $logContent = Get-Content $logFilePath -Raw -Encoding UTF8 - $errors = Select-String -Path $logFilePath -Pattern "Error" - $warnings = Select-String -Path $logFilePath -Pattern "Warning" - if ($logContent -match "Finished creating types.") { - Write-Output "CIL compilation succeeded." - Write-Host "Number of Errors: $($errors.Line)" - Write-Host "Number of Warnings: $($warnings.Line)" - } else {Write-Output "CIL compilation failed." - } - } - else { - Write-Output "Log file not found." - } - register: cil_compile_output - tags: - - ax_compile_cil - - -- name: Send CIL compilation result notification via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: | - CIL compilation result for {{ inventory_hostname }}: - {{ cil_compile_output.stdout_lines}} - tags: - - ax_compile_cil - - - - -#- name: Show CIL compilation result -# ansible.builtin.debug: -# var: cil_compile_output.stdout_lines -# tags: -# - ax_compile_cil -# -#- name: Send CIL compilation result notification via Slack -# delegate_to: localhost -# community.general.slack: -# token: "{{ slack_token }}" -# msg: | -# CIL compilation result for {{ inventory_hostname }}: -# {% if cil_compile_output.stdout_lines %} -# {% for line in cil_compile_output.stdout_lines %} -# {{ line }} -# {% endfor %} -# {% else %} -# No output received. -# {% endif %} -# tags: -# - ax_compile_cil - -- 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: auto +--- +- 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: auto + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting CIL compile on {{ inventory_hostname }} + +#- name: Compile CIL using Invoke-AxaptaServerCmd +# ansible.windows.win_shell: | +# $null = . 'D:\Program Files\Microsoft Dynamics AX\60\ManagementUtilities\Microsoft.Dynamics.ManagementUtilities.ps1' +# $AOSInstanceName = (Get-WmiObject -Class "MicrosoftDynamicsAX|InstalledAOSInstances" -Namespace "root\MicrosoftDynamicsAX").InstanceName +# $output = Invoke-AxaptaServerCmd -Server $AOSInstanceName -Command "CompileIL" +# register: cil_compile_output +# tags: +# - ax_compile_cil + +- name: Compile CIL using AX32.exe + win_shell: | + $startupCmd = "-startupcmd=CompileIL" + $createDesktopA = @" + [DllImport("user32.dll", SetLastError = true)] + public static extern IntPtr CreateDesktopA(string lpszDesktop, IntPtr lpszDevice, IntPtr pDevmode, uint dwFlags, uint dwDesiredAccess, IntPtr lpsa); + "@ + Add-Type -MemberDefinition $createDesktopA -Name "NativeMethods" -Namespace "Win32" + $desktop = [Win32.NativeMethods]::CreateDesktopA("CustomDesktop", [IntPtr]::Zero, [IntPtr]::Zero, 0, 0x10000000, [IntPtr]::Zero) + $job = Start-Job -ScriptBlock {Start-Process -FilePath "ax32.exe" -ArgumentList "-startupcmd=CompileIL" -Wait} + Wait-Job $job + register: cil_compile_output + tags: + - ax_compile_cil + +- name: Check CIL compilation result + win_shell: | + $logFilePath = "D:\Program Files\Microsoft Dynamics AX\60\Server\TravelCardDynamicsAX\bin\XppIL\Dynamics.Ax.Application.dll.log" + if (Test-Path $logFilePath) { + $logContent = Get-Content $logFilePath -Raw -Encoding UTF8 + $errors = Select-String -Path $logFilePath -Pattern "Error" + $warnings = Select-String -Path $logFilePath -Pattern "Warning" + if ($logContent -match "Finished creating types.") { + Write-Output "CIL compilation succeeded." + Write-Host "Number of Errors: $($errors.Line)" + Write-Host "Number of Warnings: $($warnings.Line)" + } else {Write-Output "CIL compilation failed." + } + } + else { + Write-Output "Log file not found." + } + register: cil_compile_output + tags: + - ax_compile_cil + +- name: Send CIL compilation result notification via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: | + CIL compilation result for {{ inventory_hostname }}: + {{ cil_compile_output.stdout_lines}} + tags: + - ax_compile_cil + +#- name: Show CIL compilation result +# ansible.builtin.debug: +# var: cil_compile_output.stdout_lines +# tags: +# - ax_compile_cil +# +#- name: Send CIL compilation result notification via Slack +# delegate_to: localhost +# community.general.slack: +# token: "{{ slack_token }}" +# msg: | +# CIL compilation result for {{ inventory_hostname }}: +# {% if cil_compile_output.stdout_lines %} +# {% for line in cil_compile_output.stdout_lines %} +# {{ line }} +# {% endfor %} +# {% else %} +# No output received. +# {% endif %} +# tags: +# - ax_compile_cil + +- 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: auto diff --git a/oldstuff/tasks/install-axinstall-deployposttravelcardservices.yaml b/oldstuff/tasks/install-axinstall-deployposttravelcardservices.yaml index 6e4dd94..1c4524a 100644 --- a/oldstuff/tasks/install-axinstall-deployposttravelcardservices.yaml +++ b/oldstuff/tasks/install-axinstall-deployposttravelcardservices.yaml @@ -1,62 +1,60 @@ -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Deploying TravelCard Services on {{ inventory_hostname }} - -- name: Copy TravelCardPostDeploy script - win_copy: - src: ~/ansible/install/{{AOS_Deploy_PostTravel_Test}} - dest: D:\software\TravelCardPostDeploy.cmd - -- name: Run TravelCardPostDeploy script - win_command: cmd.exe /c "cd /d D:\software && call TravelCardPostDeploy.cmd" - register: script_result - changed_when: false - failed_when: "'Execution of TravelCardPostDeploy done' not in script_result.stdout" - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: "Deployed TravelCard Services on {{ inventory_hostname }} : {{ 'Success' if script_result else 'Failed' }}" - when: script_result is defined and script_result.stdout is defined - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: restaring AX on {{ inventory_hostname }} - -- name: Start Ax service - ansible.windows.win_service: - name: "aos60$01" - state: restarted - start_mode: manual - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: starting AX 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: stopping AX on {{ inventory_hostname }} - -- name: Start Ax service - ansible.windows.win_service: - name: "aos60$01" - state: stopped - start_mode: auto - - +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Deploying TravelCard Services on {{ inventory_hostname }} + +- name: Copy TravelCardPostDeploy script + win_copy: + src: ~/ansible/install/{{AOS_Deploy_PostTravel_Test}} + dest: D:\software\TravelCardPostDeploy.cmd + +- name: Run TravelCardPostDeploy script + win_command: cmd.exe /c "cd /d D:\software && call TravelCardPostDeploy.cmd" + register: script_result + changed_when: false + failed_when: "'Execution of TravelCardPostDeploy done' not in script_result.stdout" + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: "Deployed TravelCard Services on {{ inventory_hostname }} : {{ 'Success' if script_result else 'Failed' }}" + when: script_result is defined and script_result.stdout is defined + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: restaring AX on {{ inventory_hostname }} + +- name: Start Ax service + ansible.windows.win_service: + name: aos60$01 + state: restarted + start_mode: manual + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: starting AX 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: stopping AX on {{ inventory_hostname }} + +- name: Start Ax service + ansible.windows.win_service: + name: aos60$01 + state: stopped + start_mode: auto diff --git a/oldstuff/tasks/install-axinstall-importmodel.yaml b/oldstuff/tasks/install-axinstall-importmodel.yaml index 373dedc..6e32fbd 100644 --- a/oldstuff/tasks/install-axinstall-importmodel.yaml +++ b/oldstuff/tasks/install-axinstall-importmodel.yaml @@ -1,95 +1,94 @@ ---- -- 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 +--- +- 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 diff --git a/oldstuff/tasks/install-axinstall-sqlreindex.yaml b/oldstuff/tasks/install-axinstall-sqlreindex.yaml index 4a50fd2..70c760a 100644 --- a/oldstuff/tasks/install-axinstall-sqlreindex.yaml +++ b/oldstuff/tasks/install-axinstall-sqlreindex.yaml @@ -1,26 +1,27 @@ -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Running XU_Reindex and XU_ResetHandleIdentity on {{ inventory_hostname }} - -- name: Execute SQL commands on the TravelCardDynamicsAX database - ansible.windows.win_shell: | - Import-Module SqlServer - $server = "{{ inventory_hostname }}" - $database = "TravelCardDynamicsAX" - $query1 = "exec XU_Reindex" - $query2 = "exec XU_ResetHandleIdentity" - - Invoke-Sqlcmd -ServerInstance $server -Database $database -Query $query1 - Invoke-Sqlcmd -ServerInstance $server -Database $database -Query $query2 - register: sql_result - tags: - - sql_commands - delegate_to: "{{ groups['SQL'][0] }}" - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Done running XU_Reindex and XU_ResetHandleIdentity on {{ inventory_hostname }} \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Running XU_Reindex and XU_ResetHandleIdentity on {{ inventory_hostname }} + +- name: Execute SQL commands on the TravelCardDynamicsAX database + ansible.windows.win_shell: | + Import-Module SqlServer + $server = "{{ inventory_hostname }}" + $database = "TravelCardDynamicsAX" + $query1 = "exec XU_Reindex" + $query2 = "exec XU_ResetHandleIdentity" + + Invoke-Sqlcmd -ServerInstance $server -Database $database -Query $query1 + Invoke-Sqlcmd -ServerInstance $server -Database $database -Query $query2 + register: sql_result + tags: + - sql_commands + delegate_to: "{{ groups['SQL'][0] }}" + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Done running XU_Reindex and XU_ResetHandleIdentity on {{ inventory_hostname }} diff --git a/oldstuff/tasks/install-axinstall-xppcompileall.yaml b/oldstuff/tasks/install-axinstall-xppcompileall.yaml index 6c3a5ed..5755931 100644 --- a/oldstuff/tasks/install-axinstall-xppcompileall.yaml +++ b/oldstuff/tasks/install-axinstall-xppcompileall.yaml @@ -1,103 +1,102 @@ ---- -- 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: Synchronize database {{ inventory_hostname }} - -- name: Execute ax32.exe with –startupcmd=synchronize_dbonly using CreateDesktopA function - win_shell: | - $startupCmd = "-startupcmd=synchronize_dbonly" - $createDesktopA = @" - [DllImport("user32.dll", SetLastError = true)] - public static extern IntPtr CreateDesktopA(string lpszDesktop, IntPtr lpszDevice, IntPtr pDevmode, uint dwFlags, uint dwDesiredAccess, IntPtr lpsa); - "@ - Add-Type -MemberDefinition $createDesktopA -Name "NativeMethods" -Namespace "Win32" - $desktop = [Win32.NativeMethods]::CreateDesktopA("CustomDesktop", [IntPtr]::Zero, [IntPtr]::Zero, 0, 0x10000000, [IntPtr]::Zero) - Start-Process -FilePath "ax32.exe" -ArgumentList $startupCmd -Wait - register: result - -- name: Verify synchronization - win_shell: Get-EventLog -LogName Application -Source "Dynamics Server 01" -After (Get-Date).Date | Where-Object {$_.Source -eq "Dynamics Server 01" -and $_.Message -like "*Sync finished*"} - register: event_log_result - -- name: Show verification result - debug: - var: event_log_result.stdout_lines - -- name: Send DB sync status via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: "{% if event_log_result.stdout_lines %}:white_check_mark: Database synchronization on {{ inventory_hostname }} completed successfully.{% else %}:x: Database synchronization on {{ inventory_hostname }} failed with exit code {{ event_log_result.rc }}.{% endif %}" - -- name: Send xpp_compile start message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: "Starting xppcompileall on {{ inventory_hostname }}" - - -- name: xppcompileall AX - ansible.windows.win_shell: | - $binPath = "D:\Program Files\Microsoft Dynamics AX\60\Server\TravelCardDynamicsAX\bin" - $axBuildPath = "$binPath\AXBuild.exe" - Set-Location -Path $binPath - & $axBuildPath xppcompileall /s=01 /v - $logFilePath = "D:\Program Files\Microsoft Dynamics AX\60\Server\TravelCardDynamicsAX\Log\AxCompileAll.html" - $logContent = Get-Content -Path $logFilePath -Raw - $errorCount = [regex]::Match($logContent, '

Errors\s+:\s+(\d+)

').Groups[1].Value - $warningCount = [regex]::Match($logContent, '

Warnings\s+:\s+(\d+)

').Groups[1].Value - if ($errorCount -gt 0) { - $status = "failed with $errorCount error(s)." - $color = "danger" - } else { - $status = "completed with $warningCount warning(s)." - if ($warningCount -gt 0) { - $color = "warning" - } else { - $color = "good" - } - } - become: true - register: xppcompile_result - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: | - {{ - "Compilation completed successfully." if xppcompile_result.rc == 0 - else "Compilation failed with " + xppcompile_result.stdout.split(':')[1].strip() + " error(s)." - }} - {{ - "Warnings: " + xppcompile_result.stdout.split(':')[3].strip() + "." if "Warnings:" in xppcompile_result.stdout else "" - }} - when: xppcompile_result is defined - - - -- 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 +--- +- 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: Synchronize database {{ inventory_hostname }} + +- name: Execute ax32.exe with –startupcmd=synchronize_dbonly using CreateDesktopA function + win_shell: | + $startupCmd = "-startupcmd=synchronize_dbonly" + $createDesktopA = @" + [DllImport("user32.dll", SetLastError = true)] + public static extern IntPtr CreateDesktopA(string lpszDesktop, IntPtr lpszDevice, IntPtr pDevmode, uint dwFlags, uint dwDesiredAccess, IntPtr lpsa); + "@ + Add-Type -MemberDefinition $createDesktopA -Name "NativeMethods" -Namespace "Win32" + $desktop = [Win32.NativeMethods]::CreateDesktopA("CustomDesktop", [IntPtr]::Zero, [IntPtr]::Zero, 0, 0x10000000, [IntPtr]::Zero) + Start-Process -FilePath "ax32.exe" -ArgumentList $startupCmd -Wait + register: result + +- name: Verify synchronization + win_shell: Get-EventLog -LogName Application -Source "Dynamics Server 01" -After (Get-Date).Date | Where-Object {$_.Source -eq "Dynamics Server 01" -and $_.Message + -like "*Sync finished*"} + register: event_log_result + +- name: Show verification result + debug: + var: event_log_result.stdout_lines + +- name: Send DB sync status via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: "{% if event_log_result.stdout_lines %}:white_check_mark: Database synchronization on {{ inventory_hostname }} completed successfully.{% else %}:x: Database + synchronization on {{ inventory_hostname }} failed with exit code {{ event_log_result.rc }}.{% endif %}" + +- name: Send xpp_compile start message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting xppcompileall on {{ inventory_hostname }} + +- name: xppcompileall AX + ansible.windows.win_shell: | + $binPath = "D:\Program Files\Microsoft Dynamics AX\60\Server\TravelCardDynamicsAX\bin" + $axBuildPath = "$binPath\AXBuild.exe" + Set-Location -Path $binPath + & $axBuildPath xppcompileall /s=01 /v + $logFilePath = "D:\Program Files\Microsoft Dynamics AX\60\Server\TravelCardDynamicsAX\Log\AxCompileAll.html" + $logContent = Get-Content -Path $logFilePath -Raw + $errorCount = [regex]::Match($logContent, '

Errors\s+:\s+(\d+)

').Groups[1].Value + $warningCount = [regex]::Match($logContent, '

Warnings\s+:\s+(\d+)

').Groups[1].Value + if ($errorCount -gt 0) { + $status = "failed with $errorCount error(s)." + $color = "danger" + } else { + $status = "completed with $warningCount warning(s)." + if ($warningCount -gt 0) { + $color = "warning" + } else { + $color = "good" + } + } + become: true + register: xppcompile_result + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: | + {{ + "Compilation completed successfully." if xppcompile_result.rc == 0 + else "Compilation failed with " + xppcompile_result.stdout.split(':')[1].strip() + " error(s)." + }} + {{ + "Warnings: " + xppcompile_result.stdout.split(':')[3].strip() + "." if "Warnings:" in xppcompile_result.stdout else "" + }} + when: xppcompile_result is defined + +- 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 diff --git a/oldstuff/tasks/install-axinstall.yaml b/oldstuff/tasks/install-axinstall.yaml index 665ed55..cdc0e3e 100644 --- a/oldstuff/tasks/install-axinstall.yaml +++ b/oldstuff/tasks/install-axinstall.yaml @@ -1,81 +1,70 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Copying AXInstall files to {{ inventory_hostname }} - -- name: Prepare install target - ansible.windows.win_file: - path: D:\AXInstall - state: directory - -- name: Copy {{AXInstall}} - win_copy: - src: ~/ansible/install/{{AXInstall}} - dest: D:\AXInstall\{{AXInstall}} - -- name: Copy Config - win_copy: - src: ~/ansible/install/config/{{ configVersion }}/{{ configName }}/{{ inventory_hostname.split('.')[0]|upper }}/ - dest: D:\AXInstall\Config - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting {{AXInstall}} on {{ inventory_hostname }} - -- name: Run {{AXInstall}} - ansible.windows.win_powershell: - script: | - iex "cmd /c D:\AXInstall\{{AXInstall}} /PlatFormFilesPath=D:\AXInstall\Config /ForceReboot=False /S" - Start-Sleep -Seconds 30 - Get-Process AXInstall | Wait-Process - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Checking final errorstatus 0 on {{ inventory_hostname }} - -- name: Final errorstatus - ansible.windows.win_powershell: - script: | - $newestLog = Get-Item D:\IFSAXSystem\InstallLog\AXInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 - $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' - if($result.Matches[0].Groups[1].Value -ne 0) { - $Ansible.Failed = $true - } - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Rebooting {{ inventory_hostname }} - -- name: Reboot - win_reboot: - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Cleaning up AXInstall files on {{ inventory_hostname }} - -- name: Clean up - ansible.windows.win_file: - path: D:\AXInstall - state: absent \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Copying AXInstall files to {{ inventory_hostname }} + +- name: Prepare install target + ansible.windows.win_file: + path: D:\AXInstall + state: directory + +- name: Copy {{AXInstall}} + win_copy: + src: ~/ansible/install/{{AXInstall}} + dest: D:\AXInstall\{{AXInstall}} + +- name: Copy Config + win_copy: + src: ~/ansible/install/config/{{ configVersion }}/{{ configName }}/{{ inventory_hostname.split('.')[0]|upper }}/ + dest: D:\AXInstall\Config + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting {{AXInstall}} on {{ inventory_hostname }} + +- name: Run {{AXInstall}} + ansible.windows.win_powershell: + script: | + iex "cmd /c D:\AXInstall\{{AXInstall}} /PlatFormFilesPath=D:\AXInstall\Config /ForceReboot=False /S" + Start-Sleep -Seconds 30 + Get-Process AXInstall | Wait-Process + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Checking final errorstatus 0 on {{ inventory_hostname }} + +- name: Final errorstatus + ansible.windows.win_powershell: + script: | + $newestLog = Get-Item D:\IFSAXSystem\InstallLog\AXInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 + $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' + if($result.Matches[0].Groups[1].Value -ne 0) { + $Ansible.Failed = $true + } + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Rebooting {{ inventory_hostname }} + +- name: Reboot + win_reboot: +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Cleaning up AXInstall files on {{ inventory_hostname }} + +- name: Clean up + ansible.windows.win_file: + path: D:\AXInstall + state: absent diff --git a/oldstuff/tasks/install-boinstall.yaml b/oldstuff/tasks/install-boinstall.yaml index ad0c795..3e7f9e2 100644 --- a/oldstuff/tasks/install-boinstall.yaml +++ b/oldstuff/tasks/install-boinstall.yaml @@ -1,88 +1,81 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Copying {{BOInstall}} to {{ inventory_hostname }} - -- name: Prepare install target - ansible.windows.win_file: - path: D:\BOInstall - state: directory - -- name: Copy BOInstall - win_copy: - src: ~/ansible/install/{{BOInstall}} - dest: D:\BOInstall\{{BOInstall}} - -- name: Copy Config - win_copy: - src: ~/ansible/install/config/{{ configVersion }}/{{ configName }}/{{ inventory_hostname.split('.')[0]|upper }}/ - dest: D:\BOInstall\Config - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Installing {{BOInstall}} on {{ inventory_hostname }} - -- name: Run {{BOInstall}} - ansible.windows.win_powershell: - script: | - iex "cmd /c D:\BOInstall\{{BOInstall}} /PlatFormFilesPath=D:\BOInstall\Config /ForceReboot=False /S" - Start-Sleep -Seconds 30 - Get-Process BOInstall | Wait-Process - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Checking final errorstatus 0 on {{ inventory_hostname }} - -- name: Final errorstatus - ansible.windows.win_powershell: - script: | - $newestLog = Get-Item D:\IFSBOSystem\InstallLog\BOInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 - $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' - if($result.Matches[0].Groups[1].Value -ne 0) { - $Ansible.Failed = $true - } - - -#- name: Send notification message via Slack -# delegate_to: localhost -# community.general.slack: -# token: "{{ slack_token }}" -# msg: Running fixlog4net on {{ inventory_hostname }} - -#- name: Copy fixlog4net -# win_copy: -# src: ~/ansible/install/fixlog4net.ps1 -# dest: D:\BOInstall\fixlog4net.ps1 - -#- name: Run fixlog4net -# ansible.windows.win_powershell: -# script: | -# D:\BOInstall\fixlog4net.ps1 - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Rebooting {{ inventory_hostname }} - -- name: Reboot - win_reboot: - -- name: Clean up - ansible.windows.win_file: - path: D:\BOInstall - state: absent \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Copying {{BOInstall}} to {{ inventory_hostname }} + +- name: Prepare install target + ansible.windows.win_file: + path: D:\BOInstall + state: directory + +- name: Copy BOInstall + win_copy: + src: ~/ansible/install/{{BOInstall}} + dest: D:\BOInstall\{{BOInstall}} + +- name: Copy Config + win_copy: + src: ~/ansible/install/config/{{ configVersion }}/{{ configName }}/{{ inventory_hostname.split('.')[0]|upper }}/ + dest: D:\BOInstall\Config + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Installing {{BOInstall}} on {{ inventory_hostname }} + +- name: Run {{BOInstall}} + ansible.windows.win_powershell: + script: | + iex "cmd /c D:\BOInstall\{{BOInstall}} /PlatFormFilesPath=D:\BOInstall\Config /ForceReboot=False /S" + Start-Sleep -Seconds 30 + Get-Process BOInstall | Wait-Process + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Checking final errorstatus 0 on {{ inventory_hostname }} + +- name: Final errorstatus + ansible.windows.win_powershell: + script: | + $newestLog = Get-Item D:\IFSBOSystem\InstallLog\BOInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 + $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' + if($result.Matches[0].Groups[1].Value -ne 0) { + $Ansible.Failed = $true + } + + +#- name: Send notification message via Slack +# delegate_to: localhost +# community.general.slack: +# token: "{{ slack_token }}" +# msg: Running fixlog4net on {{ inventory_hostname }} + +#- name: Copy fixlog4net +# win_copy: +# src: ~/ansible/install/fixlog4net.ps1 +# dest: D:\BOInstall\fixlog4net.ps1 + +#- name: Run fixlog4net +# ansible.windows.win_powershell: +# script: | +# D:\BOInstall\fixlog4net.ps1 + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Rebooting {{ inventory_hostname }} + +- name: Reboot + win_reboot: + +- name: Clean up + ansible.windows.win_file: + path: D:\BOInstall + state: absent diff --git a/oldstuff/tasks/install-notepadplus.yaml b/oldstuff/tasks/install-notepadplus.yaml index 14effde..bcba247 100644 --- a/oldstuff/tasks/install-notepadplus.yaml +++ b/oldstuff/tasks/install-notepadplus.yaml @@ -1,53 +1,51 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Copying Note_install files to {{ inventory_hostname }} - -- name: Prepare install target - ansible.windows.win_file: - path: D:\software\ - state: directory - -- name: Copy {{Note_install}} - win_copy: - src: ~/ansible/install/{{Note_install}} - dest: D:\software\{{Note_install}} - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting Note_install on {{ inventory_hostname }} - -- name: Run {{Note_install}} - ansible.windows.win_powershell: - script: | - D:\Sofware\{{Note_install}} /S - Get-Process npp* | Wait-Process - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Checking Version installed on {{ inventory_hostname }} - -- name: Version Check - ansible.windows.win_powershell: - script: | - $log = Get-Item 'C:\Program Files\Notepad++\change.log' - $topline = $log | Get-Content | Select -First 1 - - if($result.Matches[0].Groups[1].Value -match 'Notepad\+\+ v8.4.1') { - $Ansible.Failed = $true - } - - - -###name: Clean up -### ansible.windows.win_file: -### path: D:\software\{{Note_install}} -### state: absent \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Copying Note_install files to {{ inventory_hostname }} + +- name: Prepare install target + ansible.windows.win_file: + path: D:\software\ + state: directory + +- name: Copy {{Note_install}} + win_copy: + src: ~/ansible/install/{{Note_install}} + dest: D:\software\{{Note_install}} + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting Note_install on {{ inventory_hostname }} + +- name: Run {{Note_install}} + ansible.windows.win_powershell: + script: | + D:\Sofware\{{Note_install}} /S + Get-Process npp* | Wait-Process + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Checking Version installed on {{ inventory_hostname }} + +- name: Version Check + ansible.windows.win_powershell: + script: | + $log = Get-Item 'C:\Program Files\Notepad++\change.log' + $topline = $log | Get-Content | Select -First 1 + + if($result.Matches[0].Groups[1].Value -match 'Notepad\+\+ v8.4.1') { + $Ansible.Failed = $true + } + + +###name: Clean up +### ansible.windows.win_file: +### path: D:\software\{{Note_install}} +### state: absent diff --git a/oldstuff/tasks/old/install-axinstall-v12.0-TestA.yaml b/oldstuff/tasks/old/install-axinstall-v12.0-TestA.yaml index df8f0da..16f0130 100644 --- a/oldstuff/tasks/old/install-axinstall-v12.0-TestA.yaml +++ b/oldstuff/tasks/old/install-axinstall-v12.0-TestA.yaml @@ -1,81 +1,70 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Copying AXInstall files to {{ inventory_hostname }} - -- name: Prepare install target - ansible.windows.win_file: - path: D:\AXInstall - state: directory - -- name: Copy {{AXInstall}} - win_copy: - src: ~/ansible/install/{{AXInstall}} - dest: D:\AXInstall\{{AXInstall}} - -- name: Copy Config - win_copy: - src: ~/ansible/install/config/v12.0/rejtesta.local/{{ inventory_hostname.split('.')[0]|upper }}/ - dest: D:\AXInstall\Config - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting AXInstall on {{ inventory_hostname }} - -- name: Run {{AXInstall}} - ansible.windows.win_powershell: - script: | - iex "cmd /c D:\AXInstall\{{AXInstall}} /PlatFormFilesPath=D:\AXInstall\Config /ForceReboot=False /S" - Start-Sleep -Seconds 30 - Get-Process AXInstall | Wait-Process - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Checking final errorstatus 0 on {{ inventory_hostname }} - -- name: Final errorstatus - ansible.windows.win_powershell: - script: | - $newestLog = Get-Item D:\IFSAXSystem\InstallLog\AXInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 - $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' - if($result.Matches[0].Groups[1].Value -ne 0) { - $Ansible.Failed = $true - } - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Rebooting {{ inventory_hostname }} - -- name: Reboot - win_reboot: - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Cleaning up AXInstall files on {{ inventory_hostname }} - -- name: Clean up - ansible.windows.win_file: - path: D:\AXInstall - state: absent \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Copying AXInstall files to {{ inventory_hostname }} + +- name: Prepare install target + ansible.windows.win_file: + path: D:\AXInstall + state: directory + +- name: Copy {{AXInstall}} + win_copy: + src: ~/ansible/install/{{AXInstall}} + dest: D:\AXInstall\{{AXInstall}} + +- name: Copy Config + win_copy: + src: ~/ansible/install/config/v12.0/rejtesta.local/{{ inventory_hostname.split('.')[0]|upper }}/ + dest: D:\AXInstall\Config + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting AXInstall on {{ inventory_hostname }} + +- name: Run {{AXInstall}} + ansible.windows.win_powershell: + script: | + iex "cmd /c D:\AXInstall\{{AXInstall}} /PlatFormFilesPath=D:\AXInstall\Config /ForceReboot=False /S" + Start-Sleep -Seconds 30 + Get-Process AXInstall | Wait-Process + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Checking final errorstatus 0 on {{ inventory_hostname }} + +- name: Final errorstatus + ansible.windows.win_powershell: + script: | + $newestLog = Get-Item D:\IFSAXSystem\InstallLog\AXInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 + $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' + if($result.Matches[0].Groups[1].Value -ne 0) { + $Ansible.Failed = $true + } + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Rebooting {{ inventory_hostname }} + +- name: Reboot + win_reboot: +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Cleaning up AXInstall files on {{ inventory_hostname }} + +- name: Clean up + ansible.windows.win_file: + path: D:\AXInstall + state: absent diff --git a/oldstuff/tasks/old/install-axinstall-v12.0-TestC.yaml b/oldstuff/tasks/old/install-axinstall-v12.0-TestC.yaml index e2f35e4..39ff6ef 100644 --- a/oldstuff/tasks/old/install-axinstall-v12.0-TestC.yaml +++ b/oldstuff/tasks/old/install-axinstall-v12.0-TestC.yaml @@ -1,81 +1,70 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Copying AXInstall files to {{ inventory_hostname }} - -- name: Prepare install target - ansible.windows.win_file: - path: D:\AXInstall - state: directory - -- name: Copy {{AXInstall}} - win_copy: - src: ~/ansible/install/{{AXInstall}} - dest: D:\AXInstall\{{AXInstall}} - -- name: Copy Config - win_copy: - src: ~/ansible/install/config/v12.0/rejtestc.local/{{ inventory_hostname.split('.')[0]|upper }}/ - dest: D:\AXInstall\Config - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting AXInstall on {{ inventory_hostname }} - -- name: Run {{AXInstall}} - ansible.windows.win_powershell: - script: | - iex "cmd /c D:\AXInstall\{{AXInstall}} /PlatFormFilesPath=D:\AXInstall\Config /ForceReboot=False /S" - Start-Sleep -Seconds 30 - Get-Process AXInstall | Wait-Process - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Checking final errorstatus 0 on {{ inventory_hostname }} - -- name: Final errorstatus - ansible.windows.win_powershell: - script: | - $newestLog = Get-Item D:\IFSAXSystem\InstallLog\AXInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 - $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' - if($result.Matches[0].Groups[1].Value -ne 0) { - $Ansible.Failed = $true - } - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Rebooting {{ inventory_hostname }} - -- name: Reboot - win_reboot: - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Cleaning up AXInstall files on {{ inventory_hostname }} - -- name: Clean up - ansible.windows.win_file: - path: D:\AXInstall - state: absent \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Copying AXInstall files to {{ inventory_hostname }} + +- name: Prepare install target + ansible.windows.win_file: + path: D:\AXInstall + state: directory + +- name: Copy {{AXInstall}} + win_copy: + src: ~/ansible/install/{{AXInstall}} + dest: D:\AXInstall\{{AXInstall}} + +- name: Copy Config + win_copy: + src: ~/ansible/install/config/v12.0/rejtestc.local/{{ inventory_hostname.split('.')[0]|upper }}/ + dest: D:\AXInstall\Config + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting AXInstall on {{ inventory_hostname }} + +- name: Run {{AXInstall}} + ansible.windows.win_powershell: + script: | + iex "cmd /c D:\AXInstall\{{AXInstall}} /PlatFormFilesPath=D:\AXInstall\Config /ForceReboot=False /S" + Start-Sleep -Seconds 30 + Get-Process AXInstall | Wait-Process + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Checking final errorstatus 0 on {{ inventory_hostname }} + +- name: Final errorstatus + ansible.windows.win_powershell: + script: | + $newestLog = Get-Item D:\IFSAXSystem\InstallLog\AXInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 + $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' + if($result.Matches[0].Groups[1].Value -ne 0) { + $Ansible.Failed = $true + } + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Rebooting {{ inventory_hostname }} + +- name: Reboot + win_reboot: +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Cleaning up AXInstall files on {{ inventory_hostname }} + +- name: Clean up + ansible.windows.win_file: + path: D:\AXInstall + state: absent diff --git a/oldstuff/tasks/old/install-boinstall-v12.0-TestA.yaml b/oldstuff/tasks/old/install-boinstall-v12.0-TestA.yaml index c264d81..fdb973a 100644 --- a/oldstuff/tasks/old/install-boinstall-v12.0-TestA.yaml +++ b/oldstuff/tasks/old/install-boinstall-v12.0-TestA.yaml @@ -1,89 +1,82 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Copying BOInstall files to {{ inventory_hostname }} - -- name: Prepare install target - ansible.windows.win_file: - path: D:\BOInstall - state: directory - -- name: Copy BOInstall - win_copy: - src: ~/ansible/install/{{BOInstall}} - dest: D:\BOInstall\{{BOInstall}} - -- name: Copy Config - win_copy: - src: ~/ansible/install/config/v12.0/rejtesta.local/{{ inventory_hostname.split('.')[0]|upper }}/ - dest: D:\BOInstall\Config - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting BOInstall on {{ inventory_hostname }} - -- name: Run BOInstall - ansible.windows.win_powershell: - script: | - iex "cmd /c D:\BOInstall\{{BOInstall}} /PlatFormFilesPath=D:\BOInstall\Config /ForceReboot=False /S" - Start-Sleep -Seconds 30 - Get-Process BOInstall | Wait-Process - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Checking final errorstatus 0 on {{ inventory_hostname }} - -- name: Final errorstatus - ansible.windows.win_powershell: - script: | - $newestLog = Get-Item D:\IFSBOSystem\InstallLog\BOInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 - $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' - if($result.Matches[0].Groups[1].Value -ne 0) { - $Ansible.Failed = $true - } - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Running fixlog4net on {{ inventory_hostname }} - -- name: Copy fixlog4net - win_copy: - src: ~/ansible/install/fixlog4net.ps1 - dest: D:\BOInstall\fixlog4net.ps1 - -- name: Run fixlog4net - ansible.windows.win_powershell: - script: | - D:\BOInstall\fixlog4net.ps1 - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Rebooting {{ inventory_hostname }} - -- name: Reboot - win_reboot: - -- name: Clean up - ansible.windows.win_file: - path: D:\BOInstall - state: absent \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Copying BOInstall files to {{ inventory_hostname }} + +- name: Prepare install target + ansible.windows.win_file: + path: D:\BOInstall + state: directory + +- name: Copy BOInstall + win_copy: + src: ~/ansible/install/{{BOInstall}} + dest: D:\BOInstall\{{BOInstall}} + +- name: Copy Config + win_copy: + src: ~/ansible/install/config/v12.0/rejtesta.local/{{ inventory_hostname.split('.')[0]|upper }}/ + dest: D:\BOInstall\Config + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting BOInstall on {{ inventory_hostname }} + +- name: Run BOInstall + ansible.windows.win_powershell: + script: | + iex "cmd /c D:\BOInstall\{{BOInstall}} /PlatFormFilesPath=D:\BOInstall\Config /ForceReboot=False /S" + Start-Sleep -Seconds 30 + Get-Process BOInstall | Wait-Process + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Checking final errorstatus 0 on {{ inventory_hostname }} + +- name: Final errorstatus + ansible.windows.win_powershell: + script: | + $newestLog = Get-Item D:\IFSBOSystem\InstallLog\BOInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 + $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' + if($result.Matches[0].Groups[1].Value -ne 0) { + $Ansible.Failed = $true + } + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Running fixlog4net on {{ inventory_hostname }} + +- name: Copy fixlog4net + win_copy: + src: ~/ansible/install/fixlog4net.ps1 + dest: D:\BOInstall\fixlog4net.ps1 + +- name: Run fixlog4net + ansible.windows.win_powershell: + script: | + D:\BOInstall\fixlog4net.ps1 + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Rebooting {{ inventory_hostname }} + +- name: Reboot + win_reboot: + +- name: Clean up + ansible.windows.win_file: + path: D:\BOInstall + state: absent diff --git a/oldstuff/tasks/old/install-boinstall-v12.0-TestC.yaml b/oldstuff/tasks/old/install-boinstall-v12.0-TestC.yaml index 58e93f4..99e5dee 100644 --- a/oldstuff/tasks/old/install-boinstall-v12.0-TestC.yaml +++ b/oldstuff/tasks/old/install-boinstall-v12.0-TestC.yaml @@ -1,89 +1,82 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Copying BOInstall files to {{ inventory_hostname }} - -- name: Prepare install target - ansible.windows.win_file: - path: D:\BOInstall - state: directory - -- name: Copy BOInstall - win_copy: - src: ~/ansible/install/{{BOInstall}} - dest: D:\BOInstall\{{BOInstall}} - -- name: Copy Config - win_copy: - src: ~/ansible/install/config/v12.0/rejtestc.local/{{ inventory_hostname.split('.')[0]|upper }}/ - dest: D:\BOInstall\Config - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting BOInstall on {{ inventory_hostname }} - -- name: Run BOInstall - ansible.windows.win_powershell: - script: | - iex "cmd /c D:\BOInstall\{{BOInstall}} /PlatFormFilesPath=D:\BOInstall\Config /ForceReboot=False /S" - Start-Sleep -Seconds 30 - Get-Process BOInstall | Wait-Process - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Checking final errorstatus 0 on {{ inventory_hostname }} - -- name: Final errorstatus - ansible.windows.win_powershell: - script: | - $newestLog = Get-Item D:\IFSBOSystem\InstallLog\BOInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 - $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' - if($result.Matches[0].Groups[1].Value -ne 0) { - $Ansible.Failed = $true - } - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Running fixlog4net on {{ inventory_hostname }} - -- name: Copy fixlog4net - win_copy: - src: ~/ansible/install/fixlog4net.ps1 - dest: D:\BOInstall\fixlog4net.ps1 - -- name: Run fixlog4net - ansible.windows.win_powershell: - script: | - D:\BOInstall\fixlog4net.ps1 - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Rebooting {{ inventory_hostname }} - -- name: Reboot - win_reboot: - -- name: Clean up - ansible.windows.win_file: - path: D:\BOInstall - state: absent \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Copying BOInstall files to {{ inventory_hostname }} + +- name: Prepare install target + ansible.windows.win_file: + path: D:\BOInstall + state: directory + +- name: Copy BOInstall + win_copy: + src: ~/ansible/install/{{BOInstall}} + dest: D:\BOInstall\{{BOInstall}} + +- name: Copy Config + win_copy: + src: ~/ansible/install/config/v12.0/rejtestc.local/{{ inventory_hostname.split('.')[0]|upper }}/ + dest: D:\BOInstall\Config + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting BOInstall on {{ inventory_hostname }} + +- name: Run BOInstall + ansible.windows.win_powershell: + script: | + iex "cmd /c D:\BOInstall\{{BOInstall}} /PlatFormFilesPath=D:\BOInstall\Config /ForceReboot=False /S" + Start-Sleep -Seconds 30 + Get-Process BOInstall | Wait-Process + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Checking final errorstatus 0 on {{ inventory_hostname }} + +- name: Final errorstatus + ansible.windows.win_powershell: + script: | + $newestLog = Get-Item D:\IFSBOSystem\InstallLog\BOInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 + $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' + if($result.Matches[0].Groups[1].Value -ne 0) { + $Ansible.Failed = $true + } + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Running fixlog4net on {{ inventory_hostname }} + +- name: Copy fixlog4net + win_copy: + src: ~/ansible/install/fixlog4net.ps1 + dest: D:\BOInstall\fixlog4net.ps1 + +- name: Run fixlog4net + ansible.windows.win_powershell: + script: | + D:\BOInstall\fixlog4net.ps1 + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Rebooting {{ inventory_hostname }} + +- name: Reboot + win_reboot: + +- name: Clean up + ansible.windows.win_file: + path: D:\BOInstall + state: absent diff --git a/oldstuff/tasks/old/install-boinstall-v12.0_HF.yaml b/oldstuff/tasks/old/install-boinstall-v12.0_HF.yaml index c264d81..fdb973a 100644 --- a/oldstuff/tasks/old/install-boinstall-v12.0_HF.yaml +++ b/oldstuff/tasks/old/install-boinstall-v12.0_HF.yaml @@ -1,89 +1,82 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Copying BOInstall files to {{ inventory_hostname }} - -- name: Prepare install target - ansible.windows.win_file: - path: D:\BOInstall - state: directory - -- name: Copy BOInstall - win_copy: - src: ~/ansible/install/{{BOInstall}} - dest: D:\BOInstall\{{BOInstall}} - -- name: Copy Config - win_copy: - src: ~/ansible/install/config/v12.0/rejtesta.local/{{ inventory_hostname.split('.')[0]|upper }}/ - dest: D:\BOInstall\Config - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting BOInstall on {{ inventory_hostname }} - -- name: Run BOInstall - ansible.windows.win_powershell: - script: | - iex "cmd /c D:\BOInstall\{{BOInstall}} /PlatFormFilesPath=D:\BOInstall\Config /ForceReboot=False /S" - Start-Sleep -Seconds 30 - Get-Process BOInstall | Wait-Process - - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Checking final errorstatus 0 on {{ inventory_hostname }} - -- name: Final errorstatus - ansible.windows.win_powershell: - script: | - $newestLog = Get-Item D:\IFSBOSystem\InstallLog\BOInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 - $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' - if($result.Matches[0].Groups[1].Value -ne 0) { - $Ansible.Failed = $true - } - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Running fixlog4net on {{ inventory_hostname }} - -- name: Copy fixlog4net - win_copy: - src: ~/ansible/install/fixlog4net.ps1 - dest: D:\BOInstall\fixlog4net.ps1 - -- name: Run fixlog4net - ansible.windows.win_powershell: - script: | - D:\BOInstall\fixlog4net.ps1 - - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Rebooting {{ inventory_hostname }} - -- name: Reboot - win_reboot: - -- name: Clean up - ansible.windows.win_file: - path: D:\BOInstall - state: absent \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Copying BOInstall files to {{ inventory_hostname }} + +- name: Prepare install target + ansible.windows.win_file: + path: D:\BOInstall + state: directory + +- name: Copy BOInstall + win_copy: + src: ~/ansible/install/{{BOInstall}} + dest: D:\BOInstall\{{BOInstall}} + +- name: Copy Config + win_copy: + src: ~/ansible/install/config/v12.0/rejtesta.local/{{ inventory_hostname.split('.')[0]|upper }}/ + dest: D:\BOInstall\Config + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting BOInstall on {{ inventory_hostname }} + +- name: Run BOInstall + ansible.windows.win_powershell: + script: | + iex "cmd /c D:\BOInstall\{{BOInstall}} /PlatFormFilesPath=D:\BOInstall\Config /ForceReboot=False /S" + Start-Sleep -Seconds 30 + Get-Process BOInstall | Wait-Process + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Checking final errorstatus 0 on {{ inventory_hostname }} + +- name: Final errorstatus + ansible.windows.win_powershell: + script: | + $newestLog = Get-Item D:\IFSBOSystem\InstallLog\BOInstall_*.log | Sort LastWriteTime -Descending | Select-Object -First 1 + $result = $newestLog | Select-String -Pattern 'The final errorstatus is ([0-9]+)' + if($result.Matches[0].Groups[1].Value -ne 0) { + $Ansible.Failed = $true + } + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Running fixlog4net on {{ inventory_hostname }} + +- name: Copy fixlog4net + win_copy: + src: ~/ansible/install/fixlog4net.ps1 + dest: D:\BOInstall\fixlog4net.ps1 + +- name: Run fixlog4net + ansible.windows.win_powershell: + script: | + D:\BOInstall\fixlog4net.ps1 + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Rebooting {{ inventory_hostname }} + +- name: Reboot + win_reboot: + +- name: Clean up + ansible.windows.win_file: + path: D:\BOInstall + state: absent diff --git a/oldstuff/tasks/reboot.yaml b/oldstuff/tasks/reboot.yaml index ca88608..b80f9ce 100644 --- a/oldstuff/tasks/reboot.yaml +++ b/oldstuff/tasks/reboot.yaml @@ -1,9 +1,9 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Rebooting {{ inventory_hostname }} - -- name: Reboot - win_reboot: \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Rebooting {{ inventory_hostname }} + +- name: Reboot + win_reboot: diff --git a/oldstuff/tasks/start-aos.yaml b/oldstuff/tasks/start-aos.yaml index 9b027cd..d33b165 100644 --- a/oldstuff/tasks/start-aos.yaml +++ b/oldstuff/tasks/start-aos.yaml @@ -1,12 +1,12 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting Ax service on {{ inventory_hostname }} - -- name: Starting Dynamics Ax service - ansible.windows.win_service: - name: "aos60$01" - state: started - start_mode: auto \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting Ax service on {{ inventory_hostname }} + +- name: Starting Dynamics Ax service + ansible.windows.win_service: + name: aos60$01 + state: started + start_mode: auto diff --git a/oldstuff/tasks/start-ifsbo.yaml b/oldstuff/tasks/start-ifsbo.yaml index f2cc39f..b503244 100644 --- a/oldstuff/tasks/start-ifsbo.yaml +++ b/oldstuff/tasks/start-ifsbo.yaml @@ -1,32 +1,32 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting IFSBO on {{ inventory_hostname }} - -- name: IFSBO-Start - ansible.windows.win_powershell: - script: | - # start agent service - Get-Service -DisplayName 'IFS HouseKeeping Agent' | Start-Service - # connect to agent - $proxy = New-WebServiceProxy -Uri 'http://localhost:9080/HouseKeepingAgentService/' - $proxy.Startup() - # start retry loop - :retry for($retry = 0; $retry -lt 60; $retry++) { - Start-Sleep -Seconds 5 - # get component status - $components = $proxy.ComponentsInfo() - # if any component is not running, restart retry loop - foreach($component in $components) { - if($component.Status -eq 'Error') { - throw "Component $($component.Name) has failed to start" - } - if($component.Status -ne 'Running') { - continue retry - } - } - # break retry loop - break retry - } \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting IFSBO on {{ inventory_hostname }} + +- name: IFSBO-Start + ansible.windows.win_powershell: + script: |- + # start agent service + Get-Service -DisplayName 'IFS HouseKeeping Agent' | Start-Service + # connect to agent + $proxy = New-WebServiceProxy -Uri 'http://localhost:9080/HouseKeepingAgentService/' + $proxy.Startup() + # start retry loop + :retry for($retry = 0; $retry -lt 60; $retry++) { + Start-Sleep -Seconds 5 + # get component status + $components = $proxy.ComponentsInfo() + # if any component is not running, restart retry loop + foreach($component in $components) { + if($component.Status -eq 'Error') { + throw "Component $($component.Name) has failed to start" + } + if($component.Status -ne 'Running') { + continue retry + } + } + # break retry loop + break retry + } diff --git a/oldstuff/tasks/start-iis.yaml b/oldstuff/tasks/start-iis.yaml index d45c538..59bed69 100644 --- a/oldstuff/tasks/start-iis.yaml +++ b/oldstuff/tasks/start-iis.yaml @@ -1,9 +1,9 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Starting IIS on {{ inventory_hostname }} - -- name: iisreset -start - win_command: iisreset -start \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Starting IIS on {{ inventory_hostname }} + +- name: iisreset -start + win_command: iisreset -start diff --git a/oldstuff/tasks/stop-aos.yaml b/oldstuff/tasks/stop-aos.yaml index d2b54d1..35896d4 100644 --- a/oldstuff/tasks/stop-aos.yaml +++ b/oldstuff/tasks/stop-aos.yaml @@ -1,12 +1,12 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Stopping Ax service on {{ inventory_hostname }} - -- name: Stop Dynamics Ax service - ansible.windows.win_service: - name: "aos60$01" - state: stopped - start_mode: manual \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Stopping Ax service on {{ inventory_hostname }} + +- name: Stop Dynamics Ax service + ansible.windows.win_service: + name: aos60$01 + state: stopped + start_mode: manual diff --git a/oldstuff/tasks/stop-ifsbo.yaml b/oldstuff/tasks/stop-ifsbo.yaml index 6a543b1..cf57e74 100644 --- a/oldstuff/tasks/stop-ifsbo.yaml +++ b/oldstuff/tasks/stop-ifsbo.yaml @@ -1,37 +1,36 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Stopping IFSBO on {{ inventory_hostname }} - -- name: IFSBO-Stop - ansible.windows.win_powershell: - script: | - $forceQuit = $false - # ensure agent is running - Get-Service -DisplayName 'IFS HouseKeeping Agent' | Start-Service -ErrorAction Stop - # connect to agent - $proxy = New-WebServiceProxy -Uri 'http://localhost:9080/HouseKeepingAgentService/' - # initiate shutdown - $proxy.Shutdown($forceQuit, $true) - # Start retry loop - :retry for($retry = 0; $retry -lt 60; $retry++) { - - Start-Sleep -Seconds 5 - # if any component is still running, restart retry loop - foreach($component in $components) { - if($component.Status -eq 'Running') { - continue retry - } - } - # no components running - if($retry -eq 59) { - $forceQuit = $true - } - # break retry loop - break retry - } - # Shutdown agent - $proxy.ShutdownAndQuit($forceQuit, $true) - +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Stopping IFSBO on {{ inventory_hostname }} + +- name: IFSBO-Stop + ansible.windows.win_powershell: + script: | + $forceQuit = $false + # ensure agent is running + Get-Service -DisplayName 'IFS HouseKeeping Agent' | Start-Service -ErrorAction Stop + # connect to agent + $proxy = New-WebServiceProxy -Uri 'http://localhost:9080/HouseKeepingAgentService/' + # initiate shutdown + $proxy.Shutdown($forceQuit, $true) + # Start retry loop + :retry for($retry = 0; $retry -lt 60; $retry++) { + + Start-Sleep -Seconds 5 + # if any component is still running, restart retry loop + foreach($component in $components) { + if($component.Status -eq 'Running') { + continue retry + } + } + # no components running + if($retry -eq 59) { + $forceQuit = $true + } + # break retry loop + break retry + } + # Shutdown agent + $proxy.ShutdownAndQuit($forceQuit, $true) diff --git a/oldstuff/tasks/stop-iis.yaml b/oldstuff/tasks/stop-iis.yaml index d0966e5..9e0a828 100644 --- a/oldstuff/tasks/stop-iis.yaml +++ b/oldstuff/tasks/stop-iis.yaml @@ -1,9 +1,9 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Stopping IIS on {{ inventory_hostname }} - -- name: iisreset -stop - win_command: iisreset -stop \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Stopping IIS on {{ inventory_hostname }} + +- name: iisreset -stop + win_command: iisreset -stop diff --git a/oldstuff/tasks/task-failed-slack.yaml b/oldstuff/tasks/task-failed-slack.yaml index b475dde..467ea5f 100644 --- a/oldstuff/tasks/task-failed-slack.yaml +++ b/oldstuff/tasks/task-failed-slack.yaml @@ -1,9 +1,9 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Task failed on {{ inventory_hostname }} - -- name: Fail - ansible.builtin.command: /bin/false \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Task failed on {{ inventory_hostname }} + +- name: Fail + ansible.builtin.command: /bin/false diff --git a/oldstuff/tasks/test-log4net.yaml b/oldstuff/tasks/test-log4net.yaml index 854ffb0..db58730 100644 --- a/oldstuff/tasks/test-log4net.yaml +++ b/oldstuff/tasks/test-log4net.yaml @@ -1,16 +1,16 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Running fixlog4net on {{ inventory_hostname }} - -- name: Copy fixlog4net - win_copy: - src: ~/ansible/install/fixlog4net.ps1 - dest: D:\BOInstall\fixlog4net.ps1 - -- name: Run fixlog4net - ansible.windows.win_powershell: - script: | - D:\BOInstall\fixlog4net.ps1 \ No newline at end of file +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Running fixlog4net on {{ inventory_hostname }} + +- name: Copy fixlog4net + win_copy: + src: ~/ansible/install/fixlog4net.ps1 + dest: D:\BOInstall\fixlog4net.ps1 + +- name: Run fixlog4net + ansible.windows.win_powershell: + script: |- + D:\BOInstall\fixlog4net.ps1 diff --git a/oldstuff/tasks/uninstall-axinstall-pom.yaml b/oldstuff/tasks/uninstall-axinstall-pom.yaml index c984317..750c564 100644 --- a/oldstuff/tasks/uninstall-axinstall-pom.yaml +++ b/oldstuff/tasks/uninstall-axinstall-pom.yaml @@ -1,11 +1,11 @@ ---- -- name: Deleting contents of XppiL folder - ansible.windows.win_powershell: - script: | - $path = 'D:\Program Files\Microsoft Dynamics AX\60\Server\TravelCardDynamicsAX\bin\XppIL' - Get-Item -Path "$path\*" | Remove-Item -Force -Recurse - $items = Get-ChildItem -Recurse -Path $path - if($items.Count -gt 0) { - $Ansible.Result = "Items remaining in XppiL: $($items.Count)" - $Ansible.Failed = $true - } \ No newline at end of file +--- +- name: Deleting contents of XppiL folder + ansible.windows.win_powershell: + script: |- + $path = 'D:\Program Files\Microsoft Dynamics AX\60\Server\TravelCardDynamicsAX\bin\XppIL' + Get-Item -Path "$path\*" | Remove-Item -Force -Recurse + $items = Get-ChildItem -Recurse -Path $path + if($items.Count -gt 0) { + $Ansible.Result = "Items remaining in XppiL: $($items.Count)" + $Ansible.Failed = $true + } diff --git a/oldstuff/tasks/uninstall-axinstall.yaml b/oldstuff/tasks/uninstall-axinstall.yaml index 589c764..cc5c113 100644 --- a/oldstuff/tasks/uninstall-axinstall.yaml +++ b/oldstuff/tasks/uninstall-axinstall.yaml @@ -1,23 +1,23 @@ ---- -- name: Uninstall AXInstall - ansible.windows.win_powershell: - script: | - $lastInstall = (Get-ItemProperty -Path HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\AXInstall\ -Name LastInstall).LastInstall - $uninstallString = (Get-ItemProperty -Path HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\$lastInstall\ -Name UninstallString).UninstallString - iex "cmd /c '$uninstallString' /S /ForceReboot=False" - Start-Sleep -Seconds 30 - Get-Process Au_ | Wait-Process - -- name: Reboot - win_reboot: - -- name: Cleanup IFSAXSystem folder - win_file: - path: D:\IFSAXSystem - state: absent - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: uninstall Done on {{ inventory_hostname }} \ No newline at end of file +--- +- name: Uninstall AXInstall + ansible.windows.win_powershell: + script: | + $lastInstall = (Get-ItemProperty -Path HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\AXInstall\ -Name LastInstall).LastInstall + $uninstallString = (Get-ItemProperty -Path HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\$lastInstall\ -Name UninstallString).UninstallString + iex "cmd /c '$uninstallString' /S /ForceReboot=False" + Start-Sleep -Seconds 30 + Get-Process Au_ | Wait-Process + +- name: Reboot + win_reboot: + +- name: Cleanup IFSAXSystem folder + win_file: + path: D:\IFSAXSystem + state: absent + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: uninstall Done on {{ inventory_hostname }} diff --git a/oldstuff/tasks/uninstall-boinstall.yaml b/oldstuff/tasks/uninstall-boinstall.yaml index 3a14398..682edc9 100644 --- a/oldstuff/tasks/uninstall-boinstall.yaml +++ b/oldstuff/tasks/uninstall-boinstall.yaml @@ -1,39 +1,37 @@ ---- -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Uninstalling BOInstall on {{ inventory_hostname }} - -- name: Uninstall BOInstall - ansible.windows.win_powershell: - script: | - $lastInstall = (Get-ItemProperty -Path HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\BOInstall\ -Name LastInstall).LastInstall - $uninstallString = (Get-ItemProperty -Path HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\$lastinstall\ -Name UninstallString).UninstallString - iex "cmd /c '$uninstallString' /S /ForceReboot=False" - Start-Sleep -Seconds 30 - Get-Process Au_ | Wait-Process - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Rebooting {{ inventory_hostname }} - -- name: Reboot - win_reboot: - - -- name: Send notification message via Slack - delegate_to: localhost - community.general.slack: - token: "{{ slack_token }}" - msg: Cleanup IFSBOSystem on {{ inventory_hostname }} - - -- name: Cleanup IFSBOSystem folder - win_file: - path: D:\IFSBOSystem - state: absent - +--- +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Uninstalling BOInstall on {{ inventory_hostname }} + +- name: Uninstall BOInstall + ansible.windows.win_powershell: + script: | + $lastInstall = (Get-ItemProperty -Path HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\BOInstall\ -Name LastInstall).LastInstall + $uninstallString = (Get-ItemProperty -Path HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\$lastinstall\ -Name UninstallString).UninstallString + iex "cmd /c '$uninstallString' /S /ForceReboot=False" + Start-Sleep -Seconds 30 + Get-Process Au_ | Wait-Process + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Rebooting {{ inventory_hostname }} + +- name: Reboot + win_reboot: + + +- name: Send notification message via Slack + delegate_to: localhost + community.general.slack: + token: "{{ slack_token }}" + msg: Cleanup IFSBOSystem on {{ inventory_hostname }} + +- name: Cleanup IFSBOSystem folder + win_file: + path: D:\IFSBOSystem + state: absent diff --git a/oldstuff/template-install.yaml b/oldstuff/template-install.yaml index ac33dda..8a983a7 100644 --- a/oldstuff/template-install.yaml +++ b/oldstuff/template-install.yaml @@ -1,71 +1,68 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - vars: - playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\u0000',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting {{ playbook_file }} - -## BOInstall -- name: Install BOInstall - hosts: BOInstall - gather_facts: false - tasks: - - block: - - include: tasks/install-boinstall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -## AxInstall -- name: Install AXInstall - hosts: AOS - gather_facts: false - tasks: - - block: - - include: tasks/install-axinstall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -#- name: AXInstall Post-Installation tasks -# hosts: AOS_POM -# gather_facts: false -# tasks: -# - block: -# - include: tasks/install-axinstall-cilcompile.yaml -# rescue: -# - include: tasks/task-failed-slack.yaml - - -## Post-installs -#- name: Install PI46810 - CWS -# hosts: WEB_CWS -# gather_facts: false -# tasks: -# - block: -# - include: tasks/install-PI46810_CWS.yaml -# rescue: -# - include: tasks/task-failed-slack.yaml - -#- name: Install PI46810 - BORIS -# hosts: WEB_BORIS -# gather_facts: false -# tasks: -# - block: -# - include: tasks/install-PI46810_BORIS.yaml -# rescue: -# - include: tasks/task-failed-slack.yaml - -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: All done +--- +- name: Slack + hosts: localhost + gather_facts: false + vars: + playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\0',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting {{ playbook_file }} + +## BOInstall +- name: Install BOInstall + hosts: BOInstall + gather_facts: false + tasks: + - block: + - include: tasks/install-boinstall.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall +- name: Install AXInstall + hosts: AOS + gather_facts: false + tasks: + - block: + - include: tasks/install-axinstall.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +#- name: AXInstall Post-Installation tasks +# hosts: AOS_POM +# gather_facts: false +# tasks: +# - block: +# - include: tasks/install-axinstall-cilcompile.yaml +# rescue: +# - include: tasks/task-failed-slack.yaml + +## Post-installs +#- name: Install PI46810 - CWS +# hosts: WEB_CWS +# gather_facts: false +# tasks: +# - block: +# - include: tasks/install-PI46810_CWS.yaml +# rescue: +# - include: tasks/task-failed-slack.yaml + +#- name: Install PI46810 - BORIS +# hosts: WEB_BORIS +# gather_facts: false +# tasks: +# - block: +# - include: tasks/install-PI46810_BORIS.yaml +# rescue: +# - include: tasks/task-failed-slack.yaml + +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: All done diff --git a/oldstuff/test-connectivity.yaml b/oldstuff/test-connectivity.yaml index 55d61f6..b81c148 100644 --- a/oldstuff/test-connectivity.yaml +++ b/oldstuff/test-connectivity.yaml @@ -1,15 +1,15 @@ ---- -- name: test winrm connexion - hosts: Windows - vars: - # ansible_user: svcansible@DOMAIN.EAST-WEST.DK - # ansible_password: 4bUmP3ZgOE70WDmuMuS8WD3ZgOmuMuS8 - # ansible_connection: winrm - # ansible_winrm_server_cert_validation: ignore - # ansible_winrm_scheme: http - # ansible_ssh_port: 5985 - # ansible_winrm_transport: kerberos - # ansible_winrm_kinit_mode: auto - # ansible_winrm_kinit_cmd: 'echo "4bUmP3ZgOE70WDmuMuS8WD3ZgOmuMuS8" | kinit svcansible@DOMAIN.EAST-WEST.DK' - tasks: - - win_ping: +--- +- name: test winrm connexion + hosts: Windows + vars: + # ansible_user: svcansible@DOMAIN.EAST-WEST.DK + # ansible_password: 4bUmP3ZgOE70WDmuMuS8WD3ZgOmuMuS8 + # ansible_connection: winrm + # ansible_winrm_server_cert_validation: ignore + # ansible_winrm_scheme: http + # ansible_ssh_port: 5985 + # ansible_winrm_transport: kerberos + # ansible_winrm_kinit_mode: auto + # ansible_winrm_kinit_cmd: 'echo "4bUmP3ZgOE70WDmuMuS8WD3ZgOmuMuS8" | kinit svcansible@DOMAIN.EAST-WEST.DK' + tasks: + - win_ping: diff --git a/oldstuff/test-grabconfig.yaml b/oldstuff/test-grabconfig.yaml index 1258f2d..900f3e1 100644 --- a/oldstuff/test-grabconfig.yaml +++ b/oldstuff/test-grabconfig.yaml @@ -1,34 +1,34 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - vars: - playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\u0000',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting {{ playbook_file }} - - name: Get epoch timestamp - shell: date +%s - register: timestamp - -- name: Grab config - all servers - hosts: ServersWithConfigs - gather_facts: false - vars: - epoch: "{{ hostvars['localhost']['timestamp'].stdout }}" - tasks: - - block: - - include: tasks/grab-config.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -- name: Slack - hosts: localhost - gather_facts: false - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: All done +--- +- name: Slack + hosts: localhost + gather_facts: false + vars: + playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\0',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting {{ playbook_file }} + - name: Get epoch timestamp + shell: date +%s + register: timestamp + +- name: Grab config - all servers + hosts: ServersWithConfigs + gather_facts: false + vars: + epoch: "{{ hostvars['localhost']['timestamp'].stdout }}" + tasks: + - block: + - include: tasks/grab-config.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Slack + hosts: localhost + gather_facts: false + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: All done diff --git a/oldstuff/test-log4net.yaml b/oldstuff/test-log4net.yaml index fd6b00d..b1da186 100644 --- a/oldstuff/test-log4net.yaml +++ b/oldstuff/test-log4net.yaml @@ -1,10 +1,9 @@ ---- -- name: Install BOInstall - hosts: SQL - gather_facts: false - tasks: - - block: - - include: tasks/test-log4net.yaml - rescue: - - include: tasks/task-failed-slack.yaml - +--- +- name: Install BOInstall + hosts: SQL + gather_facts: false + tasks: + - block: + - include: tasks/test-log4net.yaml + rescue: + - include: tasks/task-failed-slack.yaml diff --git a/oldstuff/test-windows.yaml b/oldstuff/test-windows.yaml index 997a917..497b95d 100644 --- a/oldstuff/test-windows.yaml +++ b/oldstuff/test-windows.yaml @@ -1,16 +1,15 @@ ---- -- name: testing windows hosts - hosts: Windows - tasks: - - name: run ipconfig - raw: ipconfig - register: ipconfig - - - debug: var=ipconfig - - - name: run ping - ansible.windows.win_ping: - register: winping - - - debug: var=winping - +--- +- name: testing windows hosts + hosts: Windows + tasks: + - name: run ipconfig + raw: ipconfig + register: ipconfig + + - debug: var=ipconfig + + - name: run ping + ansible.windows.win_ping: + register: winping + + - debug: var=winping diff --git a/oldstuff/uninstall-axinstall.yaml b/oldstuff/uninstall-axinstall.yaml index e21033b..fbb8c55 100644 --- a/oldstuff/uninstall-axinstall.yaml +++ b/oldstuff/uninstall-axinstall.yaml @@ -1,45 +1,44 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - vars: - playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\u0000',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting {{ playbook_file }} - - name: Get epoch timestamp - shell: date +%s - register: timestamp - -- name: Grab config - all servers - hosts: AOS - gather_facts: false - vars: - epoch: "{{ hostvars['localhost']['timestamp'].stdout }}" - tasks: - - block: - - include: tasks/grab-config.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -## AxInstall -- name: Uninstall AXInstall - hosts: AOS - gather_facts: false - tasks: - - block: - - include: tasks/uninstall-axinstall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -- name: Uninstall AXInstall - XppiL cleanup - hosts: AOS_POM - gather_facts: false - tasks: - - block: - - include: tasks/uninstall-axinstall-pom.yaml - rescue: - - include: tasks/task-failed-slack.yaml \ No newline at end of file +--- +- name: Slack + hosts: localhost + gather_facts: false + vars: + playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\0',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting {{ playbook_file }} + - name: Get epoch timestamp + shell: date +%s + register: timestamp + +- name: Grab config - all servers + hosts: AOS + gather_facts: false + vars: + epoch: "{{ hostvars['localhost']['timestamp'].stdout }}" + tasks: + - block: + - include: tasks/grab-config.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall +- name: Uninstall AXInstall + hosts: AOS + gather_facts: false + tasks: + - block: + - include: tasks/uninstall-axinstall.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Uninstall AXInstall - XppiL cleanup + hosts: AOS_POM + gather_facts: false + tasks: + - block: + - include: tasks/uninstall-axinstall-pom.yaml + rescue: + - include: tasks/task-failed-slack.yaml diff --git a/oldstuff/uninstall-boinstall.yaml b/oldstuff/uninstall-boinstall.yaml index fc52d1d..53b7a45 100644 --- a/oldstuff/uninstall-boinstall.yaml +++ b/oldstuff/uninstall-boinstall.yaml @@ -1,37 +1,35 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - vars: - playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\u0000',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting {{ playbook_file }} - - name: Get epoch timestamp - shell: date +%s - register: timestamp - -- name: Grab config - all servers - hosts: BOInstall - gather_facts: false - vars: - epoch: "{{ hostvars['localhost']['timestamp'].stdout }}" - tasks: - - block: - - include: tasks/grab-config.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -## BOInstall -- name: Uninstall BOInstall - hosts: BOInstall - gather_facts: false - tasks: - - block: - - include: tasks/uninstall-boinstall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - \ No newline at end of file +--- +- name: Slack + hosts: localhost + gather_facts: false + vars: + playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\0',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting {{ playbook_file }} + - name: Get epoch timestamp + shell: date +%s + register: timestamp + +- name: Grab config - all servers + hosts: BOInstall + gather_facts: false + vars: + epoch: "{{ hostvars['localhost']['timestamp'].stdout }}" + tasks: + - block: + - include: tasks/grab-config.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## BOInstall +- name: Uninstall BOInstall + hosts: BOInstall + gather_facts: false + tasks: + - block: + - include: tasks/uninstall-boinstall.yaml + rescue: + - include: tasks/task-failed-slack.yaml diff --git a/oldstuff/uninstall.yaml b/oldstuff/uninstall.yaml index 4bac1fd..8a907fa 100644 --- a/oldstuff/uninstall.yaml +++ b/oldstuff/uninstall.yaml @@ -1,55 +1,54 @@ ---- -- name: Slack - hosts: localhost - gather_facts: false - vars: - playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\u0000',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" - tasks: - - name: Send notification message via Slack - community.general.slack: - token: "{{ slack_token }}" - msg: Starting {{ playbook_file }} - - name: Get epoch timestamp - shell: date +%s - register: timestamp - -- name: Grab config - all servers - hosts: ServersWithConfigs - gather_facts: false - vars: - epoch: "{{ hostvars['localhost']['timestamp'].stdout }}" - tasks: - - block: - - include: tasks/grab-config.yaml - rescue: - - include: tasks/task-failed-slack.yaml - - -## BOInstall -- name: Uninstall BOInstall - hosts: BOInstall - gather_facts: false - tasks: - - block: - - include: tasks/uninstall-boinstall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -## AxInstall -- name: Uninstall AXInstall - hosts: AOS - gather_facts: false - tasks: - - block: - - include: tasks/uninstall-axinstall.yaml - rescue: - - include: tasks/task-failed-slack.yaml - -- name: Uninstall AXInstall - XppiL cleanup - hosts: AOS_POM - gather_facts: false - tasks: - - block: - - include: tasks/uninstall-axinstall-pom.yaml - rescue: - - include: tasks/task-failed-slack.yaml \ No newline at end of file +--- +- name: Slack + hosts: localhost + gather_facts: false + vars: + playbook_file: "{{ (lookup('file', '/proc/self/cmdline') | regex_replace('\0',' ')).split() | select('match','^.*[.]ya?ml$') | list | first }}" + tasks: + - name: Send notification message via Slack + community.general.slack: + token: "{{ slack_token }}" + msg: Starting {{ playbook_file }} + - name: Get epoch timestamp + shell: date +%s + register: timestamp + +- name: Grab config - all servers + hosts: ServersWithConfigs + gather_facts: false + vars: + epoch: "{{ hostvars['localhost']['timestamp'].stdout }}" + tasks: + - block: + - include: tasks/grab-config.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## BOInstall +- name: Uninstall BOInstall + hosts: BOInstall + gather_facts: false + tasks: + - block: + - include: tasks/uninstall-boinstall.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +## AxInstall +- name: Uninstall AXInstall + hosts: AOS + gather_facts: false + tasks: + - block: + - include: tasks/uninstall-axinstall.yaml + rescue: + - include: tasks/task-failed-slack.yaml + +- name: Uninstall AXInstall - XppiL cleanup + hosts: AOS_POM + gather_facts: false + tasks: + - block: + - include: tasks/uninstall-axinstall-pom.yaml + rescue: + - include: tasks/task-failed-slack.yaml diff --git a/remove_vm.yml b/remove_vm.yml index 3cb557d..c94971a 100644 --- a/remove_vm.yml +++ b/remove_vm.yml @@ -1,17 +1,17 @@ --- - name: Remove VM on Proxmox hosts: proxmox.localdomain - gather_facts: no + gather_facts: false vars: - api_host: "192.168.1.162" - api_user: "root@pam" - api_token_id: "mytoki" - api_token_secret: "ea5114f5-ed39-4277-ac09-a32984be5bc9" - proxmox_node: "pve" + api_host: 192.168.1.162 + api_user: root@pam + api_token_id: mytoki + api_token_secret: ea5114f5-ed39-4277-ac09-a32984be5bc9 + proxmox_node: pve vars_prompt: - name: vm_name_to_remove - prompt: "Enter the name of the VM to remove" - private: no + prompt: Enter the name of the VM to remove + private: false tasks: - name: List all VMs and templates community.general.proxmox_vm_info: @@ -19,19 +19,19 @@ api_user: "{{ api_user }}" api_token_id: "{{ api_token_id }}" api_token_secret: "{{ api_token_secret }}" - validate_certs: no + validate_certs: false register: vms_info - name: Find VMID based on VM name - set_fact: - vmid_to_remove: "{{ item.vmid }}" loop: "{{ vms_info.proxmox_vms }}" when: item.name == vm_name_to_remove + ansible.builtin.set_fact: + vmid_to_remove: "{{ item.vmid }}" - name: Debug VMID to remove - debug: - msg: "VMID to remove: {{ vmid_to_remove }}" when: vmid_to_remove is defined + ansible.builtin.debug: + msg: "VMID to remove: {{ vmid_to_remove }}" - name: Remove the VM community.general.proxmox_kvm: @@ -45,7 +45,6 @@ when: vmid_to_remove is defined - name: Print message if VM was not found - debug: - msg: "VM {{ vm_name_to_remove }} not found." when: vmid_to_remove is not defined - + ansible.builtin.debug: + msg: VM {{ vm_name_to_remove }} not found. diff --git a/roles/shutdown-role/meta/main.yml b/roles/shutdown-role/meta/main.yml index 5dfb7b6..586687b 100644 --- a/roles/shutdown-role/meta/main.yml +++ b/roles/shutdown-role/meta/main.yml @@ -1,3 +1,4 @@ +--- galaxy_info: author: name1 description: superorle @@ -40,12 +41,12 @@ galaxy_info: # - 99.99 galaxy_tags: [] - # List tags for your role here, one per line. A tag is a keyword that describes - # and categorizes the role. Users find roles by searching for tags. Be sure to - # remove the '[]' above, if you add tags to this list. - # - # NOTE: A tag is limited to a single word comprised of alphanumeric characters. - # Maximum 20 tags per role. +# List tags for your role here, one per line. A tag is a keyword that describes +# and categorizes the role. Users find roles by searching for tags. Be sure to +# remove the '[]' above, if you add tags to this list. +# +# NOTE: A tag is limited to a single word comprised of alphanumeric characters. +# Maximum 20 tags per role. dependencies: [] # List your role dependencies here, one per line. Be sure to remove the '[]' above, diff --git a/roles/unifi_dhcp_clients_list/meta/main.yml b/roles/unifi_dhcp_clients_list/meta/main.yml index c572acc..62bafb9 100644 --- a/roles/unifi_dhcp_clients_list/meta/main.yml +++ b/roles/unifi_dhcp_clients_list/meta/main.yml @@ -1,3 +1,4 @@ +--- galaxy_info: author: your name description: your role description @@ -40,12 +41,12 @@ galaxy_info: # - 99.99 galaxy_tags: [] - # List tags for your role here, one per line. A tag is a keyword that describes - # and categorizes the role. Users find roles by searching for tags. Be sure to - # remove the '[]' above, if you add tags to this list. - # - # NOTE: A tag is limited to a single word comprised of alphanumeric characters. - # Maximum 20 tags per role. +# List tags for your role here, one per line. A tag is a keyword that describes +# and categorizes the role. Users find roles by searching for tags. Be sure to +# remove the '[]' above, if you add tags to this list. +# +# NOTE: A tag is limited to a single word comprised of alphanumeric characters. +# Maximum 20 tags per role. dependencies: [] # List your role dependencies here, one per line. Be sure to remove the '[]' above, diff --git a/roles/unifi_dhcp_clients_list/tasks/main.yml b/roles/unifi_dhcp_clients_list/tasks/main.yml index a32ee12..c24d13b 100644 --- a/roles/unifi_dhcp_clients_list/tasks/main.yml +++ b/roles/unifi_dhcp_clients_list/tasks/main.yml @@ -18,5 +18,5 @@ register: clients - name: Display clients details - debug: + ansible.builtin.debug: var: clients.results diff --git a/roles/zabbix_agent/defaults/main.yml b/roles/zabbix_agent/defaults/main.yml index b3474a1..fe99bf2 100644 --- a/roles/zabbix_agent/defaults/main.yml +++ b/roles/zabbix_agent/defaults/main.yml @@ -1,6 +1,7 @@ -zabbix_server: "192.168.1.24" -zabbix_server_url: "http://192.168.1.24/api_jsonrpc.php" -zabbix_login_user: "Admin" -zabbix_login_password: "zabbix" -zabbix_host_group: "2" # Change this to the correct group ID for your setup -zabbix_template_id: "10001" # Change this to the correct template ID for your setup +--- +zabbix_server: 192.168.1.24 +zabbix_server_url: http://192.168.1.24/api_jsonrpc.php +zabbix_login_user: Admin +zabbix_login_password: zabbix +zabbix_host_group: "2" # Change this to the correct group ID for your setup +zabbix_template_id: "10001" # Change this to the correct template ID for your setup diff --git a/roles/zabbix_agent/meta/main.yml b/roles/zabbix_agent/meta/main.yml index ea68190..270e3e4 100644 --- a/roles/zabbix_agent/meta/main.yml +++ b/roles/zabbix_agent/meta/main.yml @@ -1,3 +1,4 @@ +--- galaxy_info: author: your name description: your role description @@ -22,12 +23,12 @@ galaxy_info: # min_ansible_container_version: galaxy_tags: [] - # List tags for your role here, one per line. A tag is a keyword that describes - # and categorizes the role. Users find roles by searching for tags. Be sure to - # remove the '[]' above, if you add tags to this list. - # - # NOTE: A tag is limited to a single word comprised of alphanumeric characters. - # Maximum 20 tags per role. +# List tags for your role here, one per line. A tag is a keyword that describes +# and categorizes the role. Users find roles by searching for tags. Be sure to +# remove the '[]' above, if you add tags to this list. +# +# NOTE: A tag is limited to a single word comprised of alphanumeric characters. +# Maximum 20 tags per role. dependencies: [] # List your role dependencies here, one per line. Be sure to remove the '[]' above, diff --git a/roles/zabbix_agent/tasks/main.yml b/roles/zabbix_agent/tasks/main.yml index f8ccaf7..d5b8f88 100644 --- a/roles/zabbix_agent/tasks/main.yml +++ b/roles/zabbix_agent/tasks/main.yml @@ -1,65 +1,68 @@ --- - name: Update apt cache - apt: - update_cache: true become: true + ansible.builtin.apt: + update_cache: true - name: Install Zabbix agent - apt: + become: true + ansible.builtin.apt: name: zabbix-agent state: present - become: true - name: Ensure Zabbix agent is running and enabled - service: + become: true + ansible.builtin.service: name: zabbix-agent state: started enabled: true - become: true - name: Configure Zabbix agent - template: + become: true + ansible.builtin.template: src: zabbix_agentd.conf.j2 dest: /etc/zabbix/zabbix_agentd.conf - become: true - name: Generate PSK for Zabbix agent - shell: echo -n "4e616d656461706c617965722072616e646f6d6b65792067656e657261746564" > /etc/zabbix/zabbix_agentd.psk become: true + ansible.builtin.shell: echo -n "4e616d656461706c617965722072616e646f6d6b65792067656e657261746564" > /etc/zabbix/zabbix_agentd.psk - name: Restart Zabbix agent - service: + become: true + ansible.builtin.service: name: zabbix-agent state: restarted - become: true - name: Authenticate with Zabbix API - uri: - url: "http://192.168.1.24/api_jsonrpc.php" - method: POST - body_format: json - headers: - Content-Type: "application/json" - body: - jsonrpc: "2.0" - method: "user.login" - params: - username: "Admin" - password: "zabbix" - id: 1 register: auth_response delegate_to: localhost - -- name: Create or update a host in Zabbix - uri: - url: "http://192.168.1.24/api_jsonrpc.php" + ansible.builtin.uri: + url: http://192.168.1.24/api_jsonrpc.php method: POST body_format: json headers: - Content-Type: "application/json" + Content-Type: application/json body: jsonrpc: "2.0" - method: "host.create" + method: user.login + params: + username: Admin + password: zabbix + id: 1 + +- name: Create or update a host in Zabbix + register: zabbix_host_response + delegate_to: localhost + when: auth_response.json.result is defined + ansible.builtin.uri: + url: http://192.168.1.24/api_jsonrpc.php + method: POST + body_format: json + headers: + Content-Type: application/json + body: + jsonrpc: "2.0" + method: host.create params: host: "{{ inventory_hostname }}" interfaces: @@ -70,21 +73,18 @@ dns: "" port: "10050" groups: - - groupid: "2" # Group ID for "Linux servers" + - groupid: "2" templates: - - templateid: "10001" # Template ID for "Template OS Linux" + - templateid: "10001" tls_connect: 2 tls_accept: 2 - tls_psk_identity: "PSK-{{ inventory_hostname }}" - tls_psk: "4e616d656461706c617965722072616e646f6d6b65792067656e657261746564" # Example PSK + tls_psk_identity: PSK-{{ inventory_hostname }} + tls_psk: 4e616d656461706c617965722072616e646f6d6b65792067656e657261746564 auth: "{{ auth_response.json.result }}" id: 1 - register: zabbix_host_response - delegate_to: localhost - when: auth_response.json.result is defined - name: Check Zabbix agent status - service: + become: true + ansible.builtin.service: name: zabbix-agent state: started - become: true diff --git a/show_portforwarding_rules.yml b/show_portforwarding_rules.yml index f44eb54..79bfca8 100644 --- a/show_portforwarding_rules.yml +++ b/show_portforwarding_rules.yml @@ -1,17 +1,17 @@ --- - name: Retrieve and display UniFi port forwarding rules hosts: localhost - gather_facts: no + gather_facts: false tasks: - name: Get port forwarding rules unifi_portforward_module: - controller_url: "https://192.168.1.237:8443" - username: "alex_mormor@hotmail.com" - password: "aaseiswild123" - site_id: "default" + controller_url: https://192.168.1.237:8443 + username: alex_mormor@hotmail.com + password: aaseiswild123 + site_id: default mfa_token: "{{ lookup('password', 'Enter your MFA token: ') }}" register: result - name: Display port forwarding rules - debug: + ansible.builtin.debug: var: result.portforwarding_rules diff --git a/shutdown_windows.yml b/shutdown_windows.yml index 6de10ae..f1e4802 100644 --- a/shutdown_windows.yml +++ b/shutdown_windows.yml @@ -1,3 +1,4 @@ +--- #playbook - name: Playbook useing the role shutdown-role on windows servers hosts: windows diff --git a/test_zabbix_connection.yml b/test_zabbix_connection.yml index b062854..9dc4cd2 100644 --- a/test_zabbix_connection.yml +++ b/test_zabbix_connection.yml @@ -1,11 +1,11 @@ --- - name: Test Zabbix API connection hosts: localhost - gather_facts: no + gather_facts: false tasks: - name: Set API token ansible.builtin.set_fact: - ansible_zabbix_auth_key: "6965e0d3bf4416a15ce750e7dba47933d3dfc988d99d866291b0f2d55845bb05" + ansible_zabbix_auth_key: 6965e0d3bf4416a15ce750e7dba47933d3dfc988d99d866291b0f2d55845bb05 - name: Configure HTTPAPI connection ansible.builtin.set_fact: @@ -14,10 +14,10 @@ - name: Test Zabbix API connection community.zabbix.zabbix_api_info: - http_login_user: "Admin" - http_login_password: "zabbix" + http_login_user: Admin + http_login_password: zabbix register: result - name: Debug Zabbix API version - debug: + ansible.builtin.debug: var: result diff --git a/unifi-dhcp-clients-list.yml b/unifi-dhcp-clients-list.yml index f44eb54..79bfca8 100644 --- a/unifi-dhcp-clients-list.yml +++ b/unifi-dhcp-clients-list.yml @@ -1,17 +1,17 @@ --- - name: Retrieve and display UniFi port forwarding rules hosts: localhost - gather_facts: no + gather_facts: false tasks: - name: Get port forwarding rules unifi_portforward_module: - controller_url: "https://192.168.1.237:8443" - username: "alex_mormor@hotmail.com" - password: "aaseiswild123" - site_id: "default" + controller_url: https://192.168.1.237:8443 + username: alex_mormor@hotmail.com + password: aaseiswild123 + site_id: default mfa_token: "{{ lookup('password', 'Enter your MFA token: ') }}" register: result - name: Display port forwarding rules - debug: + ansible.builtin.debug: var: result.portforwarding_rules diff --git a/verify_ssh.yml b/verify_ssh.yml index 9fa86d5..4adb2b6 100644 --- a/verify_ssh.yml +++ b/verify_ssh.yml @@ -10,7 +10,7 @@ - name: Print version for network devices when: ansible_network_os is defined - debug: + ansible.builtin.debug: msg: "{{ result.stdout }}" - name: Gather facts for regular servers diff --git a/wake-and-update-ubuntu.yml b/wake-and-update-ubuntu.yml index 2ca1d01..28d426c 100644 --- a/wake-and-update-ubuntu.yml +++ b/wake-and-update-ubuntu.yml @@ -1,39 +1,39 @@ ---- - - name: Update and Shutdown Ubuntu Server - hosts: ubuntu_server - become: yes - gather_facts: no - - tasks: - - name: Wake up the server using Wake-on-LAN - local_action: - module: wakeonlan - mac: "MAC_ADDRESS_HERE" - broadcast: "BROADCAST_ADDRESS_HERE" - delegate_to: localhost - - - name: Wait for the server to come online - wait_for: - host: "{{ inventory_hostname }}" - port: 22 - state: started - timeout: 300 - - - name: Update all packages to the latest version - apt: - update_cache: yes - upgrade: dist - autoremove: yes - autoclean: yes - - - name: Reboot the server - reboot: - - - name: Check if updates were successful - command: apt list --upgradable - register: upgradable_packages - changed_when: false - failed_when: upgradable_packages.stdout != "" - - - name: Shut down the server - command: shutdown now +--- +- name: Update and Shutdown Ubuntu Server + hosts: ubuntu_server + become: true + gather_facts: false + + tasks: + - name: Wake up the server using Wake-on-LAN + local_action: + module: community.general.wakeonlan + mac: MAC_ADDRESS_HERE + broadcast: BROADCAST_ADDRESS_HERE + delegate_to: localhost + + - name: Wait for the server to come online + ansible.builtin.wait_for: + host: "{{ inventory_hostname }}" + port: 22 + state: started + timeout: 300 + + - name: Update all packages to the latest version + ansible.builtin.apt: + update_cache: true + upgrade: dist + autoremove: true + autoclean: true + + - name: Reboot the server + ansible.builtin.reboot: + + - name: Check if updates were successful + register: upgradable_packages + changed_when: false + failed_when: upgradable_packages.stdout != "" + ansible.builtin.command: apt list --upgradable + + - name: Shut down the server + ansible.builtin.command: shutdown now diff --git a/zabbix-agent.yml b/zabbix-agent.yml index 1e2f3bf..a060ec6 100644 --- a/zabbix-agent.yml +++ b/zabbix-agent.yml @@ -1,6 +1,6 @@ --- - name: Ensure Zabbix agent is installed and configured hosts: all - gather_facts: yes + gather_facts: true roles: - zabbix_agent diff --git a/zabbix-host.yml b/zabbix-host.yml index 6996d63..6e1f6dd 100644 --- a/zabbix-host.yml +++ b/zabbix-host.yml @@ -1,39 +1,41 @@ --- - name: Create or update a Zabbix host hosts: all - gather_facts: yes + gather_facts: true tasks: - name: Authenticate with Zabbix API - uri: - url: "http://192.168.1.24/api_jsonrpc.php" + register: auth_response + delegate_to: localhost + ansible.builtin.uri: + url: http://192.168.1.24/api_jsonrpc.php method: POST body_format: json headers: - Content-Type: "application/json" + Content-Type: application/json body: jsonrpc: "2.0" - method: "user.login" + method: user.login params: - username: "Admin" - password: "zabbix" + username: Admin + password: zabbix id: 1 - register: auth_response - delegate_to: localhost - name: Debug auth response - debug: + ansible.builtin.debug: var: auth_response - name: Create or update a host in Zabbix - uri: - url: "http://192.168.1.24/api_jsonrpc.php" + delegate_to: localhost + when: auth_response.json.result is defined + ansible.builtin.uri: + url: http://192.168.1.24/api_jsonrpc.php method: POST body_format: json headers: - Content-Type: "application/json" + Content-Type: application/json body: jsonrpc: "2.0" - method: "host.create" + method: host.create params: host: "{{ inventory_hostname }}" interfaces: @@ -44,14 +46,12 @@ dns: "" port: "10050" groups: - - groupid: "2" # Group ID for "Linux servers" + - groupid: "2" templates: - - templateid: "10001" # Template ID for "Template OS Linux" + - templateid: "10001" tls_connect: 2 tls_accept: 2 - tls_psk_identity: "PSK-{{ inventory_hostname }}" - tls_psk: "4e616d656461706c617965722072616e646f6d6b65792067656e657261746564" # Example PSK + tls_psk_identity: PSK-{{ inventory_hostname }} + tls_psk: 4e616d656461706c617965722072616e646f6d6b65792067656e657261746564 auth: "{{ auth_response.json.result }}" id: 1 - delegate_to: localhost - when: auth_response.json.result is defined diff --git a/zabbix_network.yml b/zabbix_network.yml index d42e9e1..5f347e3 100644 --- a/zabbix_network.yml +++ b/zabbix_network.yml @@ -4,20 +4,20 @@ become: true tasks: - name: Open firewall port 10050 for Zabbix agent (Debian) - ansible.builtin.ufw: + when: ansible_os_family == "Debian" + community.general.ufw: rule: allow port: 10050 proto: tcp - when: ansible_os_family == "Debian" - name: Open firewall port 10050 for Zabbix agent (RedHat) - firewalld: + when: ansible_os_family == "RedHat" + ansible.posix.firewalld: service: zabbix-agent port: 10050/tcp permanent: true state: enabled immediate: true - when: ansible_os_family == "RedHat" - name: Restart firewall to apply changes (Debian) ansible.builtin.service: