12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #!/usr/bin/env -S ansible-playbook --forks 4 --ask-become-pass
- ---
- - hosts: web
- strategy: host_pinned
- become: yes
- vars:
- slack_token: "{{ lookup('passwordstore', 'majordomo/private/mjru.slack.com/tokens/ansible')}}"
- tasks:
- - copy:
- dest: /root/docker-pull.sh
- content: |
- {% raw %}#!/usr/bin/env bash
- set -e -x
- for repo in $(docker images --format '{{ .Repository }}' | grep -v sysdig); do
- docker pull $repo:master
- done
- {% endraw %}
- - file:
- path: /root/docker-pull.sh
- state: file
- mode: 0750
- - slack:
- token: "{{ slack_token }}"
- msg: "Pull new Docker images on {{ ansible_hostname }}"
- channel: "#git"
- delegate_to: localhost
- - name: docker pull
- command: /root/docker-pull.sh
- tags:
- - run
- - name: stop taskexecutor
- command: stop taskexecutor
- - name: start taskexecutor
- command: start taskexecutor
- - slack:
- token: "{{ slack_token }}"
- msg: "Restart taskexecutor on {{ ansible_hostname }}"
- channel: "#git"
- delegate_to: localhost
|