No description
  • Python 84.5%
  • Shell 15.5%
Find a file
2026-02-04 16:09:36 +01:00
group_data Use group_data and all.py globals 2026-02-02 22:39:03 +01:00
inventories Remove unused import 2026-02-04 16:09:36 +01:00
.gitignore Remove unused import 2026-02-04 16:09:36 +01:00
config.py Use group_data and all.py globals 2026-02-02 22:39:03 +01:00
deploy Add deploy script 2026-02-04 15:23:39 +01:00
deploy.py Use group_data and all.py globals 2026-02-02 22:39:03 +01:00
README.md Use group_data and all.py globals 2026-02-02 22:39:03 +01:00
requirements.txt First commit 2026-02-02 14:59:41 +01:00

PyInfra

https://docs.pyinfra.com/

PyInfra variant of my remote apt update/apt upgrade ansible scripts

Installation

$ virtualenv venv
$ . venv/bin/activate
$ pip install -r requirements.txt

Deploy on cloud servers

$ pyinfra inventories/cloud.py deploy.py
--> Loading config...
--> Loading inventory...
--> Connecting to hosts...
    [gitvanes]   Connected
    [immich]     Connected
    [mail]       Connected
    [srv02]      Connected
    [web]        Connected
    [srv01]      Connected
    [rijnsweerd] Connected

--> Preparing operation files...
    Loading: deploy.py
    [srv02]      Ready: deploy.py
    [srv01]      Ready: deploy.py
    [immich]     Ready: deploy.py
    [gitvanes]   Ready: deploy.py
    [web]        Ready: deploy.py
    [mail]       Ready: deploy.py
    [rijnsweerd] Ready: deploy.py

--> Detected changes:
    Operation                 Change                                                 Conditional Change   
    Update apt repositories   7 (gitvanes, immich, mail, rijnsweerd, srv01, sr...)   -                    
    Upgrade apt packages      3 (gitvanes, mail, rijnsweerd)                         -                    

    Detected changes may not include every change pyinfra will execute.
    Hidden side effects of operations may alter behaviour of future operations,
    this will be shown in the results. The remote state will always be updated
    to reflect the state defined by the input operations.

    Detected changes displayed above, skip this step with -y
                             
--> Beginning operation run...
--> Starting operation: Update apt repositories 
    [srv02]      Success
    [immich]     Success
    [srv01]      Success
    [mail]       Success
    [rijnsweerd] Success
    [web]        Success
    [gitvanes]   Success

--> Starting operation: Upgrade apt packages 
    [srv02]      No changes
    [immich]     No changes
    [srv01]      No changes
    [web]        No changes
    [rijnsweerd] Success
    [mail]       Success
    [gitvanes]   Success

--> Results:
    Operation                 Hosts   Success   Error   No Change   
    Update apt repositories   7       7         -       -           
    Upgrade apt packages      7       3         -       4           
    Grand total               14      10        -       4           

--> Disconnecting from hosts...