Automate your Docker deployments with Ansible

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 ก.พ. 2025

ความคิดเห็น • 77

  • @christianlempa
    @christianlempa  3 ปีที่แล้ว +13

    Note, if you haven't installed ansible before via pip and you're doing a fresh installation via pip, make sure you add this line to your .bashrc or .zshrc file!
    export PATH=$PATH:$HOME/.local/bin

    • @mmrk_
      @mmrk_ 3 ปีที่แล้ว

      Hello! Was wondering what does `export PATH=$PATH:$HOME/.local/bin` do for us in this case? Is there a particular spot in the .bashrc config that we should add this line?

    • @mmrk_
      @mmrk_ 3 ปีที่แล้ว +4

      After some research. "export PATH=$PATH:$HOME/.local/bin" will add Ansible to your Path and will let you use the "ansible" command. You can add this line to the top of the .bashrc file. You have to use the following command after adding it to your .bashrc file in order for it to work. ". .bashrc" or `source .bashrc` Hope this helps others that ran into the same roadblock.

    • @christianlempa
      @christianlempa  3 ปีที่แล้ว

      @@mmrk_ Thanks for sharing! :)

    • @devvar912
      @devvar912 ปีที่แล้ว

      Thanks for your work! But can you explain why it says Unable to connect, when i installed portainer and trying to check connection? Not on vm, neither on host

    • @kjakobsen
      @kjakobsen ปีที่แล้ว

      I'm installing a control node on WSL Ubuntu 22.04, after adding the path it works perfect. :)

  • @unit7psyclone35
    @unit7psyclone35 3 ปีที่แล้ว +3

    Excellent Tutorial for Ansible and Docker. Thanks Again Christian.

  • @TuxTechLabs
    @TuxTechLabs ปีที่แล้ว +1

    Cool things shared by Christian as always.

  • @Phillisteum
    @Phillisteum 3 ปีที่แล้ว +5

    Great video! Docker stack definition in an Ansible playbook?! Wow! So much potential to automate deployments and update a running stack.

    • @christianlempa
      @christianlempa  3 ปีที่แล้ว +1

      Thank you so much! :) That's indeed pretty useful!

  • @rob280
    @rob280 ปีที่แล้ว

    Enjoyed your video, was not able to find your docker-install.yaml it your boiler plate folders but did find enough to get docker installed then was able to read your video to get the python package manager and python sdk installed. Overall this video was well done and had a lot of information in it. Thank you.

  • @annahri
    @annahri 3 ปีที่แล้ว

    So much interesting topics on your channel. Subscribed!

  • @АлександрВыскребцев
    @АлександрВыскребцев 3 ปีที่แล้ว +1

    Благодарю, очень полезное видео!!
    I grateful to you for this a very useful video!

  • @jeremyr7958
    @jeremyr7958 2 ปีที่แล้ว +2

    Question: If you are not using vagrant, which many don't, what do you enter in the config file instead of the vagrant private key file path?

  • @Ultimaus
    @Ultimaus ปีที่แล้ว +1

    So I'm just diving into what I need to setup a home lab. Honestly the technical stuff is a treat. Drilling holes for and mapping the cables and drywall is the unwanted brain challenge. I am just getting my feet wet into deploying virtual machines using, home assistant, Linux cli, docker and... well basically everything your channel is about. But my skills are currently just trying to swim through Linux and docker and docker networking. I was looking through some ansible content online and as we tech guys are... we understand why automation is powerful. We understand the power of macro commands and scripted deployment. But as selfish creatures with undefined capacity I still didn't understand why ansible? As these questions are always user defined we just need someone to show how they use it and why. I don't know what it is exactly in your video that made me connect the dots and shout ah hah! But I want you to know it happened and I want to thank you for your time and effort.

  • @kjakobsen
    @kjakobsen ปีที่แล้ว

    The YAML syntax requirements gives me a headache. I oftens find myself, staring at what i typed in, and can't spot what i seemed to have mistyped. How do we overcome this?

  • @haralc
    @haralc ปีที่แล้ว +3

    I'm surprised even after a year later after this video that the "installing" documentation don't give an option to get Ansible as a container image, so people don't really have to care what python version is installed or whether it's even installed.

  • @dedpossum66
    @dedpossum66 3 ปีที่แล้ว

    Excellent video! I appreciate it.

  • @gr33nt3a__1
    @gr33nt3a__1 ปีที่แล้ว

    Hi Christian, when using this playbook it fails at "No package matching 'docker-ce' is available". How would I circumvent this issue? Thanks in advance!

  • @sudeep_jadhav
    @sudeep_jadhav 7 หลายเดือนก่อน

    Docker with Terraform can be done?

  • @andyruiz3174
    @andyruiz3174 3 ปีที่แล้ว

    Sehr gutes Video... hast die ein Abo verdient

  • @mohdasgharnaqvi5955
    @mohdasgharnaqvi5955 3 ปีที่แล้ว +1

    U r really helpful thanks

  • @Mohan-nf6cu
    @Mohan-nf6cu 3 ปีที่แล้ว

    Thanks a lot. Excellent explanation:) :)

  • @andreaghensi7579
    @andreaghensi7579 2 ปีที่แล้ว

    great tutorial as always! I ran into an error similar of what you talk about at 14:30, but mine occurred because I was adding my ansible user to the docker group just before using the docker_container module (I'm trying a zero-to-homelab playbook here)... all I had to do to solve this was to add a reset_connection task to ensure the ansible user had the right permissions.

    • @christianlempa
      @christianlempa  2 ปีที่แล้ว

      Thanks! Sounds interesting, I was able to fix it all by installing the right packages.

  • @HoaPham-yb1op
    @HoaPham-yb1op ปีที่แล้ว

    I follow exactly the steps in your video but I'm getting this error:
    msg": "Failed to import the required Python library (requests) on vm-test-rh1's Python /usr/bin/python3.9. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"
    Can you guess why?

  • @ronaldagorsah7954
    @ronaldagorsah7954 10 หลายเดือนก่อน

    Thanks for the video but the boilerplate is gone and now i misss the boilerplate to install docker

  • @jamesT008
    @jamesT008 3 ปีที่แล้ว

    Great....very informative

  • @fauzifirdaus8200
    @fauzifirdaus8200 3 ปีที่แล้ว +1

    Can u give us tutorial how to connect another server to main portainer and how best practice use watchtower if we want to manage docker in few different server?

    • @christianlempa
      @christianlempa  3 ปีที่แล้ว

      I've done a video on Watchtower, that might help you: th-cam.com/video/5lP_pdjcVMo/w-d-xo.html
      And also on Portainer Remote Access: th-cam.com/video/kKDoPohpiNk/w-d-xo.html
      Hope that is what you're searching for 😀

  • @Angelas20
    @Angelas20 3 ปีที่แล้ว +1

    What shell prompt do you use for nice upper blue part?

    • @christianlempa
      @christianlempa  3 ปีที่แล้ว +1

      I've done a video about my setup, here you'll find it :) th-cam.com/video/oF6gLyhQDdw/w-d-xo.html

  • @frenchkaonashi5495
    @frenchkaonashi5495 ปีที่แล้ว

    My comment is so late, but i want to thank you and ask this:
    What is the tool ur using to get linux command suggestions?

    • @christianlempa
      @christianlempa  ปีที่แล้ว +1

      I think I was using autosuggestions as a plug-in for zsh at this time

  • @Adityakumar-ly6iy
    @Adityakumar-ly6iy 3 ปีที่แล้ว +1

    I am confused as why we have to write a playbook to install wordpress instead we can write a docker-compose file with all required configuration and run the file using ansible on the host.

    • @christianlempa
      @christianlempa  3 ปีที่แล้ว +2

      Works both ways, you can of course also use docker-compose if you want

    • @tekknokrat
      @tekknokrat 2 ปีที่แล้ว

      You can also use ansible playbook that deploys a docker compose file containing ansible variables. That is sometimes neccessary when you have dynamic parameters that can't be injected by environment vars.

  • @ebiscaia
    @ebiscaia ปีที่แล้ว

    Wouldn't it be the case of installing Ansible in a vitual environment?

  • @yolo-cars
    @yolo-cars 2 ปีที่แล้ว

    Thank you for this video. I'm following this video and I got a quick question: in ansible.cfg file you specidied remote_user = vagrant. I'm not using vagrant, so I wonder if remote_user should be a regular user which you create when installing Linux or if it should be a root user? Thanks!

    • @christianlempa
      @christianlempa  2 ปีที่แล้ว +1

      Yep it's the name of a regular Linux user on the remote system

  • @deanxaka
    @deanxaka 2 ปีที่แล้ว

    What are you using for yaml in vscode to lool like that

  • @SMAW04
    @SMAW04 3 ปีที่แล้ว +2

    Nice video, got some ideas from it! thank you. One question, which theme are you using in you're WSL ZSH it looks nice!

    • @christianlempa
      @christianlempa  3 ปีที่แล้ว +1

      Hey, thanks! :) I just updated my dotfiles github repo, there you'll find the settings and the color scheme for the Windows Terminal: github.com/xcad2k/dotfiles

  • @belaircomputerguyllc4001
    @belaircomputerguyllc4001 3 ปีที่แล้ว +1

    Do you get into VM's at all? Which hypervisor do you prefer?

    • @christianlempa
      @christianlempa  3 ปีที่แล้ว +2

      I'm currently testing proxmox. Seems pretty good so far

    • @christianlempa
      @christianlempa  3 ปีที่แล้ว +1

      I'm currently testing proxmox. Seems pretty good so far

  • @Knightfall23
    @Knightfall23 3 ปีที่แล้ว

    What is that webpage home setup you have at 15:09?

    • @twinssword
      @twinssword 2 ปีที่แล้ว

      Brave browser default page

  • @psicodelico6
    @psicodelico6 3 ปีที่แล้ว

    Excelent tutorial!.. great.. if you migrate cointaner how to get data and then copy en new location docker?

    • @christianlempa
      @christianlempa  3 ปีที่แล้ว +1

      Thanks! Glad that you asked because I'm currently preparing a new video about migrating non-docker to docker containers. I think it would be great to integrate migration of docker volumes as well!

    • @psicodelico6
      @psicodelico6 3 ปีที่แล้ว

      @@christianlempa yes! its would be great.

  • @chrissaji6988
    @chrissaji6988 3 ปีที่แล้ว +1

    Thanks for this tutorial.
    Could you please create a tutorial to install collabora on nextcloud (installed on docker)?

    • @christianlempa
      @christianlempa  3 ปีที่แล้ว +2

      Thanks! Well that would need to wait a long time, until I do that, unfortunately :/

  • @nikhilverma1552
    @nikhilverma1552 3 ปีที่แล้ว

    Hi,
    can u also show me how to down docker-compose from remote host

    • @christianlempa
      @christianlempa  3 ปีที่แล้ว

      Not sure what you mean, remote hosts can be managed with Portainer like local hosts, so also docker-compose stacks.

  • @KrachaborasJB
    @KrachaborasJB 3 ปีที่แล้ว

    Which vscode extension sets different colors on columns ?

  • @neoplasma1
    @neoplasma1 3 ปีที่แล้ว +1

    Doesn’t Portainer take away the learning process of actually using Docker?

    • @christianlempa
      @christianlempa  3 ปีที่แล้ว

      To some extend, yes. But people still would need at least some fundamental knowledge of Docker, and I always prefer people to teach the fundamentals first before using tools to simplify the daily workflow.

  • @jackbolder5734
    @jackbolder5734 2 ปีที่แล้ว

    Is it just me, or is the video quality terrible even at 1080p? Barely can read that yaml (Europe).

    • @christianlempa
      @christianlempa  2 ปีที่แล้ว +1

      Idk, maybe that’s an issue with the compression

  • @lonewolfcoding5208
    @lonewolfcoding5208 2 ปีที่แล้ว

    i like it because its agentless

  • @techwithbube
    @techwithbube 3 ปีที่แล้ว

    How can i print a mesage when I vagrant ssh into a VM ?

  • @johanelmander3787
    @johanelmander3787 9 หลายเดือนก่อน

    This is not automating docker deployment, in remote server you just installed docker and pulled wordpress image from dockerhub. This is not deployment

  • @Glatze603
    @Glatze603 3 ปีที่แล้ว

    Hi Christian! Thanks for this video, but yout description doesn't work an ubuntu 20.04. I removed older ansible version, but bevor install new one, I had to install python3-pip - maybe you are a little bit "betriebsblind" because you had it already installed? After installation of ansible (python3 -m pip install ansible) I wasn't able to use it, because system looks at "/usr/bin/ansible". Symlink new one from ~/.local/bin/ to /usr/bin first seems to work (ansible --version > 2.10.8), but next command "ansible-galaxy collection install community.docker" crashes with "Der Befehl 'ansible-galaxy' wurde nicht gefunden kann aber installiert werden mit: sudo apt install ansible"... Whats wrong?!? Maybe you could add some missing details, so that we could profit from this great content? Thanks a lot and please continue in making such nice videos. I would like another video hot to config and deploy a vm with ansible (I already tried, but didn't got it to work).

    • @Glatze603
      @Glatze603 3 ปีที่แล้ว

      Ok, I had to symlink all files from ~/.local/bin to /usr/bin...

    • @christianlempa
      @christianlempa  3 ปีที่แล้ว +1

      @@Glatze603 Danke für's bescheid sagen! Ja das stimmt, ich hatte den symlink erstellen müssen, bzw. du kannst mit "export PATH=$PATH:$HOME/.local/bin" in der .zshrc oder .bashrc datei das einstellen.
      Ich füge das gleich mal ins tutorial hinzu!