MacOS: Instalar Podman y Ansible
Hoy os voy a explicar como podemos instalar contenedores Podman sobre MacOS y a su vez como podemos también instalar Ansible y utilizarlo para levantar contenedores Podman, también desde MacOS.
Ya hemos hablado en otras entradas de Ansible y Podman, hoy vamos a combinarlas en un sistema operativo que uso habitualmente, como es MacOS.
Instalar Podman en MacOS
Lanzamos la instalación mediante brew:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
MacBook-Pro-de-Raul:~ elblogdenegu$ brew install podman Updating Homebrew... ==> Auto-updated Homebrew! Updated 2 taps (homebrew/core and homebrew/cask). ==> New Formulae archey4 fabric-installer matterbridge qthreads argocd-autopilot gcc@10 minisat range2cidr at-spi2-core gitbackup mongosh revive atuin gitwatch mr2 rmw autoconf@2.69 gnupg@2.2 mx scotch autorestic gpg-tui neovim-remote search-that-hash avahi gradle@6 net-tools seqkit cadence-workflow grepip nomino simde cadical gtksourceview5 nox six caire himalaya oksh storj-uplink cidr2range imath openexr@2 stp clazy ipinfo-cli openj9 sysstat code-minimap julia opensearch systemd conftest ki organize-tool tbb@2020 crackpkcs kickstart osinfo-db trojan-go csvtk lefthook osinfo-db-tools tssh ddcctl llvm@11 parquet-cli universal-ctags dory lm-sensors pcp virtualenvwrapper dua-cli lsix pgxnclient webhook ehco lychee php-cs-fixer@2 xfig elan-init macchina principalmapper xplr enkits marcli proj@7 zellij epr marp-cli pywhat zinit erlang@23 mathlibtools qodem zsh-vi-mode ==> Updated Formulae Updated 2519 formulae. ==> Renamed Formulae badtouch -> authoscope fcct -> butane ==> Deleted Formulae aurora-cli erlang@20 osquery protobuf-swift protobuf@3.7 ==> New Casks adobe-dng-converter hightop optimus-player android-commandlinetools hook pop arkiwi ilspy privileges assinador-serpro instatus-out pronterface battery-buddy invoker qudedup-extract-tool beeper irpf2021 recut blobsaver isyncer safe-multisig calmly-writer jamkazam sbarex-qlmarkdown chia jellyfin-media-player shield command-pad jgrennison-openttd shortcutor crescendo jidusm siyuan cryptonomic-galleon katrain slidepilot depthmapx logseq specter devilutionx magicplot tabtopus dingtalk-lite mambaforge tint dmidiplayer mem usr-sse2-rdm enclave menu-bar-splitter vamiga firefly menuwhere vitals flameshot microsoft-openjdk vitalsigns fpc-laz mixed-in-key waltr-pro fpc-src-laz mutesync wxmacmolplt futurerestore-gui nordlocker hancom-word nordpass ==> Updated Casks Updated 1583 casks. ==> Deleted Casks adobe-air-sdk kk7ds-python-runtime adventure lingo appstudio magicplotpro audiobookbinder magicplotstudent auristor-client meshcommander battery-guardian mp3tag beatport-pro netbeans-cpp cellery netbeans-java-ee clipbuddy netbeans-java-se cliqz netbeans-php cricut-design-space nndd cuteclips omniweb duckstation opennx family-tree-builder opera-mail filedrop printrun flash-npapi resxtreme flash-player revisions flash-player-debugger rss flash-player-debugger-npapi screen flash-player-debugger-ppapi spideroak-share flash-ppapi swift-explorer fpcsrc tracks-live hex transmit-disk hubic vrep iograph wakeonlan itrash wraparound jira-client ==> Downloading https://ghcr.io/v2/homebrew/core/podman/manifests/3.2.0 ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/podman/blobs/sha256:1762fa3d1f0 ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh ######################################################################## 100.0% ==> Pouring podman--3.2.0.big_sur.bottle.tar.gz ==> Caveats Bash completion has been installed to: /usr/local/etc/bash_completion.d ==> Summary 🍺 /usr/local/Cellar/podman/3.2.0: 167 files, 29.7MB ==> `brew cleanup` has not been run in 30 days, running now... Removing: /usr/local/Cellar/autoconf/2.69... (68 files, 3.0MB) Removing: /Users/elblogdenegu/Library/Caches/Homebrew/docker-machine-driver-hyperkit--1.0.0.big_sur.bottle.tar.gz... (6.3MB) Removing: /Users/elblogdenegu//Library/Caches/Homebrew/gpatch--2.7.6.big_sur.bottle.tar.gz... (141.0KB) Removing: /Users/elblogdenegu/Library/Caches/Homebrew/pkg-config--0.29.2_3.big_sur.bottle.tar.gz... (239.6KB) Removing: /Users/elblogdenegu/Library/Caches/Homebrew/pyenv--1.2.25.big_sur.bottle.tar.gz... (659.6KB) Removing: /Users/elblogdenegu/Library/Caches/Homebrew/python@3.9--3.9.2_4.big_sur.bottle.tar.gz... (13.6MB) Removing: /Users/elblogdenegu/Library/Caches/Homebrew/readline--8.1.big_sur.bottle.tar.gz... (536KB) Removing: /Users/elblogdenegu/Library/Caches/Homebrew/sqlite--3.35.3.big_sur.bottle.tar.gz... (2.0MB) Removing: /Users/elblogdenegu/Library/Caches/Homebrew/xz--5.2.5.big_sur.bottle.tar.gz... (417.6KB) Removing: /Users/elblogdenegu/Library/Caches/Homebrew/libev--4.33.big_sur.bottle.tar.gz... (147.3KB) Removing: /Users/elblogdenegu/Library/Caches/Homebrew/hyperkit--0.20200908.catalina.bottle.tar.gz... (1.4MB) Removing: /Users/elblogdenegu/Library/Caches/Homebrew/Cask/minishift--1.34.3.tgz... (9.6MB) Removing: /Users/elblogdenegu/Library/Logs/Homebrew/pyenv... (64B) Removing: /Users/elblogdenegu/Library/Logs/Homebrew/gdbm... (64B) Removing: /Users/elblogdenegu/Library/Logs/Homebrew/mpdecimal... (64B) Removing: /Users/elblogdenegu/Library/Logs/Homebrew/sqlite... (64B) Removing: /Users/elblogdenegu/Library/Logs/Homebrew/autoconf... (64B) Removing: /Users/elblogdenegu/Library/Logs/Homebrew/m4... (64B) Removing: /Users/elblogdenegu/Library/Logs/Homebrew/openssl@1.1... (64B) Removing: /Users/elblogdenegu/Library/Logs/Homebrew/python@3.9... (2 files, 4.4KB) |
Podéis comprobar si os funciona:
1 |
podman pull ubuntu |
Instalar Ansible en MacOS
Lanzamos la instalación mediante pip:
1 2 |
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py --user |
Y lanzamos la instalación:
1 2 |
sudo python get-pip.py sudo python -m pip install ansible |
Usando Ansible para ejecutar Podman en MacOS
Una vez tenemos las dos herramientas instaladas, podríamos usar un fichero YAML para lanzar la ejecución de contenedores:
1 |
ansible-playbook podman.yml |
El contenido puede ser:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
--- - hosts: macos tasks: - name: Pull an image containers.podman.podman_image: name: httpd - name: Copying file into home copy: src: /Users/elblogdenegu/Downloads/index.html dest: /home - name: Re-create a redis container containers.podman.podman_container: name: elblogdenegu image: httpd state: started detach: true exposed_ports: - 80 ports: - 8080:80 volumes: /home/:/usr/local/apache2/htdocs/ |
Seguiremos jugando con esto…
Te ha gustado la entrada SGUENOS EN TWITTER O INVITANOS A UN CAFE?