3/20/2023 0 Comments Install python 3 ubuntu server![]() This task runs the command test -e /usr/bin/python on our server which checks for the /usr/bin/python binary's existence. So the first thing we do is checking whether Python is already installed or not: - name: Check for Python Just because we do not have Python at our disposal yet does not mean that we cannot keep our tasks idempotent - we should always do that. Fact gathering relies on Python so our play will crash if it is not already installed.Įven though Ansible claims to be compatible with Python 3, some modules still have glitches - it is safer to use Ansible 2. We need to turn off Ansible's fact gathering with gather_facts: false.We need to run its tasks as root (even if we plan to provision our server with a different user) because our server has to be considered fresh out of the box and therefore probably has no other users yet.It makes sense to create a dedicated play for bootstrapping (we may even call it bootstrap.yml), for two reasons: ![]() ![]() Manually installing Python is error prone and - if we need to do it regularly or on multiple machines - boring as hell.įortunately, it is possible to use Ansible to install Python on our server even when it actually depends on it - Ansible provides the raw module which can run basic low-down SSH commands on our server even if Python is not available. Watching Ansible provision a server from top to bottom and then deploy our Rails application is not onlyincredibly rewarding but also a safety net in case of desaster: It means that we can get back to a working state in a matter of minutes.īefore Ansible can take over, a Python interpreter must be present on the target machine. Call the bootstrap play from our main playbook. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |