Tag: ansible

Unable to fetch code from git repository for a specific SHA in ansible

I want to fetch code using a particular SHA-id.This is what I am trying – git: repo: http://<git-url>/Vara-Internal/mongo-db-dev.git dest: “{{ app_path }}/{{ app_dir }}” version: “{{ GIT_TAG }}” refspec: ‘+refs/heads/{{ GIT_TAG }}:refs/remotes/origin/{{ GIT_TAG }}’ update: yes force: true register: cloned It throwing me this error FAILED! => {“changed”: false, “cmd”: [“/usr/bin/git”, “fetch”, “–tags”, “origin”, “+refs/heads/dbde451f203a112d0838fb09bc19ed28bd231e6e:refs/remotes/origin/dbde451f203a112d0838fb09bc19ed28bd231e6e”], […]

Offending lines appears while running ansible playbook to git clone a project

Hi I am trying to clone a project with ansible but I keep getting the below error ERROR! this task ‘git’ has extra params, which is only allowed in the following modules: command, shell, script, include, include_vars, add_host, group_by, set_fact, raw, meta The error appears to have been in ‘/vagrant/ansible/roles/rolename/tasks/main.yml’: line 67, column 5, but […]

Ansible Repo – structure

The suggested repo by Ansible can be seen at:- http://docs.ansible.com/ansible/playbooks_best_practices.html production # inventory file for production servers staging # inventory file for staging environment group_vars/ group1 # here we assign variables to particular groups group2 # “” host_vars/ hostname1 # if systems need specific variables, put them here hostname2 # “” library/ # if any […]

ansible – iterate all hosts and retrieve data from results

I want to use ansible to get all the remotes of the git-repositories on a server. On a server there might be a lot of git-repos in a special folder /home/vhosts/cms/ and in each repo there might be multiple remotes for the git-repo. So I want to loop over all hosts and there loop over […]

Git Ansible Clone issue

I’ve a git repo and following is my ansible git code. — – name: read-write git checkout from repo git: repo: “{{repo_url}}” dest: “{{webapps_dir}}/{{app_name}}” accept_hostkey: yes force: yes remote: “{{repo_remote}}” version: “{{repo_branch}}” register: gitrepo When I run the above task, it hangs-up/waits endlessly. I tried debugging and found out that when I add git host […]

Git clean/smudge filters for ansible vault secrets

I am trying to setup clean/smudge filter in git to have automatic encrypting and decrypting of files containing secrets thru ansible-vault command. Peculiarity of the ansible-vault command is that it is not idempotent (it creates a different binary each time it is invoked on the same data). I started with the implementation suggested in this […]

How can I include the development branch of Ansible with my playbooks when checked out via Git?

I’ve been developing several Ansible playbooks and require that they’re run with a development version of Ansible. On my laptop that’s not an issue, but I’m now attempting to setup a CI task in Bamboo that will consume the Playbooks as well any time changes are committed to our Git repo. My thought was to […]

Ansible deployment git clone: “local variable 'remote_head' referenced before assignment”

I’ve got a git clone task defined in my Ansible playbook: – name: Clone website git repository git: > dest=/var/www/mywebsite repo=git@github.com:MyOrganisation/MyWebsite.git update=yes force=yes accept_hostkey=yes version=”{{ git_branch }}” become: yes become_user: www-data register: cloned This works perfectly fine the first time I deploy this to a machine, but when I run it a second time (to […]

NodeJS Production Deployment Best Practice

I’m looking for ways in which to deploy some web services into production in a consistent and timely manner. I’m currently implementing a deployment pipeline that will end with a manual deployment action of a specific version of the software to a number of virtual machines provisioned by Ansible. The idea is to provision x […]

ansible git clone Permission denied issue

I am trying to setup a dev environment using ansible and vagrant. Now i am stuck at cloning a git repo from bitbucket. Below are Vagrantfile and ansible settings and things i have tried. In my Vagrantfile i have config.ssh.forward_agent = true In my deploy.yml i have – name: ensure bitbucket is a known host […]

Git Baby is a git and github fan, let's start git clone.