Auto-fix usage of modules via FQCN
Since ansible-core 2.10 it is recommended to use modules via FQCN In order to align with recommendation, we perform migration by applying suggestions made by `ansible-lint --fix=fqcn` Change-Id: I9c3a86af107728cbddb4e2cdb778065001d66b93
This commit is contained in:
parent
e1e62d3f57
commit
9e1a3749da
@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
- name: Regen pem # noqa: no-changed-when
|
||||
shell: >-
|
||||
ansible.builtin.shell: >-
|
||||
cat {{ item_base_path ~ '.crt' }} $(test -f {{ item_base_path ~ '-ca.crt' }} &&
|
||||
echo {{ item_base_path ~ '-ca.crt' }}) {{ item_base_path ~ '.key' }} > {{ item_base_path ~ '.pem' }}
|
||||
vars:
|
||||
@ -28,7 +28,7 @@
|
||||
- name: Regenerate maps
|
||||
vars:
|
||||
all_changed_results: "{{ (map_create.results + map_delete.results) | select('changed') }}"
|
||||
assemble:
|
||||
ansible.builtin.assemble:
|
||||
src: "/etc/haproxy/map.conf.d/{{ item }}"
|
||||
dest: "/etc/haproxy/{{ item }}.map"
|
||||
mode: "0640"
|
||||
@ -37,7 +37,7 @@
|
||||
with_items: "{{ all_changed_results | map(attribute='item') | flatten | selectattr('name', 'defined') | map(attribute='name') | unique }}"
|
||||
|
||||
- name: Regenerate haproxy configuration
|
||||
assemble:
|
||||
ansible.builtin.assemble:
|
||||
src: "/etc/haproxy/conf.d"
|
||||
dest: "/etc/haproxy/haproxy.cfg"
|
||||
validate: /usr/sbin/haproxy -c -f %s
|
||||
@ -48,12 +48,12 @@
|
||||
- haproxy-general-config
|
||||
|
||||
- name: Get package facts
|
||||
package_facts:
|
||||
ansible.builtin.package_facts:
|
||||
manager: auto
|
||||
listen: Restart rsyslog
|
||||
|
||||
- name: Restart rsyslog
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: "rsyslog"
|
||||
state: "restarted"
|
||||
enabled: true
|
||||
@ -62,7 +62,7 @@
|
||||
- "'rsyslog' in ansible_facts.packages"
|
||||
|
||||
- name: Reload haproxy
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: "haproxy"
|
||||
state: "reloaded"
|
||||
enabled: true
|
||||
|
@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
- name: Install HAProxy Packages
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: "{{ haproxy_distro_packages }}"
|
||||
state: "{{ haproxy_package_state }}"
|
||||
update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
|
||||
@ -27,13 +27,13 @@
|
||||
- name: Install HATop Utility
|
||||
block:
|
||||
- name: Ensure haproxy_hatop_download_path exists on haproxy
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ haproxy_hatop_download_path }}/{{ haproxy_hatop_download_url | basename | replace('.tar.gz', '') }}"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: Download hatop package
|
||||
get_url:
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ haproxy_hatop_download_url }}"
|
||||
dest: "{{ haproxy_hatop_download_path }}/{{ haproxy_hatop_download_url | basename }}"
|
||||
validate_certs: "{{ haproxy_hatop_download_validate_certs }}"
|
||||
@ -45,7 +45,7 @@
|
||||
delay: 10
|
||||
|
||||
- name: Unarchive HATop
|
||||
unarchive:
|
||||
ansible.builtin.unarchive:
|
||||
src: "{{ haproxy_hatop_download_path }}/{{ haproxy_hatop_download_url | basename }}"
|
||||
dest: "{{ haproxy_hatop_download_path }}/{{ haproxy_hatop_download_url | basename | replace('.tar.gz', '') }}"
|
||||
remote_src: true
|
||||
@ -53,7 +53,7 @@
|
||||
- --strip-components=1
|
||||
|
||||
- name: Copy HATop binary
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: "{{ haproxy_hatop_download_path }}/{{ haproxy_hatop_download_url | basename | replace('.tar.gz', '') }}/bin/hatop"
|
||||
dest: /usr/local/bin/hatop
|
||||
mode: "0755"
|
||||
|
@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
- name: Make haproxy bindable on non local addresses
|
||||
sysctl:
|
||||
ansible.posix.sysctl:
|
||||
name: "{{ item }}"
|
||||
value: 1
|
||||
sysctl_set: true
|
||||
@ -30,7 +30,7 @@
|
||||
# to handle log collection and log file rotation. This is not needed since
|
||||
# journald is used for this purpose
|
||||
- name: Delete rsyslog and logrotate configs
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: absent
|
||||
with_items:
|
||||
@ -42,7 +42,7 @@
|
||||
- haproxy-logging-config
|
||||
|
||||
- name: Drop base haproxy config
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: "haproxy.cfg.j2"
|
||||
dest: "/etc/haproxy/conf.d/00-haproxy"
|
||||
mode: "0640"
|
||||
@ -53,7 +53,7 @@
|
||||
- haproxy-base-config
|
||||
|
||||
- name: Including haproxy_service_config tasks
|
||||
include_tasks: haproxy_service_config.yml
|
||||
ansible.builtin.include_tasks: haproxy_service_config.yml
|
||||
args:
|
||||
apply:
|
||||
tags:
|
||||
@ -62,7 +62,7 @@
|
||||
- haproxy-service-config
|
||||
|
||||
- name: Create log directory if it does not exist
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ haproxy_log_mount_point | dirname }}"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
@ -72,7 +72,7 @@
|
||||
# NOTE(jrosser) The next task fails on Centos without this,
|
||||
# an empty directory rather than a file is made and the bind mount fails
|
||||
- name: Ensure empty file is availble to bind mount log socket
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
state: touch
|
||||
path: "{{ haproxy_log_mount_point }}"
|
||||
access_time: preserve
|
||||
@ -80,7 +80,7 @@
|
||||
mode: "0666"
|
||||
|
||||
- name: Make log socket available to chrooted filesystem
|
||||
mount:
|
||||
ansible.posix.mount:
|
||||
src: "{{ haproxy_log_socket }}"
|
||||
path: "{{ haproxy_log_mount_point }}"
|
||||
opts: bind
|
||||
@ -88,7 +88,7 @@
|
||||
fstype: none
|
||||
|
||||
- name: Prevent SELinux from preventing haproxy from binding to arbitrary ports
|
||||
seboolean:
|
||||
ansible.posix.seboolean:
|
||||
name: haproxy_connect_any
|
||||
state: true
|
||||
persistent: true
|
||||
|
@ -19,7 +19,7 @@
|
||||
# log aggregation links as well as ensure common user
|
||||
# functionality across various distros that we support.
|
||||
- name: Create the haproxy system group
|
||||
group:
|
||||
ansible.builtin.group:
|
||||
name: "haproxy"
|
||||
state: "present"
|
||||
system: "yes"
|
||||
@ -32,7 +32,7 @@
|
||||
# log aggregation links as well as ensure common user
|
||||
# functionality across various distros that we support.
|
||||
- name: Create the haproxy system user
|
||||
user:
|
||||
ansible.builtin.user:
|
||||
name: "haproxy"
|
||||
group: "haproxy"
|
||||
comment: "haproxy user"
|
||||
@ -44,7 +44,7 @@
|
||||
- haproxy-user
|
||||
|
||||
- name: Create haproxy conf.d dir
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
@ -55,7 +55,7 @@
|
||||
- "{{ haproxy_ssl_cert_path }}"
|
||||
|
||||
- name: Copy static files
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
content: "{{ item.content }}"
|
||||
dest: "{{ item.dest }}"
|
||||
mode: "0644"
|
||||
|
@ -16,11 +16,11 @@
|
||||
# NOTE(damiandabrowski): Deprecated haproxy_service_configs format
|
||||
# conversion will be removed in 2024.1.
|
||||
- name: Define blank _haproxy_service_configs_simplified variable
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
_haproxy_service_configs_simplified: []
|
||||
|
||||
- name: Append services to _haproxy_service_configs_simplified list
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
_haproxy_service_configs_simplified: "{{ _haproxy_service_configs_simplified + [(item.service is defined) | ternary(item.service, item)] }}"
|
||||
loop: "{{ haproxy_service_configs }}"
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
###########################################################################
|
||||
|
||||
- name: Create haproxy service config files
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: service.j2
|
||||
dest: "/etc/haproxy/conf.d/{{ service.haproxy_service_name }}"
|
||||
owner: root
|
||||
@ -51,7 +51,7 @@
|
||||
notify: Regenerate haproxy configuration
|
||||
|
||||
- name: Remove haproxy service config files for absent services
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "/etc/haproxy/conf.d/{{ service.haproxy_service_name }}"
|
||||
state: absent
|
||||
notify: Regenerate haproxy configuration
|
||||
@ -68,7 +68,7 @@
|
||||
###########################################################################
|
||||
|
||||
- name: Create haproxy map fragment directories
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
path: "/etc/haproxy/map.conf.d/{{ item }}"
|
||||
owner: root
|
||||
@ -86,7 +86,7 @@
|
||||
- name: Create haproxy map files
|
||||
vars:
|
||||
map_file: "/etc/haproxy/map.conf.d/{{ item.1.name }}/{{ item.1.order | default('00') }}-{{ item.0.haproxy_service_name }}.map"
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: map.j2
|
||||
dest: "{{ map_file }}"
|
||||
owner: root
|
||||
@ -105,7 +105,7 @@
|
||||
|
||||
# remove map entries when the service is not enabled, the service is absent or the map is absent
|
||||
- name: Delete unused map entries
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
state: absent
|
||||
path: "/etc/haproxy/map.conf.d/{{ item.1.name }}/{{ item.1.order | default('00') }}-{{ item.0.haproxy_service_name }}.map"
|
||||
when:
|
||||
|
@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
- name: Gather variables for each operating system
|
||||
include_vars: "{{ lookup('first_found', params) }}"
|
||||
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
|
||||
vars:
|
||||
params:
|
||||
files:
|
||||
@ -27,7 +27,7 @@
|
||||
- "{{ role_path }}/vars"
|
||||
|
||||
- name: Including haproxy_service_config tasks
|
||||
include_tasks: haproxy_service_config.yml
|
||||
ansible.builtin.include_tasks: haproxy_service_config.yml
|
||||
args:
|
||||
apply:
|
||||
tags:
|
||||
|
@ -12,13 +12,13 @@
|
||||
# limitations under the License.
|
||||
|
||||
- name: Install certbot from distro package
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: "{{ haproxy_distro_certbot_packages }}"
|
||||
state: present
|
||||
|
||||
- name: Create first time ssl cert with certbot
|
||||
throttle: 1
|
||||
shell: >
|
||||
ansible.builtin.shell: >
|
||||
{% if haproxy_ssl_letsencrypt_certbot_challenge == 'http-01' %}
|
||||
timeout {{ haproxy_ssl_letsencrypt_pre_hook_timeout }}
|
||||
python3 -m http.server {{ haproxy_ssl_letsencrypt_certbot_backend_port }}
|
||||
@ -45,7 +45,7 @@
|
||||
|
||||
# Certbot automatically installs its systemd timer responsible for renewals
|
||||
- name: Create certbot pre hook
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: letsencrypt_pre_hook_certbot_distro.j2
|
||||
dest: /etc/letsencrypt/renewal-hooks/pre/haproxy-pre
|
||||
mode: "0755"
|
||||
@ -53,13 +53,13 @@
|
||||
- haproxy_ssl_letsencrypt_certbot_challenge == 'http-01'
|
||||
|
||||
- name: Create certbot post renewal hook
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: letsencrypt_renew_certbot_distro.j2
|
||||
dest: /etc/letsencrypt/renewal-hooks/post/haproxy-renew
|
||||
mode: "0755"
|
||||
|
||||
- name: Create new pem file for haproxy
|
||||
assemble:
|
||||
ansible.builtin.assemble:
|
||||
src: "{{ haproxy_ssl_letsencrypt_config_path }}/{{ haproxy_ssl_letsencrypt_domains | first }}"
|
||||
dest: >-
|
||||
{{
|
||||
|
@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
- name: Gather variables for each operating system
|
||||
include_vars: "{{ lookup('first_found', params) }}"
|
||||
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
|
||||
vars:
|
||||
params:
|
||||
files:
|
||||
@ -29,19 +29,19 @@
|
||||
- always
|
||||
|
||||
- name: Importing haproxy_pre_install tasks
|
||||
import_tasks: haproxy_pre_install.yml
|
||||
ansible.builtin.import_tasks: haproxy_pre_install.yml
|
||||
tags:
|
||||
- haproxy_server-install
|
||||
|
||||
- name: Importing haproxy_install tasks
|
||||
import_tasks: haproxy_install.yml
|
||||
ansible.builtin.import_tasks: haproxy_install.yml
|
||||
tags:
|
||||
- haproxy_server-install
|
||||
|
||||
# NOTE (jrosser) the self signed certificate is also needed for bootstrapping
|
||||
# letsencrypt, as haproxy will not start with ssl config but a missing certificate
|
||||
- name: Create and install SSL certificates
|
||||
include_role:
|
||||
ansible.builtin.include_role:
|
||||
name: pki
|
||||
apply:
|
||||
tags:
|
||||
@ -66,16 +66,16 @@
|
||||
- pki
|
||||
|
||||
- name: Importing haproxy_post_install tasks
|
||||
import_tasks: haproxy_post_install.yml
|
||||
ansible.builtin.import_tasks: haproxy_post_install.yml
|
||||
tags:
|
||||
- haproxy_server-config
|
||||
|
||||
# NOTE(jrosser) we must reload the haproxy config before doing the first time certbot setup to ensure the letsencypt backend is configured
|
||||
- name: Flush handlers
|
||||
meta: flush_handlers
|
||||
ansible.builtin.meta: flush_handlers
|
||||
|
||||
- name: Including haproxy_ssl_letsencrypt tasks
|
||||
include_tasks: haproxy_ssl_letsencrypt.yml
|
||||
ansible.builtin.include_tasks: haproxy_ssl_letsencrypt.yml
|
||||
when:
|
||||
- haproxy_ssl | bool
|
||||
- haproxy_ssl_letsencrypt_enable | bool
|
||||
|
Loading…
x
Reference in New Issue
Block a user