Skip to content

Commit

Permalink
add facts tag
Browse files Browse the repository at this point in the history
Signed-off-by: ahmadali shafiee <mail@ahmadalli.net>
  • Loading branch information
ahmadalli committed Feb 8, 2021
1 parent b48e0bb commit 0daae48
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions roles/docker/compose/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
- name: set checksum fact
set_fact:
_docker_compose_checksum: "{{ _docker_compose_checksum_request.content.split(' ')[0] }}"
tags:
- facts

- name: install docker-compose
ansible.builtin.get_url:
Expand Down
2 changes: 2 additions & 0 deletions roles/docker/configure/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
dns: "{{ docker_daemon_configs_dns | default([], true) }}"
log-driver: "{{ docker_daemon_configs_log_driver | default('json-file') }}"
log-opts: "{{ docker_daemon_configs_log_opts | default({}, true) }}"
tags:
- facts
- name: create docker configs directory
file:
path: /etc/docker
Expand Down
2 changes: 2 additions & 0 deletions roles/glusterfs/server/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
- name: populate gluster server hosts
ansible.builtin.set_fact:
_cluster_hosts: "{{ _cluster_hosts | default([], true) | union(query('inventory_hostnames', item)) }}"
tags:
- facts
loop: "{{ glusterfs_cluster_hosts }}"
- name: add cluster hosts to /etc/hosts
ansible.builtin.blockinfile:
Expand Down
2 changes: 2 additions & 0 deletions roles/opennebula/frontend/configure/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
- name: propagate authorized key
set_fact:
opennebula_frontend_authorized_key: "{{ frontend_public_key['content'] | b64decode }}"
tags:
- facts
delegate_to: "{{ item }}"
delegate_facts: true
with_items: "{{ groups['opennebula_node'] }}"
Expand Down
2 changes: 2 additions & 0 deletions roles/opennebula/frontend/setup/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
- name: add required package
set_fact:
opennebula_frontend_packages: "{{ opennebula_frontend_packages | union(['ruby-bundler']) }}"
tags:
- facts
- name: gather os specific variables
ansible.builtin.include_vars: "{{ item }}"
with_first_found:
Expand Down
4 changes: 4 additions & 0 deletions roles/utils/os/firewall/configure/tasks/firewalld/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
- name: list configured zones
set_fact:
_firewalld_zones: "{{ query('varnames', '^firewalld_zone_.+_setup$') | map('regex_replace', '^firewalld_zone_(.+)_setup$', '\\1') }}"
tags:
- facts
- name: list default zones
ansible.builtin.find:
paths: /usr/lib/firewalld/zones/
Expand All @@ -64,6 +66,8 @@
- name: add default zones to firewalld_zones
set_fact:
_firewalld_zones: "{{ _firewalld_zones | default([], true) | union(_firewalld_default_zones.files | map(attribute='path') | map('basename') | map('replace', '.xml', '')) | unique }}"
tags:
- facts

- name: setup default zone
include: firewalld/zone.yaml
Expand Down
15 changes: 15 additions & 0 deletions roles/utils/os/firewall/configure/tasks/firewalld/zone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
set_fact:
_config_key: "{{ 'zone_' + _zone_name if (_zone_name | default('', true) | length > 0) else 'default_zone' }}"
_is_default_zone: "{{ _zone_name | default('', true) | length == 0 }}"
tags:
- facts

- name: set zone configuration facts
set_fact:
Expand All @@ -13,6 +15,9 @@
_rich_rules: "{{ query('ahmadalli.ansible.listmerge', 'firewalld_' + _config_key + '_rich_rules') | unique }}"
_masquerade: "{{ lookup('vars', 'firewalld_' + _config_key + '_masquerade', default=false) }}"
_target: "{{ lookup('vars', 'firewalld_' + _config_key + '_target', default='') }}"
tags:
- facts

- name: add _source_hosts to sources
set_fact:
_sources: "{{
Expand All @@ -24,19 +29,29 @@
difference([ansible_host])
) |
unique }}"
tags:
- facts
- name: remove non-ip values from sources
set_fact:
_sources: "{{ _sources | ansible.netcommon.ipaddr }}"
tags:
- facts
- name: make all sources subnet
set_fact:
_sources: "{{ _sources | map('ansible.netcommon.ipsubnet') }}"
tags:
- facts
- name: generate redundant sources list
set_fact:
_redundant_sources: "{{ _redundant_sources | default([], true) | union(_sources | ansible.netcommon.ipaddr(item) | difference([item])) | unique }}"
tags:
- facts
loop: "{{ _sources }}"
- name: remove redundant sources
set_fact:
_sources: "{{ _sources | difference(_redundant_sources) }}"
tags:
- facts

- name: ensure zone is present
ansible.posix.firewalld:
Expand Down

0 comments on commit 0daae48

Please sign in to comment.