Skip to content

Commit 408b0cc

Browse files
authored
Merge pull request #473 from Normo/ansible-facts-namespace
Consistently access facts via the ansible_facts.* namespace
2 parents bd179e3 + 028d14e commit 408b0cc

File tree

12 files changed

+25
-25
lines changed

12 files changed

+25
-25
lines changed

molecule/gitlab_runner/molecule.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ provisioner:
3838
host_vars:
3939
instancegitlabciopenstack1:
4040
gitlab_runner_version: "18.0.2"
41-
gitlab_runner_deb_file: "https://packages.gitlab.com/runner/gitlab-runner/packages/{{ ansible_distribution | lower }}/{{ ansible_distribution_release | lower }}/gitlab-runner_{{ gitlab_runner_pkg_version }}_amd64.deb/download.deb"
42-
gitlab_runner_helper_images_deb_file: "https://packages.gitlab.com/runner/gitlab-runner/packages/{{ ansible_distribution | lower }}/{{ ansible_distribution_release | lower }}/gitlab-runner-helper-images_{{ gitlab_runner_pkg_version }}_all.deb/download.deb"
41+
gitlab_runner_deb_file: "https://packages.gitlab.com/runner/gitlab-runner/packages/{{ ansible_facts.distribution | lower }}/{{ ansible_facts.distribution_release | lower }}/gitlab-runner_{{ gitlab_runner_pkg_version }}_amd64.deb/download.deb"
42+
gitlab_runner_helper_images_deb_file: "https://packages.gitlab.com/runner/gitlab-runner/packages/{{ ansible_facts.distribution | lower }}/{{ ansible_facts.distribution_release | lower }}/gitlab-runner-helper-images_{{ gitlab_runner_pkg_version }}_all.deb/download.deb"
4343
gitlab_runner_install_docker: true
4444
gitlab_runner_ssh_public_key: "test_key.pub"
4545
gitlab_runner_ssh_private_key: "test_key"

molecule/gitlab_runner/prepare.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
hosts: "all"
99
tasks:
1010
- name: "Install necessary packages"
11-
when: "ansible_os_family == 'Debian'"
11+
when: "ansible_facts.os_family == 'Debian'"
1212
block:
1313
- name: "Install missing dependencies"
1414
ansible.builtin.apt:
@@ -21,7 +21,7 @@
2121
state: "present"
2222
update_cache: true
2323
- name: "Set up iptables"
24-
when: "ansible_distribution == 'Debian'"
24+
when: "ansible_facts.distribution == 'Debian'"
2525
block:
2626
- name: "Install missing dependencies"
2727
ansible.builtin.apt:

molecule/netplan/verify.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
block:
2828
- name: "Store actual and target network settings."
2929
ansible.builtin.set_fact:
30-
actual_interface_name: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['interface'] }}"
30+
actual_interface_name: "{{ ansible_facts.default_ipv4.interface }}"
3131
target_interface_name: "{{ netplan_ethernets[0]['interface_name'] }}"
32-
actual_ip_addresses: "{{ hostvars[inventory_hostname]['ansible_all_ipv4_addresses'] | ansible.utils.ipaddr('address') }}"
32+
actual_ip_addresses: "{{ ansible_facts.all_ipv4_addresses | ansible.utils.ipaddr('address') }}"
3333
target_ip_address: "{{ netplan_ethernets[0]['addresses'][0] | ansible.utils.ipaddr('address') }}"
34-
actual_subnet: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['netmask'] }}"
34+
actual_subnet: "{{ ansible_facts.default_ipv4.netmask }}"
3535
target_subnet: "{{ netplan_ethernets[0]['addresses'][0] | ansible.utils.ipaddr('netmask') }}"
3636

3737
- name: "Check that network settings are correct."

roles/gitlab_runner/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Docker is required for the `docker` executor but not for the
8787
### Docker-machine variables
8888

8989
```yaml
90-
gitlab_runner_docker_machine_binary_url: "https://gitlab.com/gitlab-org/ci-cd/docker-machine/-/releases/v0.16.2-gitlab.25/downloads/docker-machine-Linux-{{ ansible_architecture }}"
90+
gitlab_runner_docker_machine_binary_url: "https://gitlab.com/gitlab-org/ci-cd/docker-machine/-/releases/v0.16.2-gitlab.25/downloads/docker-machine-Linux-{{ ansible_facts.architecture }}"
9191
```
9292

9393
The URL where to download the docker-machine binary file from.
@@ -102,7 +102,7 @@ The checksum of the downloaded docker-machine binary. This must correspond to th
102102
### Flatcar Linux configuration
103103

104104
```yaml
105-
gitlab_runner_transpiler_binary_url: "https://github.com/coreos/butane/releases/download/v0.23.0/butane-{{ ansible_architecture }}-unknown-linux-gnu"
105+
gitlab_runner_transpiler_binary_url: "https://github.com/coreos/butane/releases/download/v0.23.0/butane-{{ ansible_facts.architecture }}-unknown-linux-gnu"
106106
```
107107

108108
The URL to the configuration transpiler binary that shall be used.

roles/gitlab_runner/defaults/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ gitlab_runner_pkg_version: "{{ gitlab_runner_version + '-1' if gitlab_runner_ver
1010

1111
gitlab_runner_deb_file: ""
1212

