diff --git a/playbooks/roles/cronjob/tasks/main.yml b/playbooks/roles/cronjob/tasks/main.yml index 11c40c2..bb21cc0 100644 --- a/playbooks/roles/cronjob/tasks/main.yml +++ b/playbooks/roles/cronjob/tasks/main.yml @@ -1,5 +1,5 @@ - name: backup old crontab - shell: crontab -l > ~/backup.cron + shell: crontab -l > ~/backup.cron 2> /dev/null || true - name: copy image-clean script copy: diff --git a/playbooks/roles/swarm-manage/templates/swarm-agent.service.j2 b/playbooks/roles/swarm-manage/templates/swarm-agent.service.j2 index 953d05e..06ba5a2 100644 --- a/playbooks/roles/swarm-manage/templates/swarm-agent.service.j2 +++ b/playbooks/roles/swarm-manage/templates/swarm-agent.service.j2 @@ -12,6 +12,7 @@ ExecStart=/usr/bin/docker run \ --addr={{ node_ip }}:{{ docker_port }} \ etcd://{{ node_ip }}:{{ etcd_client_port }}/lain/swarm ExecStop=/bin/bash -c '/usr/bin/docker stop %n || true' +Restart=on-failure [Install] WantedBy=multi-user.target