89 lines
2.3 KiB
YAML
89 lines
2.3 KiB
YAML
|
---
|
||
|
- name: Create temp ordner during install
|
||
|
file:
|
||
|
path: /tmp/cockroachdb
|
||
|
state: directory
|
||
|
|
||
|
- name: download cockroachdb and check hash
|
||
|
get_url:
|
||
|
url: "{{ cockroachdb_download_url }}"
|
||
|
checksum: "{{ cockroachdb_checksum }}"
|
||
|
dest: /tmp/cockroachdb.tar.gz
|
||
|
|
||
|
- name: unzip cockroachdb
|
||
|
unarchive:
|
||
|
remote_src: yes
|
||
|
src: /tmp/cockroachdb.tar.gz
|
||
|
dest: /tmp/cockroachdb
|
||
|
|
||
|
- name: create group
|
||
|
become: yes
|
||
|
group:
|
||
|
name: "{{ cockroachdb__gid }}"
|
||
|
state: present
|
||
|
|
||
|
- name: make sure cockroachdb user is present
|
||
|
become: yes
|
||
|
user:
|
||
|
system: true
|
||
|
name: "{{ cockroachdb__uid }}"
|
||
|
shell: /bin/nologin
|
||
|
createhome: false
|
||
|
home: "{{ cockroachdb__dir }}"
|
||
|
|
||
|
- name: make sure directories exist
|
||
|
become: yes
|
||
|
file:
|
||
|
path: "{{ cockroachdb__dir }}"
|
||
|
state: directory
|
||
|
recurse: yes
|
||
|
mode: "u=rwx,g=rx,o="
|
||
|
owner: "{{ cockroachdb__uid }}"
|
||
|
group: "{{ cockroachdb__gid }}"
|
||
|
|
||
|
|
||
|
- name: make sure cockroachdb binary is present
|
||
|
become: yes
|
||
|
notify: restart cockroach
|
||
|
copy:
|
||
|
src: "/tmp/cockroachdb/cockroach-v{{ cockroachdb_version }}.linux-amd64/cockroach"
|
||
|
remote_src: yes
|
||
|
dest: "/usr/local/bin/cockroach"
|
||
|
mode: 0755
|
||
|
owner: "{{ cockroachdb__uid }}"
|
||
|
group: "{{ cockroachdb__gid }}"
|
||
|
|
||
|
- name: generate autocomplete and man for cockroachdb
|
||
|
become: yes
|
||
|
command: /usr/local/bin/cockroach gen man --path "/usr/share/man/man1/"
|
||
|
|
||
|
- name: generate autocomplete and man for cockroachdb
|
||
|
become: yes
|
||
|
command: /usr/local/bin/cockroach gen autocomplete "{{ item.shell }}" --out "{{ item.path }}"
|
||
|
loop:
|
||
|
- shell: bash
|
||
|
path: /usr/share/bash-completion/completions/cockroach
|
||
|
|
||
|
- name: generate autocomplete and man for debian
|
||
|
when: ansible_os_family == "Debian"
|
||
|
become: yes
|
||
|
command: /usr/local/bin/cockroach gen autocomplete "{{ item.shell }}" --out "{{ item.path }}"
|
||
|
loop:
|
||
|
- shell: zsh
|
||
|
path: /usr/share/zsh/vendor-completions/_cockroach
|
||
|
|
||
|
- name: generate autocomplete and man for archlinux
|
||
|
when: ansible_os_family == "Archlinux"
|
||
|
become: yes
|
||
|
command: /usr/local/bin/cockroach gen autocomplete "{{ item.shell }}" --out "{{ item.path }}"
|
||
|
loop:
|
||
|
- shell: zsh
|
||
|
path: /usr/share/zsh/site-functions/_cockroach
|
||
|
|
||
|
- name: ensure systemd unit is present
|
||
|
become: yes
|
||
|
notify: restart cockroach
|
||
|
template:
|
||
|
src: systemd.service
|
||
|
dest: /etc/systemd/system/cockroach.service
|