On Wed, Sep 17, 2014 at 3:21 PM, louis gueye <[email protected]> wrote:
> Hi James, > > Thank you for your insight. > Actually I could not use any ansible property/directive in the playbook to > run it successfully. > I had to run the whole ansible command with sudo... Which is not the best > option I guess. > > ansible is typically used for system management. So if you are doing something that needs more privileges you'll need to use it with an account that has sufficient privileges to perform those actions[1]. For docker, you can configure your docker server such that a normal user account can connect to it or you can configure it so that only an account with specific privileges (such as root) can do so. Ansible does not allow you to get around your operating systems system of privileges, it simply makes it easier to do things that you already have permission to do. [1]: One note here, ansible has facilities that allow you to run it as a normal user and switch to another user from inside ansible itself (using sudo or su). This isn't much different than running ansible as root when you're only talking to localhost but it can make a big difference when you're using ansible to manage many remote machines. In addition 2 strange things occur when I run this playbook: > - the wait_for directive hangs indefinitely so I had to comment it. > - I was expecting a running container so in order to check the container > status I listed containers (sudo docker ps -a): my container is there, > created but not running. (No wonder why the wait_for directive hangs) > > My next question to the community (if you don't mind helping me) is how do > I make sure my container is created and listening to port 22? > I tried "state=present" and "state=running" my container is still down off. > > This is actually a docker question. Many docker containers including the ubuntu ones from docker hub aren't configured like a virtual machine that you start up and it then runs constantly waiting for you to login and give it commands. Instead, they're designed for you to give it a single command which it then executes in the containers environment and then the container exits after . That command could be a one-off that runs briefly, does one thing and then exits or it could be a long running process that you can interact with as you would a service running on a normal machine. If you want a container that acts like a virtual machine running sshd that you can connect to you likely need to either build a container that starts up sshd as its command or look for a different container on docker hub that is already built for that purpose. -Toshio -- 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/CAG9juEoEPTUJNFywCQ4SdcLwLk_etZoMEkB8pcQD%2BgOYxNDJxw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
