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
| sudo yum -y install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm git | |
| sudo yum -y install ansible | |
| sudo yum -y remove epel-release | |
| echo "host github.com\n\tHostName github.com\n\tIdentityFile /tmp/hackerrankkey\n\tUser git\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config | |
| chmod 640 ~/.ssh/config | |
| git clone https://github.com/defionscode/HR_candidate.git fubar | |
| exit 0 |
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 ansible.module_utils.urls import open_url | |
| import json | |
| def request_json(url, data=None, headers=None, method='GET', use_proxy=True, | |
| force=False, last_mod_time=None, timeout=10, validate_certs=True, | |
| url_username=None, url_password=None, http_agent=None, force_basic_auth=False, ignore_errors=False): | |
| try: | |
| r = open_url(url=url, data=data, headers=headers, method=method, use_proxy=use_proxy, | |
| force=force, last_mod_time=last_mod_time, timeout=timeout, validate_certs=validate_certs, | |
| url_username=url_username, url_password=url_password, http_agent=http_agent, |
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
| Good Afternoon, | |
| Processor Cores = 1 | |
| Available Memory = 1416 | |
| Operating System = RedHat 7.2 | |
| Kernel Version = 3.10.0-327.el7.x86_64 | |
| Virtualization = xen | |
| Private IP = 172.31.2.208 |
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
| require 'rbvmomi' | |
| require 'pry' | |
| module VC::Provision | |
| VIM = RbVmomi::VIM | |
| def clone(other_vm_path, vm_req) | |
| other_vm = datacenter.vmFolder.findByInventoryPath(other_vm_path) | |
| #windows = other_vm.config.guestId.start_with?("windows") | |
| windows = vm_req.operating_system.license |
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
| artifacts: | |
| - url: https://gist.githubusercontent.com/defionscode/ed6294c2eb41bfe7db79/raw/daa4859a1fc2ddf8d9f25bac29e581d2826ff15b/basic_stats.txt | |
| dest: /tmp/myarti | |
| - url: https://bad.endpoint.com/nothing.txt | |
| dest: /tmp/myarti3 |
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
| #!/usr/bin/env python | |
| ''' | |
| EC2 external inventory script | |
| ================================= | |
| Generates inventory that Ansible can understand by making API request to | |
| AWS EC2 using the Boto library. | |
| NOTE: This script assumes Ansible is being executed where the environment |
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
| #!/usr/bin/env python | |
| def main(): | |
| module = AnsibleModule(argument_spec=dict( | |
| # Remove type='path' to make compatible with ansible < 2 | |
| setting_path=dict(required=True, type='path'), | |
| delimiter=dict(required=False, default=':') | |
| )) | |
| path = module.params['setting_path'] | |
| delimiter = module.params['delimiter'] |
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
| # Run Custom module directly Ansible 2.1+ | |
| $ ANSIBLE_MODULE_ARGS='{"state": "present", "access_key_ids": ["LKDLKJLFD"], "access_key_state": "inactive", "name": "pullrequest_testing", "iam_type": "user"}' /path/to/custom_module.py | |
| # Run custom modules directly Ansible < 2.1 | |
| ### custom_module.py | |
| .... | |
| def main(): | |
| if '--interactive' in sys.argv: |
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: Sequential | |
| hosts: localhost | |
| connection: local | |
| vars: | |
| basename: launch_config_ | |
| tasks: | |
| - block: | |
| - include_vars: config_counter.yml |
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: es staging area | |
| file: | |
| path: /opt/es | |
| state: directory | |
| mode: '0755' | |
| become: true | |
| - name: download es | |
| get_url: |