Coder Social home page Coder Social logo

Comments (14)

guenhter avatar guenhter commented on May 27, 2024

Can you run the playook (maybe without -vvvv to reduce noise) and post the output (to see all the steps).

from ansible-gitlab-runner.

Listecky avatar Listecky commented on May 27, 2024

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.

riemers avatar riemers commented on May 27, 2024

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.

guenhter avatar guenhter commented on May 27, 2024

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.

Listecky avatar Listecky commented on May 27, 2024

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.

guenhter avatar guenhter commented on May 27, 2024

Ohh, I see. Thx.

from ansible-gitlab-runner.

guenhter avatar guenhter commented on May 27, 2024

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.

Listecky avatar Listecky commented on May 27, 2024

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.

Listecky avatar Listecky commented on May 27, 2024

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.

Listecky avatar Listecky commented on May 27, 2024

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.

guenhter avatar guenhter commented on May 27, 2024
(13: Permission denied)

My guess: You don't run it as root

from ansible-gitlab-runner.

Listecky avatar Listecky commented on May 27, 2024

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.

guenhter avatar guenhter commented on May 27, 2024

Did you find the problem?

from ansible-gitlab-runner.

Listecky avatar Listecky commented on May 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.