Skip to content

Commit 7713b57

Browse files
authored
feat: use ansible_facts in place of variables
1 parent f7f0dca commit 7713b57

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

molecule/org/verify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- runner_org: yes
1111
- github_api_url: "https://api.github.com"
1212
- access_token: "{{ lookup('env', 'PERSONAL_ACCESS_TOKEN') }}"
13-
- runner_name: "{{ ansible_hostname }}"
13+
- runner_name: "{{ ansible_facts.hostname }}"
1414

1515
tasks:
1616
- name: Give the runners a minute

molecule/repo/verify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- github_account: monolithprojects-testorg
1111
- github_api_url: "https://api.github.com"
1212
- access_token: "{{ lookup('env', 'PERSONAL_ACCESS_TOKEN') }}"
13-
- runner_name: "{{ ansible_hostname }}"
13+
- runner_name: "{{ ansible_facts.hostname }}"
1414

1515
tasks:
1616
- name: Give the runners some time

tasks/collect_info.yml

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

5454
- name: Set runner_system variable
5555
ansible.builtin.set_fact:
56-
runner_system: "{{ 'osx' if ansible_system == 'Darwin' else 'linux' }}"
56+
runner_system: "{{ 'osx' if ansible_facts.system == 'Darwin' else 'linux' }}"
5757

5858
- name: Find the latest runner version (RUN ONCE)
5959
ansible.builtin.uri:
@@ -74,4 +74,4 @@
7474
- name: Get systemd service facts
7575
ansible.builtin.service_facts:
7676
register: service_facts
77-
when: ansible_system == "Linux"
77+
when: ansible_facts.system == "Linux"

tasks/install_deps.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- libicu57
1212
state: present
1313
update_cache: true
14-
when: (ansible_distribution == "Debian" and ansible_distribution_major_version == "9")
14+
when: (ansible_facts.distribution == "Debian" and ansible_facts.distribution_major_version == "9")
1515

1616
- name: Install dependencies on Debian Buster
1717
ansible.builtin.package:
@@ -24,7 +24,7 @@
2424
- libicu63
2525
state: present
2626
update_cache: true
27-
when: (ansible_distribution == "Debian" and ansible_distribution_major_version == "10")
27+
when: (ansible_facts.distribution == "Debian" and ansible_facts.distribution_major_version == "10")
2828

2929
- name: Install dependencies on Debian Bullseye
3030
ansible.builtin.package:
@@ -37,7 +37,7 @@
3737
- libicu67
3838
state: present
3939
update_cache: true
40-
when: (ansible_distribution == "Debian" and ansible_distribution_major_version == "11")
40+
when: (ansible_facts.distribution == "Debian" and ansible_facts.distribution_major_version == "11")
4141

4242
- name: Install dependencies on Debian Bookworm
4343
ansible.builtin.package:
@@ -50,7 +50,7 @@
5050
- libicu72
5151
state: present
5252
update_cache: true
53-
when: (ansible_distribution == "Debian" and ansible_distribution_major_version == "12")
53+
when: (ansible_facts.distribution == "Debian" and ansible_facts.distribution_major_version == "12")
5454

5555
- name: Install dependencies on Ubuntu Xenial systems
5656
ansible.builtin.package:
@@ -63,7 +63,7 @@
6363
- libicu55
6464
state: present
6565
update_cache: true
66-
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "16")
66+
when: (ansible_facts.distribution == "Ubuntu" and ansible_facts.distribution_major_version == "16")
6767

6868
- name: Install dependencies on Ubuntu Bionic systems
6969
ansible.builtin.package:
@@ -76,7 +76,7 @@
7676
- libicu60
7777
state: present
7878
update_cache: true
79-
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "18")
79+
when: (ansible_facts.distribution == "Ubuntu" and ansible_facts.distribution_major_version == "18")
8080

8181
- name: Install dependencies on Ubuntu Focal systems
8282
ansible.builtin.package:
@@ -89,7 +89,7 @@
8989
- libicu66
9090
state: present
9191
update_cache: true
92-
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "20")
92+
when: (ansible_facts.distribution == "Ubuntu" and ansible_facts.distribution_major_version == "20")
9393

