Files
ansible/azure_create-vm-with-rg.yml
2024-07-12 12:58:40 +02:00

83 lines
2.5 KiB
YAML

---
- name: get resource group info
become: true
become_user: root
# become_method: runas
hosts: localhost
roles:
- role: azure_createRG
- role: azure_createwindowsvm
tasks:
- name: make host group from survey hosts list
add_host:
hostname: "{{nic_info.networkinterfaces[0].ip_configurations[0].private_ip_address}}"
#hostname: "{{ hostname }}.adagility.net"
groups: new_group
ansible_connection: winrm
ansible_port: 5985
ansible_winrm_server_cert_validation: ignore
ansible_user: ApeAdmin
ansible_password: "{{password}}"
ansible_winrm_transport: ntlm
#ansible_user: "{{ansible_user}}"
#ansible_password: "{{ansible_password}}"
environment:
- AZURE_CLIENT_ID: 141cd3f9-e466-4086-bfe9-9d6873a84084
- AZURE_SECRET: "{{secret}}"
- AZURE_SUBSCRIPTION_ID: dd4dbc55-c970-4a1f-8ddd-8cb7ae7900dd
- AZURE_TENANT: 03a0b8f2-7896-4d4d-bd81-9d6314ae3e15
- name: Onboard vm
gather_facts: no
hosts: new_group
roles:
- role: win_ping
- role: windows_domain-join
- role: windows_install-check-mk
- role: windows_install-sentinelone
- role: windows_install-laps
- role: windows_install-windirstat
- role: windows_finalize
- name: add host to checkmk
hosts: localhost
become: true
become_user: root
tasks:
- name: Add host
tribe29.checkmk.host:
server_url: "https://monitoringeu.aperam.internal/"
site: "monaperam"
automation_user: "ansible"
automation_secret: "TJXTVH@GFYPRNCJCWUMY"
name: "{{ hostname }}.adagility.net"
validate_certs: false
folder: /
state: present
with_inventory_hostnames:
- checkmk_hosts
- name: "Add newly discovered services on host."
tribe29.checkmk.discovery:
server_url: "https://monitoringeu.aperam.internal/"
site: "monaperam"
automation_user: "ansible"
automation_secret: "TJXTVH@GFYPRNCJCWUMY"
host_name: "{{ hostname }}.adagility.net"
state: "new"
validate_certs: false
with_inventory_hostnames:
- checkmk_hosts
- name: "Activate changes on all sites."
tribe29.checkmk.activation:
server_url: "https://monitoringeu.aperam.internal/"
site: "monaperam"
automation_user: "ansible"
automation_secret: "TJXTVH@GFYPRNCJCWUMY"
force_foreign_changes: 'true'
validate_certs: false
run_once: 'true'