Having a look at the source code and looks like it is not supported yet. 
However docker-py support it so it is trivial to add it in - I guess in

 def create_containers(self, count=1):
        params = {'image':        self.module.params.get('image'),
                  'command':      self.module.params.get('command'),
                  'ports':        self.exposed_ports,
                  'volumes':      self.volumes,
                  'mem_limit':    
_human_to_bytes(self.module.params.get('memory_limit')),
                  'environment':  self.env,
                  'hostname':     self.module.params.get('hostname'),
                  'detach':       self.module.params.get('detach'),
                  'name':         self.module.params.get('name'),
                  'stdin_open':   self.module.params.get('stdin_open'),
                  'tty':          self.module.params.get('tty'),
                  }

add it in the params and it would be good.

Is the any demand for that feature?

Thanks




On Friday, 17 April 2015 11:32:38 UTC+10, Steve Kieu wrote:
>
> Hi team,
>
> I am sorry if it has been answered somewhere but my google search does not 
> show yet. How can I get something like --cap-add=NET_ADMIN when using 
> docker module to start a docker container
>
> my exmaple like below (not run and tested yet)
>
> - name: jenkins master - ubuntu
>   docker:
>     name: test-jenkinsmaster-ubuntu
>     command: '/scripts/run.sh "192.168.2.41/24"'
>     image: 10.10.4.229:5000/jumbo:base_ubuntu14
>     state: present
>     dns: 192.168.2.1
>     insecure_registry: yes
>     env: SHELL="/usr/sbin/sshd -D" GATEWAY="192.168.2.1" 
> DNS_SERVER="192.168.2.1" 
>
> as inside the docker image the start command /scripts/run.sh will take 
> first arg and set IP (that is a simple way I get static IP) for now. 
> However it needs --cap-add=NET_ADMIN and I do not want to give it all right 
> using privileged: yes.
>
> Also the --add-host options as well.
>
> Thanks a lot in advance.
>
>

-- 
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/466ca403-7193-483a-a595-07ea4d5e781f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to