Score:-2

How to write Ansible playbook to commit and push my new updates on gitlab repository

bw flag

How to write Ansible playbook to commit and push a gitlab repository?

I have Ansible tower template to launch my playbook, then playbook must do commit and push on different git repo. This git repo on successful push will trigger jenkins pipeline.

in flag
Which part with the [`git module`](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/git_module.html) do you have problems with? Please provide your playbook.
Aniket avatar
bw flag
I am new to ansible, need help in understanding how is it possible to write a file seating in git repo and pushing the upudated file in the same git repo, this should be achieved by playbook (writing and pushing in git repo)
Score:0
cn flag

Write a script to do edit, commit, probably push. In shell or whatever. Run this with Ansible's generic script module. Maybe your own custom module if you are feeling fancy and return JSON Ansible return values.

Ansible's git module only installs trees from a repo to a path on the target host. For cases in which the thing does not release proper package archives. Or as a VCS wrapper to help ansible-pull work. Currently it does not have commit features.

Consider if a commit only to trigger some pipeline system is your preferred solution. Glancing at Jenkins, they have an API, which could be used to trigger it. Without needing to give the automation commit access. Or, you might need to do the edits, so trigger on commit is useful.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.