steps
-
run shell from st3
-
create sublime-build file
$ nano bash.sublime-build { "cmd" : ["$file"], "selector" : "source.shell", "shell" : "bash" }
-
-
install ansible
-
use pip
$ pip install -U ansible
-
setup hosts file
$ nano /usr/local/etc/ansible/hosts [docker] dc
-
-
create playbook yml
-
use mysql image
$ nano deploy.yml --- - hosts: docker remote_user: root become: yes gather_facts: no vars: container_name: "forestry" container_image: "mysql:5.5.58" working_dir: "/root/deploy/docker/mysql/forestry" tasks: - name: remove container docker_container: name: "" state: absent - name: create container docker_container: name: "" image: "" volumes: - "/conf:/etc/mysql/" - "/data:/var/lib/mysql" ports: - "33061:3306" env: MYSQL_ROOT_PASSWORD: 123456 command: mysqld --character-set-server=gbk
-
-
run playbook
-
use deploy.sh
$ nano deploy.sh ansible-playbook deploy.yml
-
in st3
press command+b
-