mirror of
https://gitea.0xace.cc/ansible-galaxy/consul.git
synced 2024-11-25 14:46:39 +00:00
46 lines
1.1 KiB
YAML
46 lines
1.1 KiB
YAML
- name: Add gpg package
|
|
apt:
|
|
name: gpg
|
|
|
|
- name: Add gpg keys for consul
|
|
ansible.builtin.apt_key:
|
|
url: "{{ item.url }}"
|
|
keyring: "{{ item.keyring }}"
|
|
loop: "{{ consul_apt_key }}"
|
|
|
|
- name: Add Hashicorp repository
|
|
apt_repository:
|
|
repo: "{{ item.repo }}"
|
|
state: present
|
|
filename: "{{ item.filename }}"
|
|
update_cache: yes
|
|
loop: "{{ consul_apt_repository }}"
|
|
|
|
- name: Check if Consul is installed
|
|
ansible.builtin.shell: dpkg-query -l {{ consul_package_name }} 2>&1 | grep {{ consul_version }}
|
|
ignore_errors: True
|
|
register: is_consul
|
|
changed_when: is_consul.rc != 0
|
|
failed_when: False
|
|
|
|
- name: Mask Consul before install
|
|
ansible.builtin.systemd:
|
|
name: "{{ consul_package_name }}"
|
|
masked: yes
|
|
when: is_consul.rc != 0
|
|
|
|
- name: "Install {{ consul_package_name }}-{{ consul_version }}"
|
|
apt:
|
|
name: "{{ consul_package }}"
|
|
update_cache: yes
|
|
register: consul_setup
|
|
when: is_consul.rc != 0
|
|
|
|
- name: Fix "/etc/consul.d/consul.env"
|
|
copy:
|
|
content: ""
|
|
dest: /etc/consul.d/consul.env
|
|
owner: consul
|
|
group: consul
|
|
|