I am using ansible playbook to deploy my app with docker in Jenkins, 
Recently I want to limit the log size of the app container, with "docker 
run" has "–log-opt max-size=xxxm" option, but How can I add the same 
function in ansible playbook?

I tried to set ansible playbook as below, but the test shows it not works.


  - name: start container
    docker_container:
      name: "{{docker_container}}"
      image: "{{docker_image}}"
      log_options:
        max-size: 256m
        max-file: 2
      volumes:
        - "/etc/timezone:/etc/timezone"
        - "/etc/localtime:/etc/localtime"
      published_ports:
        - "{{published_ports}}"
      recreate: yes


The location of log file of container which I want to limit the size is as 
the file below:

/var/lib/docker/containers/2fdcae9fb35f4954639a3ff254873f0ae8518f2ede011807/2fdcae9fb35f4954639a3ff254873f0ae8518f2ede0118072304077918deb20f-json.log


Thanks for your reply first :)

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f02df256-ab6f-42f4-b85f-a1521a212800%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to