Created
August 18, 2017 18:38
-
-
Save acidprime/60bf9f6d2c86c1d357008fbbe34d794f to your computer and use it in GitHub Desktop.
A simple ansible script to deploy a custom docker image to synology
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ansible-playbook -vvv -i mute.wallcity.org, --ask-pass --ask-become-pass | |
################################################ | |
# Manual steps to get this working on synology | |
# Get around sftp chroot | |
# ln -s /var/services/homes /homes | |
# Trust the internet far too much | |
# wget https://bootstrap.pypa.io/get-pip.py | |
# sudo python get-pip.py | |
# Install the actual dependacy | |
# pip install docker-py | |
############################################### | |
- hosts: localhost | |
name: 'Push Zome Updates' | |
connection: local | |
tasks: | |
- name: 'Git to Github' | |
raw: 'git push origin master' | |
- name: 'Git to synology' | |
raw: 'git push ssh://[email protected]:/volume1/docker/zome master' | |
become: no | |
- hosts: 'mute.wallcity.org' | |
name: 'Deploy Zome Updates' | |
gather_facts: no | |
become: yes | |
# pre_tasks: | |
# - shell: ln -s /var/services/homes /homes | |
vars: | |
ansible_ssh_user: admin | |
ansible_ssh_transfer_method: sftp | |
syslog_server: 192.168.53.221 | |
tasks: | |
- name: 'Allow current branch push' | |
command: '/bin/git config receive.denyCurrentBranch ignore' | |
args: | |
chdir: '/volume1/docker/zome/.git' | |
- name: 'Copy Latest Config (.gitignore)' | |
copy: | |
src: "{{ playbook_dir }}/config.yaml" | |
dest: /volume1/docker/zome/config.yaml | |
force: yes | |
- name: 'Reset checkout to master' | |
command: '/bin/git reset HEAD --hard' | |
args: | |
chdir: '/volume1/docker/zome' | |
- name: Rebuild Zome | |
docker_image: | |
name: zome | |
path: /volume1/docker/zome | |
pull: no | |
push: no | |
force: yes | |
#nocache: yes | |
rm: yes | |
- name: Restart Zome | |
docker_container: | |
name: zome-web | |
image: zome:latest | |
state: started | |
restart: yes | |
exposed_ports: | |
- 9663 | |
published_ports: | |
- 9663:9663 | |
log_driver: syslog | |
log_options: | |
syslog-address: "tcp://{{ syslog_server }}:514" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
run as
./deploy.yml
and it will prompt for the passwords.