Skip to content

Instantly share code, notes, and snippets.

@udhos
Last active May 17, 2018 21:49
Show Gist options
  • Save udhos/aedbcf9ae89496ef17c944d78c75e8fa to your computer and use it in GitHub Desktop.
Save udhos/aedbcf9ae89496ef17c944d78c75e8fa to your computer and use it in GitHub Desktop.
ansible/playbook-staticweb.yml
Usage:
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -e 'host_key_checking=False' -i ansible/hosts ansible/playbook-staticweb.yml --key-file keyfile --extra-vars repo_crede
ntials=user:pwd
more ansible/hosts
---
- hosts: Web
vars:
workspace: "{{ lookup('env','WORKSPACE') }}"
tasks:
- name: create sandbox dir
become: yes
file:
path: /home/cliqruser/sandbox
state: directory
- name: copy staticweb binary
become: yes
copy:
remote_src: no
src: "{{ workspace }}/staticweb"
dest: /home/cliqruser/staticweb
owner: cliqruser
group: cliqruser
mode: a+x
- name: copy staticweb.service
become: yes
copy:
remote_src: no
src: "{{ workspace }}/staticweb.service"
dest: /etc/systemd/system/staticweb.service
- name: restart staticweb service
become: yes
systemd:
name: staticweb.service
enabled: yes
state: restarted
daemon_reload: yes
- hosts: Balancer
vars:
workspace: "{{ lookup('env','WORKSPACE') }}"
tasks:
- name: download gobetween binary from nexus repo
become: yes
get_url:
url: "http://{{ repo_credentials }}@repo.domain.com:8080/repository/staticweb/gobetween/gobetween"
dest: /home/cliqruser/gobetween
owner: cliqruser
group: cliqruser
mode: a+x
- name: copy gobetween config
become: yes
copy:
remote_src: no
src: "{{ workspace }}/gobetween.toml"
dest: /home/cliqruser/gobetween.toml
owner: cliqruser
group: cliqruser
mode: a+x
- name: copy gobetween.service
become: yes
copy:
remote_src: no
src: "{{ workspace }}/gobetween.service"
dest: /etc/systemd/system/gobetween.service
- name: restart gobetween service
become: yes
systemd:
name: gobetween.service
enabled: yes
state: restarted
daemon_reload: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment