Comments (8)
This was introduced with #254
from ansible-gitlab-runner.
What version of ansible do you use?
from ansible-gitlab-runner.
What version of ansible do you use?
I'm using
ansible [core 2.12.2]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.8/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.8.12 (default, Sep 16 2021, 10:46:05) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
jinja version = 2.10.3
libyaml = True
To be honest just used pre-packaged (dnf
) version, but I could upgrade if required more recent version
from ansible-gitlab-runner.
Can you run this two tasks to see if they pass on your system? (this is I think the issue on your end but I'm not 100% certain so that experiment would be helpful).
- file:
path: /tmp/foo1
state: touch
- blockinfile:
dest: "/tmp/foo1"
content: "{{ lookup('template', 'config.runners.docker.services.j2') if nondefinedvariable is defined }}"
state: "{{ 'present' if nondefinedvariable is defined else 'absent' }}"
marker: "# {mark} runners.docker.services"
insertafter: EOF
check_mode: no
from ansible-gitlab-runner.
Can you run this two tasks to see if they pass on your system? (this is I think the issue on your end but I'm not 100% certain so that experiment would be helpful).
- file: path: /tmp/foo1 state: touch - blockinfile: dest: "/tmp/foo1" content: "{{ lookup('template', 'config.runners.docker.services.j2') if nondefinedvariable is defined }}" state: "{{ 'present' if nondefinedvariable is defined else 'absent' }}" marker: "# {mark} runners.docker.services" insertafter: EOF check_mode: no
Same issue
# ansible-playbook --connection=local --inventory inventory.yml t.yml
PLAY [runner] *********************************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] ************************************************************************************************************************************************************************************************************************
ok: [gitlab.blabla]
TASK [file] ***********************************************************************************************************************************************************************************************************************************
changed: [gitlab.blabla]
TASK [blockinfile] ****************************************************************************************************************************************************************************************************************************
fatal: [gitlab.blabla]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: the inline if-expression on line 1 evaluated to false and no else section was defined.\n\nThe error appears to be in '/tmp/gitlab-ansible-playbook/t.yml': line 6, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n state: touch\n - blockinfile:\n ^ here\n"}
PLAY RECAP ************************************************************************************************************************************************************************************************************************************
gitlab.blabla : ok=2 changed=1 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
# cat t.yml
- hosts: runner
tasks:
- file:
path: /tmp/foo1
state: touch
- blockinfile:
dest: "/tmp/foo1"
content: "{{ lookup('template', 'config.runners.docker.services.j2') if nondefinedvariable is defined }}"
state: "{{ 'present' if nondefinedvariable is defined else 'absent' }}"
marker: "# {mark} runners.docker.services"
insertafter: EOF
check_mode: no
from ansible-gitlab-runner.
Alright, then I'm pretty certain that you issue is the Ansible/jinja version.
I run this experiment with
ansible [core 2.12.2]
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
jinja version = 3.1.2
libyaml = True
and there it works.
Maybe you can upgrade and see if it works.
from ansible-gitlab-runner.
Alright, then I'm pretty certain that you issue is the Ansible/jinja version. I run this experiment with
ansible [core 2.12.2] config file = None configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /usr/local/bin/ansible python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] jinja version = 3.1.2 libyaml = True
and there it works.
Maybe you can upgrade and see if it works.
Yes I think high chance related to jinja
version but I've to check how to upgrade because seems to be embedded with ansible because my pip3 show jinja2
does not return the same version.
I'll keep you in touch. But I think we can already close the issue if is related to old version of jinja
from ansible-gitlab-runner.
I will close this for the moment because it seems to be a version issue. Feel free to reopen it in case I'm wrong.
from ansible-gitlab-runner.
Related Issues (20)
- 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
- New registration workflow HOT 8
- New Release HOT 10
- Failed to find package 'gitlab-runner' to perform selection 'install' debian 12 Vagrant HOT 4
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.