Docker+ansible

46 views
Skip to first unread message

Sunitha Iyer

unread,
Nov 1, 2019, 7:37:35 AM11/1/19
to Ansible Project
Hi

Is it possible to run more than one docker compose files from ansible?

Felix Fontein

unread,
Nov 1, 2019, 6:06:04 PM11/1/19
to ansible...@googlegroups.com
Hi,

> Is it possible to run more than one docker compose files from ansible?

what makes you think it is not possible?

Cheers,
Felix


Sunitha Iyer

unread,
Nov 2, 2019, 7:28:40 AM11/2/19
to Ansible Project
Hi Felix

Thanks, I am struggling to find the syntax

Stefan Hornburg (Racke)

unread,
Nov 2, 2019, 7:46:20 AM11/2/19
to ansible...@googlegroups.com
On 11/2/19 1:28 PM, Sunitha Iyer wrote:
> Hi Felix
>
> Thanks, I am struggling to find the syntax

Hello Sunitha,

search for "Ansible docker compose", this should provide enough examples to build upon.

For specific help, post your playbook and the output and explain why you did it that way.

Regards
Racke

>
> On Friday, November 1, 2019 at 10:06:04 PM UTC, Felix Fontein wrote:
>
> Hi,
>
> > Is it possible to run more than one docker compose files from ansible?
>
> what makes you think it is not possible?
>
> Cheers,
> Felix
>
>
> --
> 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 <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/dd098722-6c01-4f13-8cd2-43d31d6b1505%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/dd098722-6c01-4f13-8cd2-43d31d6b1505%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc

Sunitha Iyer

unread,
Nov 2, 2019, 8:23:33 AM11/2/19
to Ansible Project
Hi stefan, below is the playbook, 

One way is to find a master playbook and include the other playbooks whichever is required. suppose if i have 10 microservices and I will have 10 compose files and as a part of a bug fix I don't need to deploy all of them may be 2 or 3 based on the defects. so I thought having 10 different play books for 10 compse files and run the required ones.  If you have any better idea do suggest me please.

- name: Run a docker compose file
  hosts: dockerVM
  become: yes
  become_method: su

  tasks:
    - set_fact: compose_dir=/root/DockercomposeFile
    - name: create a directory
      file:
        path: "{{compose_dir}}"
        state: directory

    - name: copy docker compose file
      file:
       src: /root/DockerComposeFile
       dest: /root/DockerComposeFile
       mode: "0755"

     - name: Run a docker compose file
       docker_service:
         project_src: "{{ compose_dir }}"
         state: present
       build: no
       register:output

On Saturday, November 2, 2019 at 11:46:20 AM UTC, Stefan Hornburg (Racke) wrote:
On 11/2/19 1:28 PM, Sunitha Iyer wrote:
> Hi Felix
>
> Thanks, I am struggling to find the syntax

Hello Sunitha,

search for "Ansible docker compose", this should provide enough examples to build upon.

For specific help, post your playbook and the output and explain why you did it that way.

Regards
        Racke

>
> On Friday, November 1, 2019 at 10:06:04 PM UTC, Felix Fontein wrote:
>
>     Hi,
>
>     > Is it possible to run more than one docker compose files from ansible?
>
>     what makes you think it is not possible?
>
>     Cheers,
>     Felix
>
>
> --
> 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

Stefan Hornburg (Racke)

unread,
Nov 2, 2019, 8:41:05 AM11/2/19
to ansible...@googlegroups.com
On 11/2/19 2:23 PM, Sunitha Iyer wrote:
> Hi stefan, below is the playbook, 
>
> One way is to find a master playbook and include the other playbooks whichever is required. suppose if i have 10
> microservices and I will have 10 compose files and as a part of a bug fix I don't need to deploy all of them may be 2 or
> 3 based on the defects. so I thought having 10 different play books for 10 compse files and run the required ones.  If
> you have any better idea do suggest me please.
>

Hello Sunitha,

I strongly suggest to setup an Ansible role which includes the tasks below and apply it in a loop in the playbook.

Different playbooks complicate your setup and are harder to maintain. Settings which vary between your micro services
can be kept in variables / inventory.

Regards
Racke
> > ansible...@googlegroups.com <javascript:> <mailto:ansible-proje...@googlegroups.com <javascript:>>.
> <https://groups.google.com/d/msgid/ansible-project/dd098722-6c01-4f13-8cd2-43d31d6b1505%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/ansible-project/dd098722-6c01-4f13-8cd2-43d31d6b1505%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> 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 <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/6a395899-7d19-4418-b5e6-b062029fcaa3%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/6a395899-7d19-4418-b5e6-b062029fcaa3%40googlegroups.com?utm_medium=email&utm_source=footer>.
signature.asc

Sunitha Iyer

unread,
Nov 2, 2019, 8:51:57 AM11/2/19
to Ansible Project
thank you so much and I really appreciate it.
>     > ansible...@googlegroups.com <javascript:> <mailto:ansible-project+unsub...@googlegroups.com <javascript:>>.
>     > To view this discussion on the web visit
>     > https://groups.google.com/d/msgid/ansible-project/dd098722-6c01-4f13-8cd2-43d31d6b1505%40googlegroups.com
>     <https://groups.google.com/d/msgid/ansible-project/dd098722-6c01-4f13-8cd2-43d31d6b1505%40googlegroups.com>
>     >
>     <https://groups.google.com/d/msgid/ansible-project/dd098722-6c01-4f13-8cd2-43d31d6b1505%40googlegroups.com?utm_medium=email&utm_source=footer
>     <https://groups.google.com/d/msgid/ansible-project/dd098722-6c01-4f13-8cd2-43d31d6b1505%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
>
>     --
>     Ecommerce and Linux consulting + Perl and web application programming.
>     Debian and Sympa administration. Provisioning with Ansible.
>
> --
> 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

uday kiran

unread,
Nov 3, 2019, 2:25:07 AM11/3/19
to ansible...@googlegroups.com
Hi all,

I am not able to set this.
Can you please guide.


>     > ansible...@googlegroups.com <javascript:> <mailto:ansible-proje...@googlegroups.com <javascript:>>.
>     > To view this discussion on the web visit
>     > https://groups.google.com/d/msgid/ansible-project/dd098722-6c01-4f13-8cd2-43d31d6b1505%40googlegroups.com
>     <https://groups.google.com/d/msgid/ansible-project/dd098722-6c01-4f13-8cd2-43d31d6b1505%40googlegroups.com>
>     >
>     <https://groups.google.com/d/msgid/ansible-project/dd098722-6c01-4f13-8cd2-43d31d6b1505%40googlegroups.com?utm_medium=email&utm_source=footer
>     <https://groups.google.com/d/msgid/ansible-project/dd098722-6c01-4f13-8cd2-43d31d6b1505%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
>
>     --
>     Ecommerce and Linux consulting + Perl and web application programming.
>     Debian and Sympa administration. Provisioning with Ansible.
>
> --
> 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
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/6a395899-7d19-4418-b5e6-b062029fcaa3%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/6a395899-7d19-4418-b5e6-b062029fcaa3%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

--
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/f3f7a06e-b5ad-452c-a803-b5b1f0da24db%40googlegroups.com.
Screenshot_20191103-125328__01.jpg
Reply all
Reply to author
Forward
0 new messages