hiddenwaffle / jinx

Sandbox for Jenkins + Ansible experimentation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jinx

Jenkins

From the repository root:

docker run --user 0 --rm --privileged -p 8080:8080 -p 50000:50000 -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -v $PWD/jenkins_home:/var/jenkins_home -v $PWD:/app jenkins/jenkins:2.263.2-lts

Plugins

  1. Pipeline
  2. Docker Pipeline
  3. Git

Credentials

  • Go to the global credentials store
  • Add a secret text named credential1
  • Add a private key named hepburn-pk using the contents of .vagrant/machines/hepburn/virtualbox/private_key
  • Add a private key named peck-pk using the contents of .vagrant/machines/peck/virtualbox/private_key
  • Update the ecdsa-sha2-nistp256 public keys of both servers in the Dockerfile
    • ssh-keyscan -p 2222 hepburn.local
      ssh-keyscan -p 2200 peck.local
      

Ansible

Manual steps

Add to /etc/hosts

127.0.0.1 hepburn.local
127.0.0.1 peck.local

Example commands

Not all of these still work. A lot of the referenced files have been renamed or moved.

poetry run ansible -i hosts.yml roman -m ping
poetry run ansible -i hosts.yml roman -a 'free -h'
poetry run ansible -i hosts.yml roman -a 'hostname'
poetry run ansible -i hosts.yml roman -a 'hostname' -f 1
poetry run ansible -i hosts.yml roman -m setup
poetry run ansible -i hosts.yml roman -m stat -a 'path=/etc/environment'
poetry run ansible -i hosts.yml roman -m copy -a 'src=./README.md dest=/tmp'
poetry run ansible -i hosts.yml roman -m fetch -a 'src=/etc/hosts dest=/tmp'

poetry run ansible -i hosts.yml roman -B 100 -P 0 -a "sleep 5"
poetry run ansible -i hosts.yml peck.local -m async_status -a "jid=158428745974.24136"

poetry run ansible -i hosts.yml roman -b -a 'tail /var/log/messages'
poetry run ansible -i hosts.yml roman -b -m shell -a 'tail /var/log/messages | grep ansible-command | wc -l'

poetry run ansible-playbook playbooks/test_set_variable.yml

poetry run ansible -i 'localhost,' localhost --connection=local -m debug -a 'msg="Hello World"'

poetry run ansible -i inventory/hosts.yml roman -a 'who am i'
poetry run ansible -i inventory/hosts.yml roman -l hepburn.local -a 'who am i'
poetry run ansible -i inventory/hosts.yml roman -l hepburn.local -a 'who am i' --private-key=.vagrant/machines/hepburn/virtualbox/private_key


About

Sandbox for Jenkins + Ansible experimentation


Languages

Language:Groovy 68.2%Language:Python 18.9%Language:Dockerfile 12.9%