poniedziałek, 13 maja 2019

Ansible - install all necessary packages for python tests on cnetos

---
- hosts: centos
  tasks:
    - name: Install git
      yum:
        name: git
        state: present
      become: true
      become_method: su

    - name: yum install
      yum:
        name: "{{ item }}"
        state: present

      with_items:
        - python36-pip
        - httpd
        - npm
        - python36-paramiko
        - java-1.8.0-openjdk
      become: true
      become_method: su

         
    - name: install python modules
      command: pip3 install {{ item }}
      with_items:
        - allure-behave
        - jsonschema
        - python-dateutil
        - pytz
        - requests
        - simplejson
        - xmltodict

      become: true
      become_method: su

first gocd pipeline - it should look like that

---
format_version: 2
common:
  docker-images-stages-alias: &docker-images-stages-alias
    - build-docker-image:
        jobs:
          build:
            resources:
              - docker
            tasks:
              - exec:
                  command: bash
                  arguments:
                    - -c
                    - test -e $DOCKERFILE_NAME
              - exec:
                  command: bash
                  arguments:
                    - -c
                    - docker build --force-rm -f $DOCKERFILE_NAME -t test/env .
              - exec:
                  command: bash
                  arguments:
                    - -c
                    - docker images
              - exec:
                  command: bash
                  arguments: 
                    - -c
                    - docker tag test/env localhost:5000/test-machine
              - exec:
                  command: bash
                  arguments:
                    - -c
                    - docker push localhost:5000/test-machine

pipelines:
  docker-build:
    group: docker-images
    label_template: "${adapter-git}"
    lock_behavior: unlockWhenFinished
    materials:
      adapter-testy:
        git: git@:event-management/automated-tests.git
        branch: master
        shallow_clone: true
        auto_update: false
        destination: automated-tests
      adapter-git:
        git: git@:bormarek/gocd.git
        branch: master
        shallow_clone: true
        auto_update: true
        destination: gocd
    environment_variables:
      DOCKERFILE_NAME: Dockerfile_alpine
    stages: *docker-images-stages-alias

vpn prep - read certificates from usb drive.

sudo su - apt-get install opensc opensc-pkcs11 gnutls-bin mkdir -p /etc/pkcs11/modules echo "module: /usr/lib/libeTPkcs11.so" >> /etc/pkcs11/modules/.module verify if module is loaded p11-kit list-modules find hardware token p11tool --list-tokens # get url from token where manufacturer ilike safenet find certificates info p11tool --list-all-certs 'full_url_to_token' there should be at least 2 certificates, one of them can be used to authenticate (2nd one is used to encrypt files) connection to vpn: openconnect -c 'full_url_to_cert' --servercert sha256:cert123132123adasdsadasd https://vpn.company.pl

virtualbox script

#!/bin/bash
  for i in `vboxmanage list vms | sed "s/\"\(.*\)\".*/\1/"`
  do
   declare -a vmki=("$i")
   for vm in ${vmki[@]}
  do
  echo -n "starting...." $vm
  echo ""
  sleep 1
  VBoxManage startvm $i --type headless
  done
done

this script will take list all of existing virtualbox insences and start it.


:) I think that im back again

After few adventures i think that i could be online again,


Regards

Marek.