You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.9 KiB
YAML
72 lines
1.9 KiB
YAML
---
|
|
|
|
- name: Install required dependencies
|
|
apt:
|
|
state: present
|
|
name:
|
|
- git
|
|
- nginx-extras
|
|
- openjdk-8-jdk-headless
|
|
update_cache: yes
|
|
|
|
# TODO Role for Git Username / Password Configuration
|
|
|
|
- name: Configure git to use credential helper
|
|
become_user: "{{ spotme_system_user }}"
|
|
git_config:
|
|
scope: global
|
|
name: credential.helper
|
|
value: store
|
|
|
|
- name: Encode username for SpotMe remote source
|
|
become_user: "{{ spotme_system_user }}"
|
|
command: "perl -p -e 's/%(..)/%\\L\\1\\E/g'"
|
|
args:
|
|
stdin: "{{ spotme_remote_user | urlencode }}"
|
|
register: remote_user_encoded
|
|
changed_when: False
|
|
|
|
- name: Encode password for SpotMe remote source
|
|
become_user: "{{ spotme_system_user }}"
|
|
command: "perl -p -e 's/%(..)/%\\L\\1\\E/g'"
|
|
args:
|
|
stdin: "{{ spotme_remote_pass | urlencode }}"
|
|
register: remote_pass_encoded
|
|
changed_when: False
|
|
|
|
- name: Store credentials for SpotMe remote source
|
|
become_user: "{{ spotme_system_user }}"
|
|
lineinfile:
|
|
path: "~/.git-credentials"
|
|
line: "{{ spotme_remote_addr | urlsplit('scheme') }}://{{ remote_user_encoded.stdout }}:{{ remote_pass_encoded.stdout }}@{{ spotme_remote_addr | urlsplit('hostname') }}"
|
|
create: yes
|
|
|
|
# TODO Remove force
|
|
- name: Clone SpotMe Repository
|
|
become_user: "{{ spotme_system_user }}"
|
|
git:
|
|
repo: "{{ spotme_remote_addr }}"
|
|
dest: "{{ spotme_installation_directory }}"
|
|
version: "{{ spotme_version }}"
|
|
force: yes
|
|
register: git_spotme
|
|
|
|
# TODO Add changed detection
|
|
- name: Build SpotMe
|
|
become_user: "{{ spotme_system_user }}"
|
|
command: npm run-script build
|
|
args:
|
|
chdir: "{{ spotme_installation_directory }}"
|
|
notify: restart spotme
|
|
|
|
- name: Register service for SpotMe
|
|
template:
|
|
src: spotme.service
|
|
dest: "{{ global_systemd_configuration_directory }}/{{ spotme_service_name }}"
|
|
owner: root
|
|
group: root
|
|
mode: "u=rw,g=r,o="
|
|
notify:
|
|
- reload systemd
|
|
- restart spotme
|