GithubHelp home page GithubHelp logo

Comments (16)

davidwinterstein avatar davidwinterstein commented on August 23, 2024 2

I'd prefer Semaphore to read the settings from the file so I don't have to maintain them in one more place.
Also I have far more settings in there, those are just the most important.

I think the solution to cd somewhere first would make most sense, maybe a config option like working directory or something?
Has been suggested in #1984, too.

from semaphore.

tboerger avatar tboerger commented on August 23, 2024 1

Not directly a solution for loading the ansible.cfg, but all mentioned configs you guys try to apply you should be able to change via environment variables.

from semaphore.

dwedia avatar dwedia commented on August 23, 2024 1

Similar Issue for me, looks like Semaphore is creating an empty ansible.cfg in /tmp/semaphore/ansible.cfg you can over-mount from the host as a workarround.

I attempted this, but it still ignores it.
I Use exec'ed in to the container and checked the contents of /tmp/semaphore/ansible.cfg after volume mounting it. I see my ansible.cfg file there, but Semaphore still ignores it.

from semaphore.

Harfusha avatar Harfusha commented on August 23, 2024 1

Not directly a solution for loading the ansible.cfg, but all mentioned configs you guys try to apply you should be able to change via environment variables.

But each project + playbook is creating new folder in which ansible.cfg is stored. For this solution to work i would need to make new enviroment for each playbook in project and set its path to correct one.

Solution i found so far is to create enviromental variable ANSIBLE_CONFIG = /tmp/semaphore/repository_3_*
[SEMAPHORE_PLAYBOOK_PATH] + 'repository_' +[REPOSITORY NUMBER] + '_*' to get config from any repository that is already checked out.

But this works until you edit something in config - you would need to clear all checked out repositories to make sure it loads config from last commit

from semaphore.

sdiepend avatar sdiepend commented on August 23, 2024 1

I am also setting up Semaphore for the first time and testing it out, I am running into the same issue. I have a folder structure where separate internal and external roles and this is set in the ansible.cfg

└── roles
    ├── external
    └── internal
[defaults]
roles_path = roles/internal:roles/external:roles

from semaphore.

Fabl0s avatar Fabl0s commented on August 23, 2024

Similar Issue for me, looks like Semaphore is creating an empty ansible.cfg in /tmp/semaphore/ansible.cfg you can over-mount from the host as a workarround.

from semaphore.

davidwinterstein avatar davidwinterstein commented on August 23, 2024

Similar issue here. Just getting started with Semaphore, so I might be missing a setting or something.

I got a repository that contains a subfolder with all the ansible stuff, something like this:

repo/
repo/av2/
repo/av2/ansible.cfg
repo/av2/inventory/
repo/av2/plays/
repo/av2/plays/ansible.cfg
repo/av2/plugins/
repo/av2/roles/

Where repo/av2/ansible.cfg contains this:

[defaults]
inventory = ./inventory/
roles_path = ./roles/:/etc/ansible/roles/
filter_plugins = ./plugins/filter/
vault_password_file = ./.ansible.vault.pass.txt

And repo/av2/plays/ansible.cfg contains this:

[defaults]
inventory = ../inventory/
roles_path = ../roles/:/etc/ansible/roles/
filter_plugins = ../plugins/filter/
vault_password_file = ../.ansible.vault.pass.txt

It works fine on my workstation but Semaphore seems to be ignoring the ansible.cfg files; I have a task setup to execute a playbook at repo/av2/plays/full.yml that immediately fails when including roles from repo/av2/roles/:

11:45:45 AM
TASK [system] ******************************************************************
11:45:45 AM
ERROR! the role 'system' was not found in /tmp/semaphore/repository_2_5/av2/plays/roles:/tmp/semaphore/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/tmp/semaphore/repository_2_5/av2/plays
11:45:45 AM
11:45:45 AM
The error appears to be in '/tmp/semaphore/repository_2_5/av2/plays/full.yml': line 8, column 15, but may
11:45:45 AM
be elsewhere in the file depending on the exact syntax problem.
11:45:45 AM
11:45:45 AM
The offending line appears to be:
11:45:45 AM
11:45:45 AM
      ansible.builtin.include_role:
11:45:45 AM
        name: "system"
11:45:45 AM
              ^ here

from semaphore.

davidwinterstein avatar davidwinterstein commented on August 23, 2024

