Skip to content

Instantly share code, notes, and snippets.

def do_until_success_timeout(self, duration_hrs , wait):
starttime = datetime.utcnow
result = {}
patchingstatus = 'inprogress'
max_end_time = datetime.utcnow() + timedelta(hours=duration_hrs)
while datetime.utcnow < max_end_time :
try:
module_return = self._execute_module(module_name='win_apfwcompliance', module_args=module_args, task_vars=task_vars, tmp=tmp)
except:
if isinstance(e, _ReturnResultException):
#!/usr/bin/python
# Make coding more python3-ish, this is required for contributions to Ansible
from __future__ import (absolute_import, division, print_function)
from turtle import delay
__metaclass__ = type
from ansible.errors import AnsibleError, AnsibleConnectionFailure
from ansible.plugins.action import ActionBase
from ansible.utils.display import Display
from datetime import datetime, timedelta
from time import sleep
$servers = import-csv c:\temp\servers.csv
foreach ($server in $servers){
Invoke-WindowsDeploymentCommonTask -computername $server.name -type $server.type
Invoke-SQLDeploymenttask -computername $server.name -conmfigurationtype $server.type
}
@weiyentan
weiyentan / Gitlab pipeline code excerpt
Created August 30, 2020 03:45
Gitlab pipeline list
execute_win_soe_wineventlog:
only:
refs:
- master
variables:
- $CI_COMMIT_TITLE =~ /^winsoe_wineventlog.*/
image: bydos33/awx-cli:latest
stage: winsoe
tags:
- configuration
extra_vars:
vcentre_host: '{ {vcentre_host }}'
vcentre_loginusername: '{ { vcentre_username }}'
vcentre_password: '{ { vcentre_password }}'
injectors:
extra_vars:
vcentre_host: "{% raw %}{ {vcentre_host }}{% endraw %}"
vcentre_loginusername: "{% raw %}{ { vcentre_username }}{% endraw %}"
vcentre_password: "{% raw %}{ { vcentre_password }}{% endraw %}"
---
tower_credential_types:
- name: SSH_Credential
description: Custom SSH Credential
inputs:
fields:
- secret: true
type: string
id: my_private_key
label: "Private Key"
tower_credential:
- name: test
organization: Prometheus
credential_type: 'create Custom SSH Cloud Credential'
description: test
state: present
tower_job_launch:
job_template: "APFW - Helper playbook - Transfer archive to management host"
inventory: "{{ inventory }}"
credential: "{{ tower_jobcredential }}"
limit: "{{ management_server }}"
tower_username: "{{ tower_username }}"
tower_password: "{{ tower_password }}"
tower_verify_ssl: no
extra_vars:
- { management_server: "{{ management_server }}" , search_term: "{{ search_term }}" , destination_logpath: "{{ destination_logpath }}" }
@weiyentan
weiyentan / job_launch_example.yml
Created July 7, 2019 00:54
Tower_job_launch example
- name: Launch Job Template to transfer archive files to management host
tower_job_launch:
job_template: " APFW - Helper playbook - Transfer archive to management host"
inventory: "{{ inventory }}"
credential: "{{ tower_jobcredential }}"
limit: "{{ limit }}"
tower_username: "{{ tower_username }}"
tower_password: "{{ tower_password }}"
tower_verify_ssl: no
extra_vars: