mirror of
https://gitea.0xace.cc/ansible-galaxy/consul.git
synced 2025-04-05 21:51:57 +00:00
update consul descovery and rhel/debian support
This commit is contained in:
parent
c9929c4c87
commit
9e46c26746
@ -16,25 +16,41 @@
|
|||||||
update_cache: yes
|
update_cache: yes
|
||||||
loop: "{{ consul_apt_repository }}"
|
loop: "{{ consul_apt_repository }}"
|
||||||
|
|
||||||
- name: Check if Consul is installed
|
- name: Gather packages
|
||||||
ansible.builtin.shell: dpkg-query -l {{ consul_package_name }} 2>&1 | grep {{ consul_version }}
|
package_facts:
|
||||||
ignore_errors: True
|
manager: auto
|
||||||
register: is_consul
|
|
||||||
changed_when: is_consul.rc != 0
|
- name: Set fact about Consul package
|
||||||
failed_when: False
|
set_fact:
|
||||||
|
consul_installed_package: "{{ ansible_facts.packages[consul_package_name][0]['name'] }}"
|
||||||
|
when: consul_package_name in ansible_facts.packages
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "{{ ansible_facts.packages[consul_package_name][0]['version'] }}"
|
||||||
|
when: consul_installed_package is defined
|
||||||
|
|
||||||
- name: Mask Consul before install
|
- name: Mask Consul before install
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: "{{ consul_package_name }}"
|
name: "{{ consul_package_name }}"
|
||||||
masked: yes
|
masked: yes
|
||||||
when: is_consul.rc != 0
|
when: consul_package_name not in ansible_facts.packages or ansible_facts.packages[consul_package_name][0]['version'] != (consul_version + "-" + consul_version_build)
|
||||||
|
|
||||||
- name: "Install {{ consul_package_name }}-{{ consul_version }}-{{ consul_version_build }}"
|
- name: "Install {{ consul_package_name }}-{{ consul_version }}-{{ consul_version_build }}"
|
||||||
apt:
|
apt:
|
||||||
name: "{{ consul_package }}-{{ consul_version_build }}"
|
name: "{{ consul_package }}-{{ consul_version_build }}"
|
||||||
update_cache: yes
|
update_cache: yes
|
||||||
register: consul_setup
|
register: consul_setup
|
||||||
when: is_consul.rc != 0
|
when: consul_package_name not in ansible_facts.packages
|
||||||
|
|
||||||
|
- name: "Update {{ consul_package_name }}-{{ consul_version }}-{{ consul_version_build }}"
|
||||||
|
apt:
|
||||||
|
name: "{{ consul_package }}-{{ consul_version_build }}"
|
||||||
|
update_cache: yes
|
||||||
|
register: consul_update
|
||||||
|
notify: Restart consul
|
||||||
|
when:
|
||||||
|
- consul_package_name in ansible_facts.packages
|
||||||
|
- ansible_facts.packages[consul_package_name][0]['version'] != (consul_version + "-" + consul_version_build)
|
||||||
|
|
||||||
- name: Fix "/etc/consul.d/consul.env"
|
- name: Fix "/etc/consul.d/consul.env"
|
||||||
copy:
|
copy:
|
||||||
|
@ -7,5 +7,6 @@ consul_apt_repository:
|
|||||||
- repo: deb [arch=amd64] https://apt.releases.hashicorp.com {{ ansible_distribution_release }} main
|
- repo: deb [arch=amd64] https://apt.releases.hashicorp.com {{ ansible_distribution_release }} main
|
||||||
filename: hashicorp
|
filename: hashicorp
|
||||||
consul_version_build: "1"
|
consul_version_build: "1"
|
||||||
|
consul_package_name_regex: "{{ consul_package_name }}-{{ consul_version }}-{{ consul_version_build }}"
|
||||||
consul_ssl_update_ca_command: "update-ca-certificates --fresh"
|
consul_ssl_update_ca_command: "update-ca-certificates --fresh"
|
||||||
consul_ssl_ca_trust_dir: "/usr/local/share/ca-certificates"
|
consul_ssl_ca_trust_dir: "/usr/local/share/ca-certificates"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
consul_package: "{{ consul_package_name }}-{{ consul_version }}"
|
consul_package: "{{ consul_package_name }}-{{ consul_version }}"
|
||||||
|
consul_package_name_regex: "{{ consul_package }}"
|
||||||
consul_ssl_update_ca_command: "update-ca-trust extract"
|
consul_ssl_update_ca_command: "update-ca-trust extract"
|
||||||
consul_ssl_ca_trust_dir: "/etc/pki/ca-trust/source/anchors"
|
consul_ssl_ca_trust_dir: "/etc/pki/ca-trust/source/anchors"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user