This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Remove nth element from the list | |
debug: | |
msg: | | |
{% set _ = my_list.pop(index) %} | |
{{ my_list }} | |
vars: | |
my_list: [1, 2, 3, 4, 5, 6] | |
index: 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ndef | |
import codecs | |
text_record = ( | |
(ndef.TNF_WELL_KNOWN, ndef.RTD_TEXT, b'id', b'hello world'), | |
(ndef.TNF_WELL_KNOWN, ndef.RTD_TEXT, b'id', b'hello world 2'), | |
(ndef.TNF_URI, ndef.RTD_URI, b'id', b'https://github.com'), | |
) | |
text_message = ndef.new_message(*text_record) | |
text_raw_ndef = text_message.to_buffer() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ndef | |
import codecs | |
text_record = (ndef.TNF_WELL_KNOWN, ndef.RTD_TEXT, b'id', b'hello world') | |
text_message = ndef.new_message(text_record) | |
text_raw_ndef = text_message.to_buffer() | |
encoded_hello_world = codecs.encode(text_raw_ndef, 'hex_codec') | |
decoded_hello_world = codecs.decode(encoded_hello_world, 'hex_codec') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: localhost | |
gather_facts: no | |
vars: | |
name: "abhi" | |
tasks: | |
- name: Print variable | |
debug: | |
msg: "{{ name }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
labels: | |
app: pod6 | |
name: pod6 | |
namespace: default | |
spec: | |
containers: | |
- args: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: admissionregistration.k8s.io/v1 | |
kind: ValidatingWebhookConfiguration | |
metadata: | |
name: "trivy-scanner.example.com" | |
webhooks: | |
- name: "trivy-scanner.example.com" | |
rules: | |
- apiGroups: [""] | |
apiVersions: ["v1"] | |
operations: ["CREATE"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import Popen | |
from flask import Flask, request, jsonify | |
admission_controller = Flask(__name__) | |
@admission_controller.route("/validate", methods=["POST"]) | |
def deployment_webhook(): | |
request_info = request.get_json() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytest | |
import re | |
from six import PY2 | |
def check_solaris_version(filename='/etc/release'): | |
with open(filename) as f: | |
content = f.readlines() | |
for line in content: | |
m = re.match(r'\s+Oracle Solaris (\d+\.\d+).*', line.rstrip()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: mysql-deployment | |
labels: | |
app: mysql | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: localhost | |
gather_facts: no | |
vars_files: | |
- vcenter_vars.yml | |
vars: | |
datastore_name: "DS_117_1" | |
tasks: | |
- name: Provide information about datastore {{ datastore_name }} | |
community.vmware.vmware_datastore_info: |