Automate your Docker deployments with Ansible

  Рет қаралды 87,067

Christian Lempa

Christian Lempa

Күн бұрын

Ansible Docker Deployments for your Servers made easily! In this video, I'll show you how I've used Ansible to automate my web server deployments. We're deploying Portainer, Watchtower, and a WordPress Blog. #Ansible #Docker #Watchtower
DOCS: github.com/christianlempa/vid...
Ansible Tutorial: • Simple automation for ...
Get started with Docker: • The Difference between...
Portainer Tutorial: • Portainer Install Ubun...
Watchtower Tutorial: • How To Update Docker C...
Get started with DevOps: • Video
Follow me:
TWITTER: / christianlempa
INSTAGRAM: / christianlempa
DISCORD: / discord
GITHUB: github.com/christianlempa
PATREON: / christianlempa
MY EQUIPMENT: kit.co/christianlempa
Timestamps:
00:00 - Introduction
01:05 - What we do in this tutorial
01:56 - Pre-Requisites
04:47 - Set up our Ansible Environment
08:23 - Install Docker on our remote Server
11:44 - Deploy Portainer
15:19 - Install Watchtower
16:35 - Deploy WordPress
----
All links with "*" are affiliate links.

Пікірлер: 76
@christianlempa
@christianlempa 3 жыл бұрын
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 жыл бұрын
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 жыл бұрын
Excellent Tutorial for Ansible and Docker. Thanks Again Christian.
@christianlempa
@christianlempa 3 жыл бұрын
Thank you so much! :)
@Ultimaus
@Ultimaus 8 ай бұрын
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.
@user-de7vk7gm7b
@user-de7vk7gm7b 2 жыл бұрын
Благодарю, очень полезное видео!! I grateful to you for this a very useful video!
@Phillisteum
@Phillisteum 2 жыл бұрын
Great video! Docker stack definition in an Ansible playbook?! Wow! So much potential to automate deployments and update a running stack.
@christianlempa
@christianlempa 2 жыл бұрын
Thank you so much! :) That's indeed pretty useful!
@annahri
@annahri 2 жыл бұрын
So much interesting topics on your channel. Subscribed!
@christianlempa
@christianlempa 2 жыл бұрын
Thanks mate!
@rob280
@rob280 5 ай бұрын
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.
@TuxTechLabs
@TuxTechLabs 5 ай бұрын
Cool things shared by Christian as always.
@christianlempa
@christianlempa 5 ай бұрын
Thanks :)
@dedpossum66
@dedpossum66 2 жыл бұрын
Excellent video! I appreciate it.
@christianlempa
@christianlempa 2 жыл бұрын
Glad you enjoyed it!
@Mohan-nf6cu
@Mohan-nf6cu 2 жыл бұрын
Thanks a lot. Excellent explanation:) :)
@christianlempa
@christianlempa 2 жыл бұрын
Glad you liked it
@andyruiz3174
@andyruiz3174 3 жыл бұрын
Sehr gutes Video... hast die ein Abo verdient
@christianlempa
@christianlempa 3 жыл бұрын
Danke 😁
@jamesT008
@jamesT008 2 жыл бұрын
Great....very informative
@christianlempa
@christianlempa 2 жыл бұрын
Thank!
@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.
@mohdasgharnaqvi5955
@mohdasgharnaqvi5955 2 жыл бұрын
U r really helpful thanks
@christianlempa
@christianlempa 2 жыл бұрын
Great! Thanks
@SMAW04
@SMAW04 3 жыл бұрын
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 жыл бұрын
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
@jeremyr7958
@jeremyr7958 Жыл бұрын
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?
@yolo-cars
@yolo-cars Жыл бұрын
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 Жыл бұрын
Yep it's the name of a regular Linux user on the remote system
@chrissaji6988
@chrissaji6988 3 жыл бұрын
Thanks for this tutorial. Could you please create a tutorial to install collabora on nextcloud (installed on docker)?
@christianlempa
@christianlempa 3 жыл бұрын
Thanks! Well that would need to wait a long time, until I do that, unfortunately :/
@haralc
@haralc Жыл бұрын
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.
@psicodelico6
@psicodelico6 3 жыл бұрын
Excelent tutorial!.. great.. if you migrate cointaner how to get data and then copy en new location docker?
@christianlempa
@christianlempa 3 жыл бұрын
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.
@fauzifirdaus8200
@fauzifirdaus8200 3 жыл бұрын
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: kzbin.info/www/bejne/a52zkKOan8iJg9E And also on Portainer Remote Access: kzbin.info/www/bejne/oXynoIOlndWchM0 Hope that is what you're searching for 😀
@khurrumbaloch1951
@khurrumbaloch1951 10 ай бұрын
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!
@deanxaka
@deanxaka 2 жыл бұрын
What are you using for yaml in vscode to lool like that
@belaircomputerguyllc4001
@belaircomputerguyllc4001 3 жыл бұрын
Do you get into VM's at all? Which hypervisor do you prefer?
@christianlempa
@christianlempa 3 жыл бұрын
I'm currently testing proxmox. Seems pretty good so far
@christianlempa
@christianlempa 3 жыл бұрын
I'm currently testing proxmox. Seems pretty good so far
@Angelas20
@Angelas20 2 жыл бұрын
What shell prompt do you use for nice upper blue part?
@christianlempa
@christianlempa 2 жыл бұрын
I've done a video about my setup, here you'll find it :) kzbin.info/www/bejne/pXeZmH-vnbZ3mtk
@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?
@ebiscaia
@ebiscaia Жыл бұрын
Wouldn't it be the case of installing Ansible in a vitual environment?
@ronaldagorsah7954
@ronaldagorsah7954 Ай бұрын
Thanks for the video but the boilerplate is gone and now i misss the boilerplate to install docker
@nikhilverma1552
@nikhilverma1552 2 жыл бұрын
Hi, can u also show me how to down docker-compose from remote host
@christianlempa
@christianlempa 2 жыл бұрын
Not sure what you mean, remote hosts can be managed with Portainer like local hosts, so also docker-compose stacks.
@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?
@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 Жыл бұрын
I think I was using autosuggestions as a plug-in for zsh at this time
@KrachaborasJB
@KrachaborasJB 2 жыл бұрын
Which vscode extension sets different colors on columns ?
@christianlempa
@christianlempa 2 жыл бұрын
That's indent rainbow.
@Knightfall23
@Knightfall23 2 жыл бұрын
What is that webpage home setup you have at 15:09?
@twinssword
@twinssword 2 жыл бұрын
Brave browser default page
@Adityakumar-ly6iy
@Adityakumar-ly6iy 3 жыл бұрын
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 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.
@neoplasma1
@neoplasma1 2 жыл бұрын
Doesn’t Portainer take away the learning process of actually using Docker?
@christianlempa
@christianlempa 2 жыл бұрын
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.
@lonewolfcoding5208
@lonewolfcoding5208 Жыл бұрын
i like it because its agentless
@techwithbube
@techwithbube 2 жыл бұрын
How can i print a mesage when I vagrant ssh into a VM ?
@jackbolder5734
@jackbolder5734 Жыл бұрын
Is it just me, or is the video quality terrible even at 1080p? Barely can read that yaml (Europe).
@christianlempa
@christianlempa Жыл бұрын
Idk, maybe that’s an issue with the compression
@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 жыл бұрын
@@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!
Simple automation for all your Linux servers with Ansible
26:00
Christian Lempa
Рет қаралды 65 М.
Learning Docker // Getting started!
35:56
Christian Lempa
Рет қаралды 98 М.
Can You Draw The PERFECT Circle?
00:57
Stokes Twins
Рет қаралды 71 МЛН
Маленькая и средняя фанта
00:56
Multi DO Smile Russian
Рет қаралды 3,7 МЛН
Зомби Апокалипсис  часть 1 🤯#shorts
00:29
INNA SERG
Рет қаралды 7 МЛН
Don’t take steroids ! 🙏🙏
00:16
Tibo InShape
Рет қаралды 39 МЛН
Don’t run Proxmox without these settings!
25:45
Christian Lempa
Рет қаралды 59 М.
Is this the BEST Reverse Proxy for Docker? // Traefik Tutorial
21:57
Christian Lempa
Рет қаралды 487 М.
Ansible 101 - Episode 1 - Introduction to Ansible
1:03:43
Jeff Geerling
Рет қаралды 513 М.
Automate local DNS with Bind and Terraform
20:56
Christian Lempa
Рет қаралды 52 М.
Ansible + Docker = ?
14:37
cocadmin
Рет қаралды 40 М.
Designing My Multi Site HomeLab
27:43
Techno Tim
Рет қаралды 52 М.
This web UI for Ansible is so damn useful!
20:07
Christian Lempa
Рет қаралды 442 М.
get started with Ansible Network Automation (FREE cisco router lab)
15:02
How to protect Linux from Hackers // My server security strategy!
30:39
Christian Lempa
Рет қаралды 209 М.
you need to learn Ansible RIGHT NOW!! (Linux Automation)
21:21
NetworkChuck
Рет қаралды 839 М.
Can You Draw The PERFECT Circle?
00:57
Stokes Twins
Рет қаралды 71 МЛН