diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 26b194d..c350c1b 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -3,19 +3,6 @@ user: ansible hosts: all become: yes - vars: - - runner_user: ansible - - github_repo: ansible-github_actions_runner-testrepo - - github_account: monolithprojects - roles: - - role: ansible-github_actions_runner - -- name: Uninstall - user: ansible - hosts: all - become: yes - tags: - - uninstall vars: - runner_user: ansible - github_repo: ansible-github_actions_runner-testrepo diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 90c4688..9be8fdf 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -46,9 +46,10 @@ platforms: # pre_build_image: yes provisioner: name: ansible + playbooks: + converge: converge.yml + cleanup: cleanup.yml log: false - # env: - # PERSONAL_ACCESS_TOKEN: $PERSONAL_ACCESS_TOKEN inventory: host_vars: CentOS8: diff --git a/tasks/install_runner.yml b/tasks/install_runner.yml index 72ead07..348060c 100644 --- a/tasks/install_runner.yml +++ b/tasks/install_runner.yml @@ -30,10 +30,11 @@ - install - name: Register runner - command: "{{ runner_dir }}/./config.sh --url {{ github_server }}/{{ github_account }}/{{ github_repo }} --token {{ registration.json.token }} --unattended" + command: "{{ runner_dir }}/./config.sh --url {{ github_server }}/{{ github_account }}/{{ github_repo }} \ + --token {{ registration.json.token }} --unattended" args: chdir: "{{ runner_dir }}" - # became: yes + become: yes become_user: "{{ runner_user }}" no_log: "{{ hide_sensitive_logs }}" when: ansible_hostname not in registered_runners.json.runners|map(attribute='name')|list @@ -41,10 +42,11 @@ - install - name: Replace registered runner - command: "{{ runner_dir }}/config.sh --url {{ github_server }}/{{ github_account }}/{{ github_repo }} --token {{ registration.json.token }} --unattended --replace" + command: "{{ runner_dir }}/config.sh --url {{ github_server }}/{{ github_account }}/{{ github_repo }} \ + --token {{ registration.json.token }} --unattended --replace" args: chdir: "{{ runner_dir }}" - # became: yes + become: yes become_user: "{{ runner_user }}" no_log: "{{ hide_sensitive_logs }}" when: replace_runner and ansible_hostname in registered_runners.json.runners|map(attribute='name')|list diff --git a/tasks/uninstall_runner.yml b/tasks/uninstall_runner.yml index 191d19a..29065ad 100644 --- a/tasks/uninstall_runner.yml +++ b/tasks/uninstall_runner.yml @@ -35,6 +35,7 @@ command: "./config.sh remove --token {{ registration.json.token }} --unattended" args: chdir: "{{ runner_dir }}" + become: yes become_user: "{{ runner_user }}" no_log: "{{ hide_sensitive_logs }}" when: ansible_hostname in registered_runners.json.runners|map(attribute='name')|list and runner_file.stat.exists