mirror of
https://gitea.0xace.cc/ansible-galaxy/consul.git
synced 2025-07-01 09:23:09 +00:00
first commit
This commit is contained in:
45
tasks/Debian/main.yaml
Normal file
45
tasks/Debian/main.yaml
Normal file
@ -0,0 +1,45 @@
|
||||
- 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
|
||||
|
Reference in New Issue
Block a user