13-
gitlab_runner_docker_machine_binary_url: "https://gitlab.com/gitlab-org/ci-cd/docker-machine/-/releases/v0.16.2-gitlab.25/downloads/docker-machine-Linux-{{ ansible_architecture }}"
13+
gitlab_runner_docker_machine_binary_url: "https://gitlab.com/gitlab-org/ci-cd/docker-machine/-/releases/v0.16.2-gitlab.25/downloads/docker-machine-Linux-{{ ansible_facts.architecture }}"
1414

1515
gitlab_runner_docker_machine_binary_checksum: "sha256:04cc18c8f6ee0d71614064fa81116f20f3a37af53eeebf19bfb832ab9c46d3a0"
1616

17-
gitlab_runner_transpiler_binary_url: "https://github.com/coreos/butane/releases/download/v0.23.0/butane-{{ ansible_architecture }}-unknown-linux-gnu"
17+
gitlab_runner_transpiler_binary_url: "https://github.com/coreos/butane/releases/download/v0.23.0/butane-{{ ansible_facts.architecture }}-unknown-linux-gnu"
1818

1919
gitlab_runner_transpiler_binary_checksum: "sha256:5833ce9f9c2932d9b02bc05821ffb6927d1e896a524c8dd53a4c9d2d90c47e2c"
2020

roles/gitlab_runner/tasks/install.debianlike.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
ansible.builtin.deb822_repository:
2424
name: "gitlab-runner"
2525
types: "deb"
26-
uris: "https://packages.gitlab.com/runner/gitlab-runner/{{ ansible_distribution | lower }}/"
27-
suites: "{{ ansible_distribution_release }}"
26+
uris: "https://packages.gitlab.com/runner/gitlab-runner/{{ ansible_facts.distribution | lower }}/"
27+
suites: "{{ ansible_facts.distribution_release }}"
2828
components: "main"
2929
signed_by: "https://packages.gitlab.com/runner/gitlab-runner/gpgkey"
3030
state: "present"
@@ -37,7 +37,7 @@
3737
owner: "root"
3838
group: "root"
3939
mode: '0644'
40-
when: "ansible_distribution == 'Debian'"
40+
when: "ansible_facts.distribution == 'Debian'"
4141

4242
- name: "Install gitlab-runner-helper-images with downgrade option"
4343
ansible.builtin.apt:

roles/gitlab_runner/tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
---
77
- name: "Set OS family dependent variables"
8-
ansible.builtin.include_vars: "{{ ansible_os_family | lower }}.yml"
8+
ansible.builtin.include_vars: "{{ ansible_facts.os_family | lower }}.yml"
99

1010
- name: "Set variable if autoscaling runner must be configured"
1111
ansible.builtin.set_fact:
@@ -27,7 +27,7 @@
2727

2828
- name: "Include installation tasks for Debian-like OS"
2929
ansible.builtin.include_tasks: "install.debianlike.yml"
30-
when: "ansible_os_family == 'Debian'"
30+
when: "ansible_facts.os_family == 'Debian'"
3131

3232
- name: "Include autoscaler install tasks"
3333
ansible.builtin.include_tasks: "install.autoscaler-plugin.yml"

roles/keepalived/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,15 @@ keepalived_weight: '0'
221221
Set the unicast source IP address of the Keepalived instance:
222222

223223
```yaml
224-
keepalived_unicast_src_ip: '{{ ansible_default_ipv4.address }}'
224+
keepalived_unicast_src_ip: '{{ ansible_facts.default_ipv4.address }}'
225225
```
226226

227227
#### Keepalived instance network interface
228228

229229
Set network interface to which the floating IP address is associated:
230230

231231
```yaml
232-
keepalived_interface: "{{ ansible_default_ipv4.interface }}"
232+
keepalived_interface: "{{ ansible_facts.default_ipv4.interface }}"
233233
```
234234

235235
#### Keepalived instance virtual IP address and network interface

roles/keepalived/defaults/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ keepalived_priority: "{{ '100' if keepalived_state == 'MASTER' else '99' }}"
5959
# Keepalived instance state MASTER or BACKUP
6060
keepalived_state: "MASTER"
6161
# Keepalived instance network interface
62-
keepalived_interface: "{{ ansible_default_ipv4.interface }}"
62+
keepalived_interface: "{{ ansible_facts.default_ipv4.interface }}"
6363
# Keepalived instance virtual IP address and network interface
6464
keepalived_virtual_ipaddress_config: "{{ keepalived_virtual_ip_address }} dev {{ keepalived_interface }}"
6565
# Keepalived instance unicast source IP address
66-
keepalived_unicast_src_ip: "{{ ansible_default_ipv4.address }}"
66+
keepalived_unicast_src_ip: "{{ ansible_facts.default_ipv4.address }}"
6767

6868
# Enable process tracking
6969
keepalived_enable_process_tracking: true

roles/zammad/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Choose another release channel for the Zammad packages.
4343
Please refer to <https://packager.io/gh/zammad/zammad> for a complete list.
4444
4545
```yaml
46-
zammad_domain_name: "{{ ansible_fqdn }}"
46+
zammad_domain_name: "{{ ansible_facts.fqdn }}"
4747
```
4848
4949
Zammad's fully qualified domain name.

0 commit comments

Comments
 (0)