9494
- name: Install dependencies on Ubuntu Jammy systems
9595
ansible.builtin.package:
@@ -101,7 +101,7 @@
101101
- libicu70
102102
state: present
103103
update_cache: true
104-
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "22")
104+
when: (ansible_facts.distribution == "Ubuntu" and ansible_facts.distribution_major_version == "22")
105105

106106
- name: Install dependencies on RHEL/CentOS/Fedora systems
107107
ansible.builtin.package:
@@ -113,7 +113,7 @@
113113
- libicu
114114
state: present
115115
update_cache: true
116-
when: (ansible_distribution == "RedHat") or
117-
(ansible_distribution == "CentOS") or
118-
(ansible_distribution == "Fedora") or
119-
(ansible_distribution == "Rocky")
116+
when: (ansible_facts.distribution == "RedHat") or
117+
(ansible_facts.distribution == "CentOS") or
118+
(ansible_facts.distribution == "Fedora") or
119+
(ansible_facts.distribution == "Rocky")

tasks/install_runner.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
remote_src: true
3030
mode: "0755"
3131
environment:
32-
PATH: /usr/local/bin:/opt/homebrew/bin/:{{ ansible_env.HOME }}/bin:{{ ansible_env.PATH }}
32+
PATH: /usr/local/bin:/opt/homebrew/bin/:{{ ansible_facts.user_dir }}/bin:{{ ansible_facts.env.PATH }}
3333
when: runner_version not in runner_installed.stdout or reinstall_runner
3434

3535
- name: Configure custom env file if required
@@ -109,7 +109,7 @@
109109
args:
110110
chdir: "{{ runner_dir }}"
111111
changed_when: true
112-
become: "{{ 'false' if ansible_system == 'Darwin' else 'true' }}"
112+
become: "{{ 'false' if ansible_facts.system == 'Darwin' else 'true' }}"
113113
when: not runner_service_file_path.stat.exists
114114

115115
- name: Read service name from file
@@ -125,7 +125,7 @@
125125
ignore_errors: "{{ ansible_check_mode }}"
126126
changed_when: true
127127
when: >
128-
ansible_system != 'Darwin' and
128+
ansible_facts.system != 'Darwin' and
129129
runner_state|lower == "started" and
130130
ansible_facts.services[(runner_service.content | b64decode) | trim ]['state'] != 'running'
131131
@@ -137,7 +137,7 @@
137137
no_log: "{{ hide_sensitive_logs | bool }}"
138138
ignore_errors: "{{ ansible_check_mode }}"
139139
changed_when: true
140-
when: ansible_system == 'Darwin' and runner_state|lower
140+
when: ansible_facts.system == 'Darwin' and runner_state|lower
141141

142142
- name: STOP and disable Github Actions Runner service
143143
ansible.builtin.command: "./svc.sh stop"
@@ -154,7 +154,7 @@
154154
args:
155155
chdir: "{{ runner_dir }}"
156156
changed_when: true
157-
become: "{{ 'false' if ansible_system == 'Darwin' else 'true' }}"
157+
become: "{{ 'false' if ansible_facts.system == 'Darwin' else 'true' }}"
158158
no_log: "{{ hide_sensitive_logs | bool }}"
159159
ignore_errors: "{{ ansible_check_mode }}"
160160
when: runner_version not in runner_installed.stdout and not runner_state|lower == "stopped"

tasks/uninstall_runner.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
args:
1010
chdir: "{{ runner_dir }}"
1111
changed_when: true
12-
become: "{{ 'false' if ansible_system == 'Darwin' else 'true' }}"
12+
become: "{{ 'false' if ansible_facts.system == 'Darwin' else 'true' }}"
1313
when: runner_service_file_path.stat.exists
1414

1515
- name: Check GitHub Actions runner file

vars/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ github_actions_architecture_map:
55
x86_64: x64
66
armv7l: arm
77
aarch64: arm64
8-
github_actions_architecture: "{{ github_actions_architecture_map[ansible_architecture] }}"
8+
github_actions_architecture: "{{ github_actions_architecture_map[ansible_facts.architecture] }}"

0 commit comments

Comments
 (0)