我假装在一个带有 ansible 的 docker 容器中执行一个 bash 文件。第一个任务是成功的。
我的任务:
- name: Copy tickscripts
copy:
src: /home/debian/github/tick_playbook/roles/alertas
dest: /var/lib/docker/volumes/kapacitor_storage/_data/
- name: Execute tickscripts
shell: bash /var/lib/docker/volumes/kapacitor_storage/_data/alertas/run_alertas.sh
容器名称:tick_kapacitor 体积容器:kapaciotr_sotage
运行剧本,1个任务就可以了
root@teste:/# cat /var/lib/docker/volumes/kapacitor_storage/_data/alertas/
run_alertas.sh tasks/ tickscripts/
root@teste:/# cat /var/lib/docker/volumes/kapacitor_storage/_data/alertas/
#
我也尝试:
- name: Execute tickscripts
shell: docker exec -ti tick_kapacitor /bin/bash var/lib/kapacitor/alertas/run_alertas.sh
回复:
TASK [alertas : Execute tickscripts] *******************************************
fatal: [192.168.85.79]: FAILED! => {"changed": true, "cmd": "docker exec -ti tick_kapacitor /bin/bash var/lib/kapacitor/alertas/run_alertas.sh", "delta": "0:00:00.043861", "end": "2019-03-18 17:52:50.542327", "failed": true, "rc": 1, "start": "2019-03-18 17:52:50.498466", "stderr": "the input device is not a TTY", "stdout": "", "stdout_lines": [], "warnings": []}
to retry, use: --limit @/home/debian/github/tick_playbook/teste.retry
我走到机器前放
docker exec -ti tick_kapacitor /bin/bash var/lib/kapacitor/alertas/run_alertas.sh
回复:
var/lib/kapacitor/alertas/tickscripts/cpu99_alert_stream.tick