Skip to content

Instantly share code, notes, and snippets.

View zeitounator's full-sized avatar

Olivier Clavel zeitounator

View GitHub Profile
---
all:
hosts:
host1.example.com:
file_name: "app1.jar"
SERVER_PATH: "/apps1"
host2.example.com:
file_name: "app2.jar"
SERVER_PATH: "/apps2"
$ cat test.yml
---
- hosts: localhost
tasks:
- name: Write ip4 adrees in a file
ansible.builtin.lineinfile:
line: "My ip4 is: {{ ansible_enp5s0.ipv4.address }}"
dest: /tmp/test/toto.txt
create: true
$ tree
.
├── test.yml
├── users_initial.yml
├── users_modify.yml
└── Vagrantfile
0 directories, 4 files
$ cat Vagrantfile
$ cat toto.yml
$ANSIBLE_VAULT;1.1;AES256
32353335396261646339343466646261306239633333366365663862353062653632653633656162
6464663731366136633131646531303063366332633734370a653464373830666666343930393564
39393162396564356336336339666666383432323738376566626434393461376334656664396339
6461363530383238340a376333306631383762323134303931393938653837633263386664633830
61383664303562386131306234333238396434316636343230633231386138613264383566363432
6165626266626437653735383835663564313162633265643964
$ cat testtoto.py
$ # Test project structure
$ tree
.
├── test.yml
├── users_initial.yml
└── users_modify.yml
0 directories, 3 files
$ tree
.
├── fake_command
├── test_as_json_default_stdout.yml
└── test_as_lines_yaml_stdout.yml
0 directories, 3 files
$ cat fake_command
#!/usr/bin/env bash
$ ansible --version
ansible [core 2.16.1]
config file = None
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/user/.local/lib/python3.10/site-packages/ansible
ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
executable location = /home/user/.local/bin/ansible
python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
$ tree .
.
├── demo.yml
├── unreachable_nodes-1.yml
└── unreachable_nodes-2.yml
0 directories, 3 files
$ cat unreachable_nodes-1.yml
---
$ ansible --version
ansible [core 2.15.6]
config file = None
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/user/.local/lib/python3.10/site-packages/ansible
ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
executable location = /home/user/.local/bin/ansible
python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
$ mkdir /tmp/toto
$ cd /tmp/toto/
$ mkdir -p build/libs
# No problem with a single file
$ touch build/libs/Component-Name-1.2.3.jar
$ mv build/libs/Component-Name-?.?.?.jar build/libs/app.jar