Skip to content

Instantly share code, notes, and snippets.

View sshnaidm's full-sized avatar
🍺
it's coding

Sergey sshnaidm

🍺
it's coding
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
---
- hosts: centos
gather_facts: false
tasks:
- name: Create files with copy content module
copy:
content: |
test file {{ item }}
dest: ~/file_{{item}}
with_sequence: start=1 end={{ n }}
---
- hosts: all
gather_facts: false
tasks:
- name: Create files with copy content module
copy:
src: "file_{{ item }}"
dest: ~/file_{{item}}
with_sequence: start=1 end={{ n }}
[defaults]
strategy = mitogen_linear
strategy_plugins = /usr/lib/python2.7/site-packages/ansible_mitogen/plugins/strategy
export ANSIBLE_STRATEGY_PLUGINS=/usr/lib/python2.7/site-packages/ansible_mitogen/plugins/strategy
export ANSIBLE_STRATEGY=mitogen_linear
---
- hosts: all
gather_facts: false
tasks:
- name: Install packages
package:
name:
- samba
- httpd
- nano
@sshnaidm
sshnaidm / a.yml
Last active May 25, 2019 13:38
for medium
- hosts: all
gather_facts: false
tasks:
- name: Install packages
become: true
package:
name:
- samba
- httpd
- nano
@sshnaidm
sshnaidm / influxdb_query
Created August 20, 2018 08:55
InfluxDB query via HTTP
curl -G 'http://localhost:8086/query' --data-urlencode "db=telegraf" --data-urlencode "epoch=ms" --data-urlencode "q=SELECT count(\"result_num\") FROM \"build\" WHERE ("pipeline" = 'gate' AND "passed" = 'False') AND time >= now() - 24h"
@sshnaidm
sshnaidm / ShellPipefail.py
Created April 26, 2018 11:12
Include pipefail in ansible shell command if there is pipe
from ansiblelint import AnsibleLintRule
def uncorrect_task(task, cmd):
if 'shell' not in task:
return False
if 'register' in task:
return False
if task.get('ignore_errors'):
return False
export VIRTHOST=#IP of your virthost
git clone https://github.com/openstack/tripleo-quickstart-extras
cd tripleo-quickstart-extras
git fetch https://git.openstack.org/openstack/tripleo-quickstart-extras refs/changes/29/543429/13 && git checkout FETCH_HEAD
echo -e "[virthost]\n$VIRTHOST" > /tmp/host
# Provision nodes
ansible-playbook -vv -i /tmp/host ../playbooks/libvirt-multinode.yml # -e network_vms="bridge=br0" or -e network_vms="network=default" for default NATed network