31 lines
765 B
YAML
31 lines
765 B
YAML
|
---
|
||
|
- name: check if CockroachDB binary exists
|
||
|
stat:
|
||
|
path: /usr/local/bin/cockroach
|
||
|
register: cockroachdb__exists
|
||
|
|
||
|
- name: CockroachDB Version register
|
||
|
become: yes
|
||
|
shell: "/usr/local/bin/cockroach version 2>&1 | head -n1 | cut -d'v' -f 2"
|
||
|
changed_when: False
|
||
|
when: cockroachdb__exists.stat.exists
|
||
|
check_mode: no
|
||
|
register: cockroachdb__local_version
|
||
|
|
||
|
- debug: var=cockroachdb__local_version
|
||
|
|
||
|
- name: Install CockroachDB
|
||
|
include_tasks: install.yml
|
||
|
when: "not cockroachdb__exists.stat.exists or cockroachdb_version is not in cockroachdb__local_version.stdout"
|
||
|
|
||
|
|
||
|
- name: Configuration
|
||
|
include_tasks: config.yml
|
||
|
|
||
|
- name: ensure CockroachDB is enabled and started
|
||
|
become: yes
|
||
|
systemd:
|
||
|
name: cockroach
|
||
|
state: started
|
||
|
enabled: yes
|