Regarding file changes in Ansible

60 views
Skip to first unread message

Ashok Reddy

unread,
Nov 16, 2023, 8:47:55 AM11/16/23
to Ansible Project
Hi, 

I have been trying to implement the following: 

If any file change in git lab repo, then only we need to deploy the file in servers. 

How to write Ansible playbook?

Dick Visser

unread,
Nov 16, 2023, 9:04:30 AM11/16/23
to ansible...@googlegroups.com
that is very little information...

answers to these would help:

- what is in that gitlab repository?
- what is "the file"
- what are "servers"
- what does your inventory look like?

etc etc


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAKRLcHhXSrJSoAdd6toBHt9Bh8CsF%2B92T5Ga%3DTEvrzhwKQG9sw%40mail.gmail.com.

Evan Hisey

unread,
Nov 16, 2023, 11:10:16 AM11/16/23
to ansible...@googlegroups.com
Honestly sounds less like an ansible task and more like a git action or git runner job. Ansible natively has no idea what is in the git repo.

--

Rowe, Walter P. (Fed)

unread,
Nov 16, 2023, 2:05:35 PM11/16/23
to ansible...@googlegroups.com
I agree. This is a version control system action. That action could run an ansible playbook to push the changed file to an inventory of systems.

Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

Ashok Reddy

unread,
Nov 16, 2023, 7:29:56 PM11/16/23
to ansible...@googlegroups.com
Hi , 

Please find the following:

On Thu, 16 Nov 2023 at 10:04 PM, Dick Visser <dnmv...@gmail.com> wrote:
that is very little information...

answers to these would help:

- what is in that gitlab repository? configuration files, which are required to access our application 
- what is "the file": like EAxI config file, jboss standalone file
- what are "servers":RHEL servers 
- what does your inventory look like?: SIT, UAT envs 

Each environment has two servers

etc etc

Please let me know if you need any other information.


On Thu, 16 Nov 2023 at 14:47, Ashok Reddy <ashok...@gmail.com> wrote:
Hi, 

I have been trying to implement the following: 

If any file change in git lab repo, then only we need to deploy the file in servers. 

How to write Ansible playbook?

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAKRLcHhXSrJSoAdd6toBHt9Bh8CsF%2B92T5Ga%3DTEvrzhwKQG9sw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.

Todd Lewis

unread,
Nov 16, 2023, 11:00:03 PM11/16/23
to ansible...@googlegroups.com, uto...@gmail.com
Ashok,

As a gitlab and Ansible user, this sounds to me like more of a gitlab problem than an Ansible problem.

You should follow and read the first few links at the top of Gitlab CI Keyword Reference index document. They should give you some ideas about how to make things happen when commits are made to your projects.

Good luck,
--
Todd

Ashok Reddy

unread,
Nov 17, 2023, 12:11:04 AM11/17/23
to ansible...@googlegroups.com, uto...@gmail.com
Hi Todd, 

Thanks for providing your suggestion. 

But, There are a few of the templates, which are available in gitlab. If there is any change in the template file, then only to deploy in UAT servers. 
This is what i am trying to implement. Is this not possible to implement in Ansible side? 

Note: i did R&D and it suggested to implement synchronize module in ansible

Stephen Maher

unread,
Nov 17, 2023, 5:32:57 AM11/17/23
to 'Rowe, Walter P. (Fed)' via Ansible Project, uto...@gmail.com
Hi Ashok

What you need is some sort of orchestrator or you can use gitlab CI and runner to execute ansible / ansible-navigator / ansible-runner etc etc . Another option that I have implemented in the past for customers is using ansible-pull from the ansible controller and execute plays accordingly. Hopefully some ideas you might be able to explore.

https://www.ansible.com/blog/using-ansible-automation-platform-gitlab-ce-and-webhooks-to-deploy-iis-website



Regards


Ashok Reddy

unread,
Nov 17, 2023, 6:35:05 AM11/17/23
to ansible...@googlegroups.com, uto...@gmail.com
Thanks Stephen. Let me take a look.

Reply all
Reply to author
Forward
0 new messages