Skip to content

Instantly share code, notes, and snippets.

View zeitounator's full-sized avatar

Olivier Clavel zeitounator

View GitHub Profile
$ cat inventory
---
all:
children:
my_poc_hosts:
hosts:
target1:
target2:
target3:
$ docker run -it --rm continuumio/anaconda3 make
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"make\": executable file not found in $PATH": unknown.
$ docker run -it --rm continuumio/anaconda3 bash -c "apt-get -y update && apt-get -y install build-essential && make"
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [121 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [203 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7905 kB]
Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages.diff/Index [3688 B]
$ ansible localhost -m debug -a msg="{{ '127.0.0.1:cs;128.0.0.1:pd;129.0.0.1:sa;125.0.0.1:zd'.split(';') | map ('regex_replace', '(.*):(.*)', '\\g<1> - \\g<2>') | list }}"
localhost | SUCCESS => {
"msg": [
"127.0.0.1 - cs",
"128.0.0.1 - pd",
"129.0.0.1 - sa",
"125.0.0.1 - zd"
]
}
---
- name: Node test
hosts: localhost
gather_facts: False
tasks:
- debug:
var: titi
$ docker run -it --rm centos:7 bash -c "yum install -y python3-pip && pip3 install ansible && ansible --version"
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
* base: mirrors.standaloneinstaller.com
* extras: mirrors.standaloneinstaller.com
* updates: mirrors.standaloneinstaller.com
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/4): base/7/x86_64/
$ ansible --version
ansible 2.9.11
config file = None
configured module search path = ['/home/USER/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.6.9 (default, Jul 17 2020, 12:50:27) [GCC 8.4.0]
$ ansible localhost -m debug -a msg="{{ 'myapp' in sites }}" -e '{"sites":{"myapp":{"frontend": 80, "backend": 80}}}'
localhost | SUCCESS => {
$ test1=toto
$ ansible localhost -m debug -a "msg='this is test1 env var on controller: "${test1}".'"
localhost | SUCCESS => {
"msg": "this is test1 env var on controller: toto."
}
$ ansible --version
ansible 2.9.11
config file = None
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.6.9 (default, Jul 17 2020, 12:50:27) [GCC 8.4.0]
$ pip list | grep jmespath
jmespath 0.10.0
$ echo Your proposition
Your proposition
$ cat Dockerfile
FROM tomcat:alpine
RUN apk add curl --no-cache \
&& curl -fsSL -o snoop.war https://github.com/AKSarav/SampleWebApp/raw/master/dist/SampleWebApp.war
COPY ./snoop.war /opt/tomcat/tomcat1/webapps/
expose 8443
CMD /usr/local/tomcat/bin/cataline.bat run
---
- hosts: localhost
gather_facts: false
vars:
test_file_path: /tmp/test_config_file.txt
original_file_content: |-
hite-config {
enable = false
host-name = "host1"