semaphoreui/semaphore

Remove git playbooks requirement

jasonculligan opened this issue · 11 comments

I try to create a playbook, for example to run apt-get update on some servers, but I cannot access any part of semaphore that will allow me to create this playbook.

v2.3, Ubuntu 16.04 LTS 64bit. No error specifically but I cannot locate where to enter the contents of my playbook.

ok - so for "Playbook repository" in "Templates" I can enter /etc/ansible/playbooks (where I will keep playbooks), and I need to have "/etc/ansible/playbooks/playbook.yml" present before I can config playbook.yml as the "Playbook name" in the "templates"?

For the most basic template, with a local git directory:

  • Create an ssh key (can be the ssh key to access the inventory)
  • Create a repository, pointing "Repository" field to the local folder (note: must be a server git repository - init with git init --bare then commit to it)
  • Create an inventory which your playbook will access
  • Create a template with given repository and use things created above ^

I'm missing the git part. I don't use git to store my playbooks, just plain .yml files. Is this mandatory for semaphore?

Unfortunately it is, you could just use a local git server..

example:

# create a git repo
git init && git add --all && git commit -m "fc"
# create server git repo
mkdir -p /tmp/my_git.git && cd /tmp/my_git.git
# init repository
git init --bare
# go back to original folder
cd -
# add local origin
git remote add origin /tmp/my_git.git
# push to local folder
git push origin master

now point semaphore to /tmp/my_git.git and it will work. Just remember to update the local git repository after changing files.

I know why this is a pain, fortunately we can make this easier ;)

While this is irrelevant to your post, you really should manage your playbooks with Git.
You can create a private repo on Gitlab for free for this purpose.

The drawback I find is when testing these playbooks. As I work in a windows environment, I have to change -> commit -> push -> run.

i have done the above steps but still getting below error

automation@auhdcvhiste02:/opt/project/playbooks$ sudo git push origin master
Enumerating objects: 13, done.
Counting objects: 100% (13/13), done.
Delta compression using up to 16 threads
Compressing objects: 100% (13/13), done.
Writing objects: 100% (13/13), 3.87 KiB | 1.29 MiB/s, done.
Total 13 (delta 7), reused 0 (delta 0), pack-reused 0
To /tmp/my_git.git

  • [new branch] master -> master

error:

11:43:02 AM
Task 2147483622 added to queue
11:43:03 AM
Started: 2147483622
11:43:03 AM
Run TaskRunner with template: upgrade_test_servers
11:43:03 AM
Preparing: 2147483622
11:43:03 AM
Failed in finding static repository at /tmp/my_git.git: stat /tmp/my_git.git: no such file or directory
11:43:03 AM
Running playbook failed: stat /tmp/my_git.git: no such file or directory

Hi @raja24790 what you want to do?

Hi @raja24790 what you want to do?

I want to use my local repository which i have made in /opt/project/playbooks. But I am not able to configure it in semaphore. I tried every method mentioned.

I did all this also

create a git repo

git init && git add --all && git commit -m "fc"

create server git repo

mkdir -p /tmp/my_git.git && cd /tmp/my_git.git

init repository

git init --bare

go back to original folder

cd -

add local origin

git remote add origin /tmp/my_git.git

push to local folder

git push origin master

Then i added path in repository as /tmp/my_git.git but yet it is giving the error "Failed in finding static repository at /tmp/my_git.git: stat /tmp/my_git.git: no such file or directory

Could you please share detailed steps. Thanks in advance.