#!/usr/bin/env python3 from chibi.command import yum from chibi.command.echo import cowsay from chibi.file.snippets import inflate_dir from chibi.file import Chibi_file file_check_path = inflate_dir( '~/provision_installed' ) file_check = Chibi_file( file_check_path ) version_to_check = "essential 1\n".format( file=__file__, ) if __name__ == "__main__" and not version_to_check in file_check: cowsay( "Starting install for essential" ) yum.install( 'bash-completion', 'bash-completion-extras', 'texinfo', 'vim', 'ruby', 'git', 'kernel-headers', 'kernel-devel', 'htop' ) file_check.append( version_to_check ) cowsay( "Ending install for essential" )
'active_state', 'No')) try: response = requests.get(url) except: time.sleep(10) continue if (status == 'active' and str(response.status_code) == '200'): break time.sleep(10) print(status) print(response.status_code, response.text) print(requests.get(url).text) f = Chibi_file(join(FOLDER_PROVISION, "resource_event.template.json")) j = f.read_json() r = requests.put("{}/_template/turn_api__api_event".format(url), json=j, headers=headers) print(r.text) f = Chibi_file(join(FOLDER_PROVISION, "background_check.template.json")) j = f.read_json() r = requests.put("{}/_template/turn_api__background_checks".format(url), json=j, headers=headers) print(r.text) f = Chibi_file(join(FOLDER_PROVISION, "county.template.json")) j = f.read_json()
#!/usr/bin/env python3 import sys from datetime import datetime from chibi.file import Chibi_file, Chibi_path path = Chibi_path( __file__ ) f = Chibi_file( ( path + "wpa_cli" ) + "wpa_cli" ) date = datetime.utcnow() event = ",".join( sys.argv[1:] ) final_even = "{}\t{}\n".format( date.isoformat(), event ) f.append( final_even )
#!/usr/bin/env python3 from chibi.command import yum, systemctl, command from chibi.command.echo import cowsay from chibi.file import Chibi_file from chibi.file.snippets import inflate_dir file_check_path = inflate_dir('~/provision_installed') file_check = Chibi_file(file_check_path) version_to_check = "redis\n".format(file=__file__, ) if __name__ == "__main__" and not version_to_check in file_check: cowsay("instalado redis") yum.install('redis') systemctl.start("redis") systemctl.enable("redis") cowsay("termino de instalar redis") result, error, return_code = command('redis-cli', 'ping', stdout='pipe') cowsay("redis ping say: {}".format(result)) file_check.append(version_to_check)
#!/usr/bin/env python3 from chibi.command.echo import cowsay from chibi.file.snippets import join from chibi.file import Chibi_file provision_folder = '/vagrant/provision' file_host = 'hosts' dest = '/etc/hosts' if __name__ == "__main__": cowsay( "copy hosts file" ) origin_hosts = Chibi_file( join( provision_folder, file_host ) ) origin_hosts.copy( dest ) cowsay( "ending copy hosts file" )