Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dariko/c9e04f7ae55e1ee9024a8567660ad1a6 to your computer and use it in GitHub Desktop.
Save dariko/c9e04f7ae55e1ee9024a8567660ad1a6 to your computer and use it in GitHub Desktop.
yum remove -y docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce-18.03.1.ce-1.el7.centos
systemctl start docker
docker swarm init
git clone --single-branch -b ansible-modules-core/pull/5547 https://github.com/dariko/ansible/ /usr/src/ansible/
yum install -y epel-release
yum install -y python-pip
pip install virtualenv
virtualenv /root/ansible
. /root/ansible/bin/activate
pip install /usr/src/ansible
pip install docker
cat > /root/test.yml <<EOF
- hosts: localhost
connection: local
tasks:
- name: define myservice
docker_swarm_service:
name: service
image: "busybox"
limit_memory: 20M
reserve_memory: 10M
args:
- "sleep"
- "3600"
register: out
- debug:
var: out
EOF
ansible-playbook /root/test.yml
docker service inspect service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment