Skip to content

Instantly share code, notes, and snippets.

View cognifloyd's full-sized avatar

Jacob Floyd cognifloyd

  • Garland, TX
  • 22:00 (UTC -05:00)
View GitHub Profile
@cognifloyd
cognifloyd / inventory.yaml
Created November 20, 2018 18:42
jinja2_native & ansible-vault encrypted strings
---
ungrouped:
hosts:
localhost:
ansible_connection: local
ansible_python_interpreter: /usr/bin/python2
@cognifloyd
cognifloyd / playbook output
Last active November 20, 2018 17:42
part of playbook output showing a type_debug|value of var and then the error displayed when using that var with the group module
________________________________________
< TASK [theatro-noc.share_drive : debug] >
----------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
task path: /home/cognifloyd/p/theatro-ansiblehost/ansible-playbooks.git/roles/theatro-noc.share_drive/tasks/Linux.yaml:35
$ time (git clone git@github.com:cognifloydtest/ansible-st2.git ansible-st2.git); cd ansible-st2.git; time (for role in roles/*; do echo; echo $role; git checkout master; splitsh-lite --progress --prefix $role --target=refs/heads/ansible-role-${role##*/}; git checkout ansible-role-${role##*/}; hub create cognifloydtest/ansible-role-${role##*/}; git remote add ansible-role-${role##*/} git@github.com:cognifloydtest/ansible-role-${role##*/}.git -t master; git push ansible-role-${role##*/} -u ansible-role-${role##*/}:master; done; git checkout master)
Cloning into 'ansible-st2.git'...
remote: Counting objects: 3576, done.
remote: Compressing objects: 100% (31/31), done.
remote: Total 3576 (delta 19), reused 30 (delta 11), pack-reused 3529
Receiving objects: 100% (3576/3576), 543.84 KiB | 2.12 MiB/s, done.
Resolving deltas: 100% (1909/1909), done.
( git clone git@github.com:cognifloydtest/ansible-st2.git) 0.08s user 0.05s system 8% cpu 1.411 total
roles/bwc
from __future__ import print_function
import eventlet
eventlet.monkey_patch()
import argparse
from nclib import TCPServer, Netcat, NetcatError, NetcatTimeout
---
# StackStorm auth
st2_auth_enable: yes
# Save credentials under /root/.st2/config
st2_save_credentials: yes
st2_auth_username: st2admin
st2_auth_password: "{{ lookup('password', '{{ my_creds_dir }}/st2-' + inventory_hostname + '-' + st2_auth_username + ' length=42' ) }}"
# MongoDB
st2mongo_db: st2
@cognifloyd
cognifloyd / 1current.yaml
Last active August 5, 2017 22:43
tasks in a role, current solution and approximated solution
- name: See if authentication is enabled in mongod.conf
check_mode: yes
lineinfile:
path: /etc/mongod.conf
insertafter: 'security:'
line: ' authorization: enabled'
register: mongo_authorization
- name: Add mongo admin when authorization is disabled
mongodb_user:
@cognifloyd
cognifloyd / pxssh.py
Created July 16, 2017 04:49
pxssh modified to support preexec_fn, dimensions, and config_file options.
from __future__ import print_function
import os
from pexpect import TIMEOUT, EOF, spawn
from pexpect.pxssh import pxssh as orig_pxssh, ExceptionPxssh
__all__ = ['ExceptionPxssh', 'pxssh']
@cognifloyd
cognifloyd / extra_vars.yaml
Created June 22, 2017 21:34
Testing AnsibleBaseRunner
-
name: key_value
test:
- key1=value1
- "key2=value2"
expected:
- "key1=value1 key2=value2"
-
name: at_file
test:
@cognifloyd
cognifloyd / test_actions_lib_ansiblebaserunner.py
Created June 21, 2017 23:34
testing the actions/lib/ansible_base.py:AnsibleBaseRunner._parse_extra_vars()
from __future__ import print_function
import unittest
import yaml
from mock import patch
from lib.ansible_base import AnsibleBaseRunner
# skipping everything above the next line
php composer.phar require --no-progress --no-interaction 'typo3/doctools:dev-master'
FLOW_CONTEXT=Production ./flow typo3.flow:cache:flush
FLOW_CONTEXT=Production ./flow typo3.flow:cache:warmup
FLOW_CONTEXT=Production ./flow typo3.doctools:commandreference:rendercollection Flow
FLOW_CONTEXT=Production ./flow typo3.doctools:reference:rendercollection Flow
# run this in Development - Production doesn't have the needed reflection data