This file contains hidden or 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
cat /etc/ansible/hosts | |
localhost ansible_connection=local ansible_python_interpreter="/home/m/.local/bin/python3.7" | |
[vars:all] | |
ansible_python_interpreter="/home/m/.local/bin/python3.7" |
This file contains hidden or 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 requests | |
from ansible.errors import AnsibleError, AnsibleParserError | |
from ansible.plugins.lookup import LookupBase | |
try: | |
from __main__ import display | |
except ImportError: | |
from ansible.utils.display import Display | |
display = Display() |
This file contains hidden or 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
- name: build ec2 list | |
set_fact: | |
amazon_ranges_list: "{{ amazon_ranges_list + [{'proto': 'all', 'cidr_ip': item, 'rules_desc': 'AMAZON'}]}}" | |
with_items: "{{ amazon_ranges }}" |
This file contains hidden or 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
var1: | |
- 1 | |
- 2 | |
- 3 | |
needed: | |
- id: 1 | |
desc: "bla" | |
prot: "ja" | |
- id: 2 |
This file contains hidden or 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
$ make tests-py3 | |
bin/ansible-test units -v --python 3.7 | |
Unit test with Python 3.7 | |
Run command: pytest --boxed -r a -n auto --color yes --junit-xml test/results/junit/python3.7-units.x ... | |
/home/m/git/upstream-ansible/markuman-ansible/test/runner/injector/pytest:4: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses | |
import imp | |
ERROR: usage: pytest.py [options] [file_or_dir] [file_or_dir] [...] | |
pytest.py: error: unrecognized arguments: --boxed -n test/units/ | |
inifile: /home/m/git/upstream-ansible/markuman-ansible/tox.ini | |
rootdir: /home/m/git/upstream-ansible/markuman-ansible |
This file contains hidden or 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
vars: | |
instance_id: i-1234564542134 | |
cpu_credit_specification: unlimited | |
security_group: | |
- default | |
- someother | |
tasks: | |
- name: try to modify the ec2 instance |
This file contains hidden or 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
- name: check required vars empty | |
fail: msg="Variable '{{ item }}' is empty" | |
when: vars[item] == "" | |
with_items: "{{ required_vars }}" | |
- name: check required vars null | |
fail: msg="Variable '{{ item }}' is null" | |
when: vars[item] is none | |
with_items: "{{ required_vars }}" |
This file contains hidden or 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
--- | |
- hosts: localhost | |
connection: local | |
gather_facts: False | |
tasks: | |
- name: Launch the new EC2 Instance | |
ec2: | |
... |
This file contains hidden or 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
plugin: aws_ec2 | |
regions: | |
- eu-central-1 |
This file contains hidden or 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
- name: attach sg to instances | |
ec2_instance: | |
state: present | |
region: eu-central-1 | |
instance_ids: | |
- i-03cdeb86644457562 | |
security_groups: | |
- sg-e169308a # default | |
- sg-888e07e5 # something | |
- sg-abbd4ac1 # public smtp |