Skip to content

Instantly share code, notes, and snippets.

View dagwieers's full-sized avatar
⌨️
Typing...

Dag Wieers dagwieers

⌨️
Typing...
View GitHub Profile
@dagwieers
dagwieers / gist:5994177
Last active March 28, 2016 19:55
Testing ansible_connection=local
[dag@moria ~]$ cat hosts
localhost ansible_connection=local
[dag@moria ~]$ ansible -i hosts localhost -m ping
localhost | success >> {
"changed": false,
"ping": "pong"
}
[dag@moria ~]$ ansible -vv -i hosts localhost -m ping
<localhost> REMOTE_MODULE ping
- hosts: computer61
gather_facts: no
tasks:
- win_regedit:
key: HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
value: SMB1
data: 0xffffffff
datatype: dword
state: present
@dagwieers
dagwieers / gist:d52dcfa41ed417352435cd783dbe0903
Created July 4, 2017 20:36
Using the same playbook with diff mode
PLAY [computer61] ************************************************************************************************************************
TASK [win_regedit] ***********************************************************************************************************************
[HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters]
-"SMB1" = "dword:0"
+"SMB1" = "dword:4294967295"
changed: [computer61]
TASK [win_regedit] ***********************************************************************************************************************
ok: [computer61]
[dag@moria ansible.git]$ test/runner/ansible-test integration wakeonlan --tox --python 2.7 -vvv>>> Metadata: metadata-iVbhQs.json
{'cloud_config': {}, 'changes': {}}
Run command: tox -c test/runner/tox.ini -e py27 -- /home/dag/home-made/ansible.git/test/runner/test.py integration wakeonlan --python 2.7 -vvv --metadata metadata-iVbhQs.json --color yes --requirements
Working directory: /home/dag/home-made/ansible.git
Program found: /usr/bin/tox
HOME=/home/dag
LC_ALL=en_US.UTF-8
PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/opt/anvers/default/bin:/home/dag/.local/bin:/home/dag/bin
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
py27 installed: appdirs==1.4.3,asn1crypto==0.22.0,bcrypt==3.1.3,cffi==1.10.0,coverage==4.4.1,cryptography==1.9,enum34==1.1.6,idna==2.5,ipaddress==1.0.18,Jinja2==2.9.6,junit-xml==1.7,MarkupSafe==1.0,packaging==16.8,paramiko==2.2.1,pyasn1==0.2.3,pycparser==2.18,PyNaCl==1.1.2,pyparsing==2.2.0,PyYAML==3.12,six==1.10.0
- hosts: localhost
gather_facts: no
tasks:
- name: Blah
aci_interface_policy_leaf_profile:
host: '{{ aci_hostname }}'
username: '{{ aci_username }}'
password: '{{ aci_password }}'
validate_certs: '{{ aci_validate_certs | default(false) }}'
use_ssl: '{{ aci_use_ssl | default(true) }}'
@dagwieers
dagwieers / gist:96708bc3d5d04fbcd6c25e9bfee4da53
Created September 21, 2018 13:23
seealso schema validation
from voluptuous import Schema, Any, Required
schema = Schema([
Any(
{
Required('module'): str,
'description': str,
},
{
Required('ref'): str,
19260 1538698222.91159: no more pending results, returning what we have
19260 1538698222.91179: results queue empty
19260 1538698222.91194: checking for any_errors_fatal
19260 1538698222.91211: done checking for any_errors_fatal
19260 1538698222.91224: checking for max_fail_percentage
19260 1538698222.91237: done checking for max_fail_percentage
19260 1538698222.91250: checking to see if all hosts have failed and the running result is not ok
19260 1538698222.91263: done checking to see if all hosts have failed
19260 1538698222.91275: getting the remaining hosts for this loop
19260 1538698222.91297: done getting the remaining hosts for this loop
ignored_keys = ('hash', 'timestamp')
def filter_items(d):
''' Filter out keys when returning items() '''
l = []
# Ensure we return sorted tuples
for k, v in sorted(d.items()):
if k not in ignored_keys:
l.append((k, v))
return l