Comments (14)
Can you run the playook (maybe without -vvvv to reduce noise) and post the output (to see all the steps).
from ansible-gitlab-runner.
Thanks for your response, here is the whole log file from a job without "-vvvv".
Running with gitlab-runner 16.1.0 (865283c5)
on host,
Resolving secrets
00:00
Preparing the "docker" executor
00:03
Using Docker executor with image ...
Authenticating with credentials from job payload (GitLab Registry)
Pulling docker image .....
Using docker image .....
Preparing environment
Running on runner.......
Getting source from Git repository
00:02
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in .....
Checking out 2355fadd as detached HEAD ...
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:28
Using docker image .. ...
$ python --version
Python 3.11.6
$ ansible-playbook -i host.yml site.yml --check --extra-vars "ansible_user=$USER ansible_password=$PASSWORD ansible_become_password=$PASSWORD"
PLAY [all] *********************************************************************
TASK [Gathering Facts] *********************************************************
ok: [host]
TASK [riemers.gitlab-runner : Load platform-specific variables] ****************
ok: [host]
TASK [riemers.gitlab-runner : Install Gitlab Runner (Container)] ***************
skipping: [host]
TASK [riemers.gitlab-runner : Install GitLab Runner (Unix)] ********************
[DEPRECATION WARNING]: Specifying a list of dictionaries for vars is deprecated
in favor of specifying a dictionary. This feature will be removed in version
2.18. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
included: /root/.ansible/roles/riemers.gitlab-runner/tasks/main-unix.yml for plkrasap1080
TASK [riemers.gitlab-runner : (Debian) Refresh package cache] ******************
changed: [host]
TASK [riemers.gitlab-runner : (Debian) Get Gitlab repository installation script] ***
changed: [host]
TASK [riemers.gitlab-runner : (Debian) Install Gitlab repository] **************
changed: [host]
TASK [riemers.gitlab-runner : (Debian) Update gitlab_runner_package_name] ******
skipping: [host]
TASK [riemers.gitlab-runner : (Debian) Set gitlab_runner_package_name] *********
ok: [host]
TASK [riemers.gitlab-runner : (Debian) Unhold GitLab Runner version] ***********
ok: [host]
TASK [riemers.gitlab-runner : (Debian) Install GitLab Runner] ******************
fatal: [host]: FAILED! => {"changed": false, "msg": "No package matching 'gitlab-runner' is available"}
PLAY RECAP *********************************************************************
host : ok=8 changed=3 unreachable=0 failed=1 skipped=2 rescued=0 ignored=0
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit code 1
from ansible-gitlab-runner.
If you can get inside the docker container, you can check if you can find the name of the gitlab runner or just do a search etc. Then you know at least some more where the error originates from.
from ansible-gitlab-runner.
BTW: Installing within the docker container is tricky because even though you fix this, the systemd task will fail (I doubt that you have systemd available inside your container)...
from ansible-gitlab-runner.
Maybe I didn't explained my use case well enough, sorry.
The way I would like to use this role:
I would like to install gitlab-runner instances and manage them from the pipeline on gitlab.
To do this, I use a docker container as a host for the Ansible, then I connect from this container to the computers (using ssh) on which I want to install gitlab-runner instances with Ansible.
Therefore I would say I don't need systemd inside this host container, gitlab-instances will be running on a ubuntu server.
The error above that I mentioned is not from a container, it is an error from the server shell I think.
from ansible-gitlab-runner.
Ohh, I see. Thx.
from ansible-gitlab-runner.
What is the output of those two commands for you:
xxx@runner-01:/etc/apt/sources.list.d$ cat runner_gitlab-runner.list
# this file was generated by packages.gitlab.com for
# the repository at https://packages.gitlab.com/runner/gitlab-runner
deb [signed-by=/usr/share/keyrings/runner_gitlab-runner-archive-keyring.gpg] https://packages.gitlab.com/runner/gitlab-runner/ubuntu/ jammy main
deb-src [signed-by=/usr/share/keyrings/runner_gitlab-runner-archive-keyring.gpg] https://packages.gitlab.com/runner/gitlab-runner/ubuntu/ jammy main
xxx@gl-01:/etc/apt/sources.list.d$ sudo apt install gitlab-runner
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
gitlab-runner is already the newest version (16.4.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
from ansible-gitlab-runner.
First command:
user@host:/etc/apt/sources.list.d$ cat runner_gitlab-runner.list
cat: runner_gitlab-runner.list: No such file or directory
Second command:
user@host:/etc/apt/sources.list.d$ sudo apt install gitlab-runner
[sudo] password for t-cicgwl:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package gitlab-runner
it looks like it can't find it
from ansible-gitlab-runner.
after "sudo apt-get update" there is no difference, still the same error
PS. I've found similar issue on gitlab https://gitlab.com/gitlab-org/gitlab-runner/-/issues/3067
from ansible-gitlab-runner.
I've found the root cause, I was running ansible-playbook command with --check parameter, which is not downloading anything from urls, he just checks them. That's why gitlab-runner package was missing.
Maybe it would be a nice feature to allow to use this role with "--check".
But without the --check parameter I have different error:
TASK [riemers.gitlab-runner : (Debian) Refresh package cache] ******************
fatal: [host]: FAILED! => {"changed": false, "msg": "Failed to lock apt for exclusive operation: Failed to lock directory /var/lib/apt/lists/: E:Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)"}
from ansible-gitlab-runner.
(13: Permission denied)
My guess: You don't run it as root
from ansible-gitlab-runner.
It worked, I've had become_user in inventory file and it was causing this error, now the role installs gitlab-runner but did not respect vars from main.yml. The config.toml after a succesful run is almost empty, it contains only
)
item=concurrent = 8
check_interval = 0
shutdown_timeout = 0
[session_server]
session_timeout = 1800
)
no runners registered. Therefore I guess it does not respect vars including gitlab-registration token, gitlab-runner version and gitlab url.
That's how I added the vars file, I just copied the relative path to main.yml.
- hosts: all
become: true
vars_files:
- roles/common/riemers.gitlab-runner/vars/main.yml
roles:
- { role: riemers.gitlab-runner }
any ideas?
from ansible-gitlab-runner.
Did you find the problem?
from ansible-gitlab-runner.
Yes, i solved the problem just by creating a directory "group_vars" and inside, i've created "all" variables file containing variables, then added it to vars_files and it worked. First instance of gitlab-runner is up and running. So my goal is reached.
I also found out that i cant update runner tags when running update "by_config_toml" with gitlab-runner 16.4, but "by_register" works fine, so i will stick to the second one.
from ansible-gitlab-runner.
Related Issues (20)
- Support for AlmaLinux HOT 3
- Support for (pre,post)_*_script in gitlab-runner config HOT 2
- Set additional services is failing due to missing variable HOT 8
- Invalid config.toml for azure and gcp cache HOT 3
- How to set custom_build_dir_enabled as variable HOT 1
- Error when upgrading from gitlab-runner version 15.0.0 to 16.6.0 HOT 2
- Default branch name HOT 5
- Debian Unhold: Failed to find package from ansible-core >=2.16 HOT 1
- Support for docker tmpfs options HOT 2
- Galaxy role renamed back from ansible-gitlab-runner to gitlab-runner HOT 10
- Reactivating Tests: Topic "systemd and docker" HOT 2
- Causes failures when included by ansible-lint HOT 1
- Can't find package `gitlab-runner` HOT 5
- tls_ca_file not included in container registration HOT 1
- Runtime owner and group for container setup HOT 1
- Deploy multiple executors to single VM
- Fails when GPG key of https://packages.gitlab.com/runner/gitlab-runner is expired HOT 7
- Gitlab-runner does not get deployed correctly after adding additional lines to the configuration HOT 1
- Runner is not being unregistered from Gitlab instance, when setting `state: absent` HOT 2
- (Debian) Install GitLab Runner fail when update in 22.04 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-gitlab-runner.