- To install:
pipx install ansible --include-deps
- If no
--include-deps
, the actualansible
command, part ofansible-core
(a dependency of theansible
metapackage), is not included bypipx
- If no
- Some definitions
- A host is a remote machine managed by Ansible
- An inventory is a file that describes a list of managed nodes or hosts that are logically organized in groups
- A module is a unit of work that Ansible ships to a host
- Usually written in Python (although more languages are supported)
- They return a JSON and they are removed from the host after execution
- For example
ansible.builtin.setup
is called automatically by playbooks during the implicit "Gather Facts" task
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Create a basic certificate using Certbot (for Let's Encrypt) and Ansible: | |
# https://github.com/geerlingguy/ansible-role-certbot | |
from http.server import HTTPServer, SimpleHTTPRequestHandler | |
import ssl | |
domain = "example.com" # Edit with your domain | |
httpd = HTTPServer(("0.0.0.0", 443), SimpleHTTPRequestHandler) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import os | |
import httpx | |
async def get_all(url, headers): | |
result = {} | |
next_url = url |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Robust smoothing functions. | |
Translated from Garcia, Damien. 2010. "Robust Smoothing of Gridded Data in One and Higher Dimensions with Missing Values." | |
Computational Statistics & Data Analysis 54 (4): 1167–78. https://doi.org/10.1016/j.csda.2009.09.020. | |
""" | |
import numpy as np | |
from numpy.linalg import norm | |
from numpy.matlib import repmat | |
from scipy.fftpack import dctn, idctn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import (absolute_import, division, print_function, | |
unicode_literals) | |
import numpy as np | |
import sys | |
sys.path.insert(0, '/Users/bmorris/git/tmp/astropy') | |
import astropy | |
from astropy.time import Time | |
from astropy.coordinates import (SkyCoord, Longitude, Latitude, GCRS, ICRS, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: class Foo: | |
...: def __init__(self, a, b): | |
...: self._a = a | |
...: self.b = b | |
...: @property | |
...: def a(self): | |
...: return self._a | |
...: | |
In [2]: Foo.a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import logging | |
import os | |
import aiormq | |
logger = logging.getLogger(__name__) | |
RABBITMQ_HOST = os.environ["RABBITMQ_HOST"] | |
RABBITMQ_PORT = os.environ["RABBITMQ_PORT"] |
NewerOlder