Skip to content

Instantly share code, notes, and snippets.

@sshnaidm
Last active June 12, 2019 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sshnaidm/53841acabec3fcf229f6864ea040dadd to your computer and use it in GitHub Desktop.
Save sshnaidm/53841acabec3fcf229f6864ea040dadd to your computer and use it in GitHub Desktop.
Ansible podman testing
test ansible_host=test ansible_connection=podman
- hosts: test
connection: podman
tasks:
- name: Install it
package:
name: vim
state: latest
sudo "$(command -v dnf || command -v yum)" install -y git python-virtualenv podman
virtualenv --version || sudo easy_install virtualenv
virtualenv ansible-test
./ansible-test/bin/pip install -U pip
git clone https://github.com/ansible/ansible
cd ansible
git fetch origin pull/57741/head:podmantest
git checkout podmantest
../ansible-test/bin/pip install .
../ansible-test/bin/ansible-playbook --version
curl https://gist.githubusercontent.com/sshnaidm/53841acabec3fcf229f6864ea040dadd/raw/620f7d7a1cdc768c8cd5ea51763ecc7b01353ec8/inventory.ini > inventory.ini
curl https://gist.githubusercontent.com/sshnaidm/53841acabec3fcf229f6864ea040dadd/raw/620f7d7a1cdc768c8cd5ea51763ecc7b01353ec8/playbook.yaml > playbook.yaml
# if centos7 - run as root:
# sudo -i
# curl -o /etc/yum.repos.d/vbatts-shadow-utils-newxidmap-epel-7.repo https://copr.fedorainfracloud.org/coprs/vbatts/shadow-utils-newxidmap/repo/epel-7/vbatts-shadow-utils-newxidmap-epel-7.repo
# yum install -y shadow-utils46-newxidmap
# echo 10000 > /proc/sys/user/max_user_namespaces
# echo "user.max_user_namespaces=28633" > /etc/sysctl.d/userns.conf
# sysctl -p /etc/sysctl.d/userns.conf
# echo "centos:100000:65536" > /etc/subuid
# echo "centos:100000:65536" > /etc/subgid
# yum install -y slirp4netns
podman run -d --name test docker.io/python:3.6-alpine sleep 1d
# check if podman mount is allowed on this platform: `podman mount`, if it is - you shouldn't notice a change, if not - fix should work
../ansible-test/bin/ansible-playbook -vv playbook.yaml -i inventory.ini
podman exec -it test vim --version
# Without pull request
cd
virtualenv ansible-nopr
./ansible-nopr/bin/pip install -U pip
cd ansible-nopr
git clone https://github.com/ansible/ansible
cd ansible
~/ansible-nopr/bin/pip install .
~/ansible-nopr/bin/ansible-playbook --version
curl https://gist.githubusercontent.com/sshnaidm/53841acabec3fcf229f6864ea040dadd/raw/620f7d7a1cdc768c8cd5ea51763ecc7b01353ec8/inventory.ini > inventory.ini
curl https://gist.githubusercontent.com/sshnaidm/53841acabec3fcf229f6864ea040dadd/raw/620f7d7a1cdc768c8cd5ea51763ecc7b01353ec8/playbook.yaml > playbook.yaml
~/ansible-nopr/bin/ansible-playbook -vv playbook.yaml -i inventory.ini
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment