diff --git a/README.md b/README.md index c8f34be..5816426 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ runner_download_repository: "actions/runner" runner_extra_config_args: "" # Name to assign to this runner in GitHub (System hostname as default) -runner_name: "{{ ansible_hostname }}" +runner_name: "{{ ansible_facts.hostname }}" # GitHub Repository user or Organization owner used for Runner registration # github_account: "youruser" diff --git a/defaults/main.yml b/defaults/main.yml index eb6c744..3abfa0f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -43,7 +43,7 @@ runner_download_repository: "actions/runner" runner_extra_config_args: "" # Name to assign to this runner in GitHub (System hostname as default) -runner_name: "{{ ansible_hostname }}" +runner_name: "{{ ansible_facts.hostname }}" # GitHub Repository user or Organization owner used for Runner registration # github_account: "youruser" diff --git a/molecule/org/verify.yml b/molecule/org/verify.yml index 959582e..5fc97da 100644 --- a/molecule/org/verify.yml +++ b/molecule/org/verify.yml @@ -10,7 +10,7 @@ runner_org: yes github_api_url: "https://api.github.com" access_token: "{{ lookup('env', 'PERSONAL_ACCESS_TOKEN') }}" - runner_name: "{{ ansible_hostname }}" + runner_name: "{{ ansible_facts.hostname }}" tasks: - name: Give the runners a minute diff --git a/molecule/repo/verify.yml b/molecule/repo/verify.yml index d4faf92..b617731 100644 --- a/molecule/repo/verify.yml +++ b/molecule/repo/verify.yml @@ -10,7 +10,7 @@ github_account: monolithprojects-testorg github_api_url: "https://api.github.com" access_token: "{{ lookup('env', 'PERSONAL_ACCESS_TOKEN') }}" - runner_name: "{{ ansible_hostname }}" + runner_name: "{{ ansible_facts.hostname }}" tasks: - name: Give the runners some time diff --git a/tasks/collect_info.yml b/tasks/collect_info.yml index 984bc5b..e1373c1 100644 --- a/tasks/collect_info.yml +++ b/tasks/collect_info.yml @@ -53,7 +53,7 @@ - name: Set runner_system variable ansible.builtin.set_fact: - runner_system: "{{ 'osx' if ansible_system == 'Darwin' else 'linux' }}" + runner_system: "{{ 'osx' if ansible_facts.system == 'Darwin' else 'linux' }}" - name: Find the latest runner version (RUN ONCE) ansible.builtin.uri: @@ -74,4 +74,4 @@ - name: Get systemd service facts ansible.builtin.service_facts: register: service_facts - when: ansible_system == "Linux" + when: ansible_facts.system == "Linux" diff --git a/tasks/install_deps.yml b/tasks/install_deps.yml index 04202ce..f62d6f9 100644 --- a/tasks/install_deps.yml +++ b/tasks/install_deps.yml @@ -11,7 +11,7 @@ - libicu57 state: present update_cache: true - when: (ansible_distribution == "Debian" and ansible_distribution_major_version == "9") + when: (ansible_facts.distribution == "Debian" and ansible_facts.distribution_major_version == "9") - name: Install dependencies on Debian Buster ansible.builtin.package: @@ -24,7 +24,7 @@ - libicu63 state: present update_cache: true - when: (ansible_distribution == "Debian" and ansible_distribution_major_version == "10") + when: (ansible_facts.distribution == "Debian" and ansible_facts.distribution_major_version == "10") - name: Install dependencies on Debian Bullseye ansible.builtin.package: @@ -37,7 +37,7 @@ - libicu67 state: present update_cache: true - when: (ansible_distribution == "Debian" and ansible_distribution_major_version == "11") + when: (ansible_facts.distribution == "Debian" and ansible_facts.distribution_major_version == "11") - name: Install dependencies on Debian Bookworm ansible.builtin.package: @@ -50,7 +50,7 @@ - libicu72 state: present update_cache: true - when: (ansible_distribution == "Debian" and ansible_distribution_major_version == "12") + when: (ansible_facts.distribution == "Debian" and ansible_facts.distribution_major_version == "12") - name: Install dependencies on Ubuntu Xenial systems ansible.builtin.package: @@ -63,7 +63,7 @@ - libicu55 state: present update_cache: true - when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "16") + when: (ansible_facts.distribution == "Ubuntu" and ansible_facts.distribution_major_version == "16") - name: Install dependencies on Ubuntu Bionic systems ansible.builtin.package: @@ -76,7 +76,7 @@ - libicu60 state: present update_cache: true - when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "18") + when: (ansible_facts.distribution == "Ubuntu" and ansible_facts.distribution_major_version == "18") - name: Install dependencies on Ubuntu Focal systems ansible.builtin.package: @@ -89,7 +89,7 @@ - libicu66 state: present update_cache: true - when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "20") + when: (ansible_facts.distribution == "Ubuntu" and ansible_facts.distribution_major_version == "20") - name: Install dependencies on Ubuntu Jammy systems ansible.builtin.package: @@ -101,7 +101,7 @@ - libicu70 state: present update_cache: true - when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "22") + when: (ansible_facts.distribution == "Ubuntu" and ansible_facts.distribution_major_version == "22") - name: Install dependencies on RHEL/CentOS/Fedora systems ansible.builtin.package: @@ -113,7 +113,7 @@ - libicu state: present update_cache: true - when: (ansible_distribution == "RedHat") or - (ansible_distribution == "CentOS") or - (ansible_distribution == "Fedora") or - (ansible_distribution == "Rocky") + when: (ansible_facts.distribution == "RedHat") or + (ansible_facts.distribution == "CentOS") or + (ansible_facts.distribution == "Fedora") or + (ansible_facts.distribution == "Rocky") diff --git a/tasks/install_runner.yml b/tasks/install_runner.yml index c5342cc..978a02b 100644 --- a/tasks/install_runner.yml +++ b/tasks/install_runner.yml @@ -29,7 +29,7 @@ remote_src: true mode: "0755" environment: - PATH: /usr/local/bin:/opt/homebrew/bin/:{{ ansible_env.HOME }}/bin:{{ ansible_env.PATH }} + PATH: /usr/local/bin:/opt/homebrew/bin/:{{ ansible_facts.user_dir }}/bin:{{ ansible_facts.env.PATH }} when: runner_version not in runner_installed.stdout or reinstall_runner - name: Configure custom env file if required @@ -109,7 +109,7 @@ args: chdir: "{{ runner_dir }}" changed_when: true - become: "{{ 'false' if ansible_system == 'Darwin' else 'true' }}" + become: "{{ 'false' if ansible_facts.system == 'Darwin' else 'true' }}" when: not runner_service_file_path.stat.exists - name: Read service name from file @@ -125,7 +125,7 @@ ignore_errors: "{{ ansible_check_mode }}" changed_when: true when: > - ansible_system != 'Darwin' and + ansible_facts.system != 'Darwin' and runner_state|lower == "started" and ansible_facts.services[(runner_service.content | b64decode) | trim ]['state'] != 'running' @@ -137,7 +137,7 @@ no_log: "{{ hide_sensitive_logs | bool }}" ignore_errors: "{{ ansible_check_mode }}" changed_when: true - when: ansible_system == 'Darwin' and runner_state|lower + when: ansible_facts.system == 'Darwin' and runner_state|lower - name: STOP and disable Github Actions Runner service # noqa no-changed-when ansible.builtin.command: "./svc.sh stop" @@ -154,7 +154,7 @@ args: chdir: "{{ runner_dir }}" changed_when: true - become: "{{ 'false' if ansible_system == 'Darwin' else 'true' }}" + become: "{{ 'false' if ansible_facts.system == 'Darwin' else 'true' }}" no_log: "{{ hide_sensitive_logs | bool }}" ignore_errors: "{{ ansible_check_mode }}" when: runner_version not in runner_installed.stdout and not runner_state|lower == "stopped" diff --git a/tasks/uninstall_runner.yml b/tasks/uninstall_runner.yml index 92da357..4251770 100644 --- a/tasks/uninstall_runner.yml +++ b/tasks/uninstall_runner.yml @@ -9,7 +9,7 @@ args: chdir: "{{ runner_dir }}" changed_when: true - become: "{{ 'false' if ansible_system == 'Darwin' else 'true' }}" + become: "{{ 'false' if ansible_facts.system == 'Darwin' else 'true' }}" when: runner_service_file_path.stat.exists - name: Check GitHub Actions runner file diff --git a/vars/main.yml b/vars/main.yml index 9646ddf..922e0b1 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -5,4 +5,4 @@ github_actions_architecture_map: x86_64: x64 armv7l: arm aarch64: arm64 -github_actions_architecture: "{{ github_actions_architecture_map[ansible_architecture] }}" +github_actions_architecture: "{{ github_actions_architecture_map[ansible_facts.architecture] }}"