I just saw that #1036 suggests that ansible.cfg has to be located in the repository root. The Ansible documentation just states it reads ansible.cfg from the "current directory".

Is there a way to tell Semaphore to cd av2/ first?

from semaphore.

davidwinterstein avatar davidwinterstein commented on August 23, 2024

I tested with an ansible.cfg like this at the root of the repository:

[defaults]
inventory = ./av2/inventory/
roles_path = ./av2/roles/:/etc/ansible/roles/
filter_plugins = ./av2/plugins/filter/
vault_password_file = ./av2/.ansible.vault.pass.txt

Still does not work, same error. So Semaphore seems to be ignoring the config completely?
Running v2.9.113-beta.

from semaphore.

ramiuslr avatar ramiuslr commented on August 23, 2024

Hey guys thank's for your interest in this issue, I confirm as I said in my first post that my ansible.cfg is also in the root of my repository, and that it works fine on my laptop.

Not directly a solution for loading the ansible.cfg, but all mentioned configs you guys try to apply you should be able to change via environment variables.

@tboerger thank for your advice, I'm gonna try this as a workaround !

However I agree with @davidwinterstein I think it would be great to manage general Ansible config in a file in the repo, that would be easier to port and maintain in my opinion.

from semaphore.

agarzon-orangerine avatar agarzon-orangerine commented on August 23, 2024

Same issue, I have my own custom ansible.cfg and since recent semaphore update all stop working. Inventory cannot find the proper ssh keys.

from semaphore.

dwedia avatar dwedia commented on August 23, 2024

Same issue here.
ansible.cfg contains this line:
roles_path = /opt/ansiblectrl/roles:./roles:roles
which worked just fine on v.2.9.75, but isnt working anymore on v.2.9.112.

ERROR! the role 'aptUpdate' was not found in /tmp/semaphore/repository_1_1/playbooks/roles: /tmp/semaphore/.ansible/roles: /usr/share/ansible/roles: /etc/ansible/roles: /tmp/semaphore/repository_1_1/playbooks

from semaphore.

agarzon-orangerine avatar agarzon-orangerine commented on August 23, 2024

Same issue here. ansible.cfg contains this line: roles_path = /opt/ansiblectrl/roles:./roles:roles which worked just fine on v.2.9.75, but isnt working anymore on v.2.9.112.

ERROR! the role 'aptUpdate' was not found in /tmp/semaphore/repository_1_1/playbooks/roles: /tmp/semaphore/.ansible/roles: /usr/share/ansible/roles: /etc/ansible/roles: /tmp/semaphore/repository_1_1/playbooks

In effect the version v2.9.75 works with my ansible repository and makes use of my ansible.cfg 👍 I might need to stick to that version until this is fixed.

from semaphore.

dwedia avatar dwedia commented on August 23, 2024

Same issue here. ansible.cfg contains this line: roles_path = /opt/ansiblectrl/roles:./roles:roles which worked just fine on v.2.9.75, but isnt working anymore on v.2.9.112.
ERROR! the role 'aptUpdate' was not found in /tmp/semaphore/repository_1_1/playbooks/roles: /tmp/semaphore/.ansible/roles: /usr/share/ansible/roles: /etc/ansible/roles: /tmp/semaphore/repository_1_1/playbooks

In effect the version v2.9.75 works with my ansible repository and makes use of my ansible.cfg 👍 I might need to stick to that version until this is fixed.

I am just very happy that I encountered this bug in my homelab, where I can just go back to using ansible CLI.
I am going to stay on v.2.9.75 in my work production setup for now...

from semaphore.

Fabl0s avatar Fabl0s commented on August 23, 2024

Similar Issue for me, looks like Semaphore is creating an empty ansible.cfg in /tmp/semaphore/ansible.cfg you can over-mount from the host as a workarround.

I attempted this, but it still ignores it.
I Use exec'ed in to the container and checked the contents of /tmp/semaphore/ansible.cfg after volume mounting it. I see my ansible.cfg file there, but Semaphore still ignores it.

Works for me on the current 2.9.112 Docker Image at least, but I didn't set an EnvVar for the Config anywhere else.

from semaphore.

dwedia avatar dwedia commented on August 23, 2024

Not directly a solution for loading the ansible.cfg, but all mentioned configs you guys try to apply you should be able to change via environment variables.

Could you elaborate on this? I am not sure I understand what you mean here?

from semaphore.

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.