Skip to content

Instantly share code, notes, and snippets.

Avatar

James Cammarata jimi-c

View GitHub Profile
View gist:14674383ae5e18cfdb75241c5c1cf9fc
00:25:19.831 utils.py DEBUG task path: /home/jamesc/devel/menufaire_api/roles/menufaire-api/tasks/main.yml:2
00:25:19.831 utils.py ERROR [WARNING]: Failure using method (v2_playbook_on_task_start) in callback plugin (<ansible.plugins.callback./usr/lib/python3.6/site-
00:25:19.832 utils.py ERROR packages/ansible_bender-0.4.0-py3.6.egg/ansible_bender/callback_plugins/snapshoter.CallbackModule object at 0x7f935af45f50>): 'list' object has no attribute 'copy'
00:25:19.832 utils.py DEBUG Callback Exception:
00:25:19.832 utils.py DEBUG File "/data/devel/ansible/lib/ansible/executor/task_queue_manager.py", line 328, in send_callback
00:25:19.832 utils.py DEBUG method(*new_args, **kwargs)
00:25:19.832 utils.py DEBUG File "/usr/lib/python3.6/site-packages/ansible_bender-0.4.0-py3.6.egg/ansible_bender/callback_plugins/snapshoter.py", line 104, in v2_playbook_on_task_start
00:25:19.832 utils.py DEBUG return self._maybe_load_fr
View gist:d6d091a452c2c41f26864468b53a8ae6
commit 03c6b73e84ec1550c0be800d841af62df0ba1459 (HEAD -> master, upstream/master)
Author: James Cammarata <jimi@sngx.net>
Date: Thu Sep 27 00:38:18 2018 -0500
Adding haproxy load balancer for the mysql cluster
This proxy is available via a NodePort service, which can be accessed
from minikube with the `minikube service galera-haproxy-service --url`
command.
View gist:77f44584a40556ff88a23de299e29f81
$ ansible -m uri -a "url=http://localhost:8888/whatever follow_redirects=yes" localhost
localhost | FAILED! => {
"changed": false,
"content": "",
"failed": true,
"location": "file:///etc/passwd",
"msg": "Status code was not [200]: HTTP Error 301: Found - Redirection to url 'file:///etc/passwd' is not allowed",
"redirected": false,
"status": 301,
"url": "http://localhost:8888/whatever"
View gist:8590c87fa4cad93d0135
# ansible-playbook -vv 13712.yml
Using /etc/ansible/ansible.cfg as config file
1 plays in 13712.yml
PLAY ***************************************************************************
TASK [setup] *******************************************************************
ok: [localhost]
TASK [user] ********************************************************************
View gist:b38f3a2d9b7ced1f9ead
- hosts: localhost
gather_facts: no
tasks:
- command:
_raw_params: echo "hello world"
View gist:c2f1bd2748fb7700a2d7
import cStringIO
import multiprocessing
import os
import pickle
import struct
import sys
import zlib
class MyProcess(multiprocessing.Process):
def __init__(self, s):
View gist:9b0248a79f1068b30a0f
# ansible-playbook -vv samples/test_blocks_of_blocks.yml
Using /etc/ansible/ansible.cfg as config file
1 plays in samples/test_blocks_of_blocks.yml
PLAY ***************************************************************************
TASK [debug msg=are we there yet?] *********************************************
ok: [localhost] => {
"changed": false,
"msg": "are we there yet?"
View gist:afba796f0177d431e34f

Playbook:

- hosts: all
  gather_facts: no
  remote_user: root
  roles:
  - { role: test_become_r2, sudo_user: testing }
  tasks:
  - command: whoami
View gist:b489a515e0a7b3c64f3c
diff --git a/cloud/docker/docker.py b/cloud/docker/docker.py
index ba0828d..1417da0 100644
--- a/cloud/docker/docker.py
+++ b/cloud/docker/docker.py
@@ -781,7 +781,7 @@ class DockerManager(object):
return containers
- def restart_named_container(self, existing_container):
+ def should_restart_named_container(self, existing_container):
View gist:684612137d29a90b085f
def check_systemd(name):
# verify service is managed by systemd
systemd_enabled = 'false'
f = open('/proc/1/cmdline', 'r')
for line in f:
if 'systemd' in line:
return True
return False