ook
- hosts: all
tasks:
- name: check pgBackRest version
ansible.builtin.command: /usr/bin/pgbackrest version
register: backrest_version
- name: Write the CSV file
ansible.builtin.copy:
dest: pkg.csv
content: "{{ content }}"
CSV file
> ansible.builtin.copy:
> dest: pkg.csv
> content: |-
> {% for k,v in pkg.items() %}
> {{ k }},{{ v }}
> {% endfor %}
> delegate_to: localhost
> run_once: true
--
Vladimir Botka
--
You received this message because y
{ ansible_play_hosts_all|
difference(ansible_play_hosts) }}"
tasks:
- assert:
that: ok|bool
- debug:
var: _failed
gives
_failed:
- host2
- host3
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Gr
t_11: '2.39'
test_12: '2.40'
test_13: '2.41'
Write the CSV file
- copy:
dest: pkg.csv
content: |-
{% for k,v in pkg.items() %}
{{ k }},{{ v }}
{% endfor %}
delegate_to: localhost
run_once: true
You get
shell> cat pkg.
1, srv04, srv07]
- [srv02, srv05, srv08]
- [srv03, srv06, srv09]
3) Get the slice
list_of_servers[:5]: [srv01, srv04, srv07, srv02, srv05]
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe fr
On Tue, 12 Jul 2022 11:29:09 +0200
Vladimir Botka wrote:
> - debug:
> msg: "Launch task for user {{ item.user }} end date."
> loop: "{{ users.list }}"
> when: item.end == today
> - debug:
> msg: "Launch task for use
sg: "Launch task for user {{ item.user }} start date."
loop: "{{ users.list }}"
when: item.start == today
gives (abridged)
msg: Launch task for user alice end date.
msg: Launch task for user bob start date.
--
Vladimir Botka
--
You received this message bec
bug:
var: result.stdout
gives (abridged)
shell> ANSIBLE_STDOUT_CALLBACK=yaml ansible-playbook pb.yml
ok: [localhost] =>
result.stdout: |-
line1
line2
line3
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
On Tue, 28 Jun 2022 06:46:20 -0700 (PDT)
Tony Wong wrote:
> is there a module to run ssh-keygen on remote hosts?
Yes. Module *user* is able to generate a SSH key. See
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/user_module.html#parameter-generate_ssh_key
--
Vladi
- debug:
msg: "{{ _list is search('bt') }}"
vars:
_list: ['a', 'b\t']
All tasks above return True.
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this gro
{{ regex }} is present in the list."
when: ql|select('search', regex)|length > 0
vars:
regex: 'abc\\tx'
ql:
- 'abc\tx'
- 123
gives
msg: Regex abc\\tx is present in the list.
--
Vladimir Botka
--
You received this message because yo
To move on, it will be necessary to learn details.
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to ansible-project+unsubscr...@
ut_day|int
vars:
days: "{{ (ec2_f_date|to_datetime -
item.creation_date|
to_datetime('%Y-%m-%dT%H:%M:%S.000Z')).days }}"
will display the first image. The other two will be skipped
msg: Age of app1 is greater than or equal 2 day(s)
--
group }}: {{ values|map(attribute='name')|join(',') }}
{% endfor %}
to get the expected result
g1: n1,n2
g2: c1
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop r
p')|map('first')|list|
zip(_list|groupby('group')|map('last')|
map('map',
attribute='name')|list))
}}"
--
Vladimir Botka
--
You received this message because you are subsc
e='name')|list }}"
gives
_keys:
[g1, g2]
_vals:
- [n1, n2]
- [c1]
* Create the dictionary
_dict: "{{ dict(_keys|zip(_vals)) }}"
gives
_dict:
g1: [n1, n2]
g2: [c1]
--
Vladimir Botka
--
You received this message because you are subscribed to the
[var] + [var] }}"
gives
var2:
- key_1: value_11
key_2: value_21
key_3: value_31
- key_1: value_11
key_2: value_21
key_3: value_31
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" gro
n that it does sometimes. When it does, you can run the
> playbook with `force_remove_versions` set to true, and it will
> remove all the matching lines - both good and bad - before the
> second task puts the single entries back in the file, properly
> commented or not as the case may be.
******
localhost: ok=1changed=0unreachable=0
failed=0skipped=1rescued=0ignored=0
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubsc
**
localhost : ok=2changed=2unreachable=0
failed=0skipped=0rescued=0ignored=0
shell> cat docker-compose
#image: graylog/graylog4.2.5
image: graylog/graylog4.2.8
Set the variable *force_remove_versions* as appropriate (for the
scenario t
s is
the reason why the first line wasn't replaced. Instead, the second
line was added.
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an
***
localhost: ok=1changed=1unreachable=0
failed=0skipped=0rescued=0ignored=0
shell> cat docker-compose
#image: graylog/graylog4.2.5
image: graylog/graylog4.2.8
--
Vladimir Botka
--
You received this message because you are subscribed to the
path: docker-compose
regex: '^\s*#*\s*image: graylog/graylog{{ item.key }}\s*$'
line: '{{ hash }}image: graylog/graylog{{ item.key }}'
loop: "{{ versions|dict2items }}"
vars:
hash: "{{ item.value|ternary('', '#') }}"
--
Vladimir Botka
--
flsdkjflsdjflkdjl richard@foo
user_vars:
alice:
gecos: Alice Beatrice,,,
name: alice
shell: /bin/bash
ssh_keys:
- alice@foo
- alice@bar
richard:
gecos: Richard Hector,,,
name: richard
shell: /bin/bash
ssh_ke
d
delay: 10
retries: 25920
vars:
ansible_callback_diy_runner_retry_msg: ""
To see details run
shell> ansible-doc -t callback community.general.diy
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Group
each iteration. In your case, *with_fileglob* must evaluate the
list before the condition is applied.
*block* is irrelevant here. The condition is applied to all tasks.
Try for example
- block:
- debug:
msg: OK1
- debug:
msg: OK2
when: false
Instead of
ok['name2,London']: 04-45-67
You'll have to stick with the lists if you are not able to create
unique keys.
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails f
On Tue, 8 Mar 2022 06:20:10 -0800 (PST)
"cl...@netsandbox.de" wrote:
> That's not really a solution if I have 100 playbook hosts and 5 hosts where
> I will deploy files in this way.
In this case, it would be more efficient to select those 5 hosts
instead of looping all 100.
--
t;{{ item }}"
dest: /tmp/
with_fileglob: "files/tmp/{{ inventory_hostname }}/*.yaml"
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving em
.io/en/stable/intro/#performance-data-collection-settings-for-runner
"Runner is capable of collecting performance data (namely
cpu usage, memory usage, and pid count) during the execution of a
playbook run. Resource profiling is made possible by the use of
control groups ..."
-
On Thu, 3 Feb 2022 18:08:25 -0800 (PST)
Kevin Y wrote:
> admin1@Le:~$ ansible -v
The option '-v' means verbose. Try '--version' instead. You should
see the paths (e.g. ansible 5.2.0 installed by *apt*)
ansible python module location = /usr/lib/python3/dist-packages/ansible
--
Vladimir Bo
all *pip* and *apt*
ansible packages and reinstall them by *apt*. You can find more
details in
https://askubuntu.com/questions/431780/apt-get-install-vs-pip-install
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" gr
installed you get, e.g.
> ansible-playbook test.yml -e my_pkg=yamllintXY -e my_version=1.20
msg: yamllintXY NOT found
If the package is installed but the version is lower you get, e.g.
> ansible-playbook test.yml -e my_pkg=yamllint -e my_version=1.21
msg: yamllint NOT found
--
Vlad
ual to, "8.0.28".
See "Comparing versions"
https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html#comparing-versions
Test it first, e.g.
- debug:
msg: Install additional dependency
when: play_mysql_version is version ('8.0.28','>=')
--
On Fri, 21 Jan 2022 09:10:52 -0500
Todd Lewis wrote:
> debug: msg: "{{ selection| zip_longest([-1], fillvalue=-1) | map('sum') }}" |
You can use *product* instead of *zip*, e.g.
selection | product([-1]) | map('sum')
--
Vladimir Botka
--
You received this messag
e"
https://en.wikipedia.org/wiki/Minimal_working_example
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to ansible-project+unsubscr...@googl
How do you decide what looks like python data structure? For example,
only the second string below is converted to dictionary, despite the
fact that both are valid YAML dictionaries
- set_fact:
_var3: '{"key1": {{ val1 }}}'
_var4: '{"key1": "{{ val1
a dictionary but *_var2* expands to a string. Is it
> > a feature or a bug?
> b. Because jinja2 has historically only had the ability to template
> strings, we do some magic to try and convert strings that look like python
> data structures to python data structures
Why don't you
ype_debug: dict
_var2|type_debug: AnsibleUnicode
*_var1* expands to a dictionary but *_var2* expands to a string. Is it
a feature or a bug?
Thank you,
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubsc
single/double quotes of the results are reversed. If this is a
problem you'll have to escape them.
ok: [localhost] => (item=sshd) =>
msg: 'ansible_facts.services["sshd.service"]["state"]: active'
--
Vladimir Botka
--
You received this message because you are subs
) }}"
gives
msg: user1 / us...@example.com / 20210715141027Z / 2021-10-13
msg: user2 / us...@example.com / 20210716141027Z / 2021-10-14
msg: user3 / us...@example.com / 20210717141027Z / 2021-10-15
--
Vladimir Botka
--
You received this message because you are subscribed to the
On Thu, 16 Dec 2021 01:24:41 +0100
Vladimir Botka wrote:
> On Wed, 15 Dec 2021 12:36:30 -0800 (PST)
> "lift...@gmail.com" wrote:
>
> > password expiration date/value is 20210715141027Z ... how to add 90 days to
> > the expiration date.
>
> For ex
4:6] }}-{{ pwdexp[6:8] }}"
_sec: "{{ (_date|to_datetime('%Y-%m-%d')).strftime('%s')|int
+ 90 * 24 * 60 * 60 }}"
_date90: "{{ '%Y-%m-%d'|strftime(_sec) }}"
gives
_date90: '2021-10-13'
--
Vladimir Botka
--
You received this message b
run_once: true
- shell: echo OK
delegate_to: zabbixslave
run_once: true
should work as expected
TASK [shell] *
changed: [zabbixprimary -> zabbixprimary]
TASK [shell] *
changed: [zabbixprimary -> zabbixslave]
--
V
* * admin /sbin/shutdown -r now >/dev/null 2>&1
These two tasks are idempotent. You'll have to run such playbook
twice, at least for the first time to add missing descriptions to
enabled items. Then you can keep the *lineinfile* task in the playbook
to make sure the descriptions are present.
https://docs.ansible.com/ansible/latest/user_guide/become.html#risks-of-becoming-an-unprivileged-user
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it,
variable, e.g.
- lineinfile:
path: /etc/ssh/sshd_config
backrefs: true
regexp: '^\s*AllowGroups\s+(.*?)(\s+{{ add_groups }})*$'
line: 'AllowGroups \1 {{ add_groups }}'
--
Vladimir Botka
--
You received this message because you are subscribed to the Google
s idempotent. Quoting from *regexp*
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/lineinfile_module.html#parameter-regexp
"When modifying a line the regexp should typically match both the
initial state of the line as well as its state after replacement by
line to ens
postgresql.service
state: stopped
become: true
register: psql_result
when: "'postgresql.service' in services"
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe fr
completed at the controller. In fact, the modules
*stat* and *file* are used behind the scene to write the file at the
client.
Short answer would be: Is Jinja package needed at the client?
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible
c/ssh/sshd_config
regexp: '^(#*)PasswordAuthentication yes'
replace: '\1PasswordAuthentication no'
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it,
ot;/home/jdxadmin")
>or (user_list != "/home/test2")
Remove the items from the list
loop: "{{ user_list|difference(deny) }}"
vars:
deny: [/home/admin, /home/jdxadmin, /home/test2]
--
Vladimir Botka
--
You received this message be
Jinja
https://jinja.palletsprojects.com/en/latest/
YAML specification explains the details
https://yaml.org/spec/1.2/spec.html
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group a
.name }} {{ p.version }}
{% endfor %}
{% endfor %}
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to ansible-project+unsubs
connect to the remote host? $ ssh admin@host
2) Are you able to ping it? $ ansible host -u admin -m ping
3) Are you able to run setup? $ ansible host -u admin -m setup
4) Try with Python >= 3.6
...
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Gr
On Tue, 21 Sep 2021 01:59:16 -0700 (PDT)
Altif wrote:
> fatal: [zsdev-nrt-smca2]: FAILED! => {
> ...
> "msg": "The following modules failed to execute: setup\n"
> }
> ...
>
> [zsdev]
> zsdev-nrt-smca2 ansible_host=X.X.X.X
>
> [zsdev:vars]
> ansible_ssh_extra_args='-o
On Wed, 28 Jul 2021 02:22:03 -0700 (PDT)
Mihail T wrote:
> stop playbook execution on hosts that faced errors
Try block/rescue
- block:
- command: "cmd_that_may_fail"
rescue:
- meta: end_host
--
Vladimir Botka
--
You received this message because you a
he data
https://github.com/vbotka/ansible-linux-postinstall/blob/master/vars/main.yml.sample#L304
the template
https://github.com/vbotka/ansible-linux-postinstall/blob/master/templates/netplan-conf.j2
and the task to configure Netplan
https://github.com/vbotka/ansible-linux-postinstall/blob/maste
This string must be included
{% endif %}
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to ansible-project+unsubscr...@googlegroups.co
ps://en.wikipedia.org/wiki/Minimal_working_example
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to ansible-project+unsubscr..
) }}"
1) Use the filter *join* to create the variable *params* given the
list "down=[server1, server2]"
2) Use *delegate_to* and *run_once* instead of the condition
3) The braces {{ }} in the condition is the reason of the syntax
error.
--
Vladimir Botka
--
You rece
: true
gives
mp_add:
alpha: XSLWBxbxPyDOhYs
beta: CdCXIQWsMqpRDao
charlie: vPvFieykftXzppi
_mp_dict:
alpha: XSLWBxbxPyDOhYs
beta: CdCXIQWsMqpRDao
charlie: vPvFieykftXzppi
dummy: dummy
Now the file my-pass-dict.vault comprises encrypted dictionary of the
hosts and
sible_play_hosts_all|difference(ansible_play_hosts) }}"
- debug:
var: down
run_once: true
gives when the host alpha is down
ansible_play_hosts_all:
- alpha
- beta
- charlie
ansible_play_hosts:
- beta
- charlie
down:
- alpha
--
Vladimir Botka
--
You receive
*json_query*. The task below gives the same result
- set_fact:
x: "{{ _list|json_query(query)|first }}"
vars:
query: "[?a1 == 'A']|
[?a2 == `2`]"
A custom filter might be the next option to improve the efficiency of
searching large lists.
-r notify /scratch/ansible-release-notes/ | grep block
/scratch/ansible-release-notes/CHANGELOG-v2.11.rst:- notify keyword
is not ignored anymore on import_tasks, also able to apply to blocks
now.
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"
in 2.10
- hosts: localhost
tasks:
- block:
- command: 'true'
changed_when: true
notify: test
handlers:
- name: test
debug:
msg: Handler test running.
gives
ok: [localhost] =>
msg: Handler test running.
--
Vladimir Botka
--
You received t
d. See the structures of copy,
template, ... , ini_file.
https://ansible-config-light.readthedocs.io/en/latest/guide-variables-files.html#files
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe
latest/guide-variables-files-lineinfile.html#lineinfile
The role will collect the data and create the handlers. See
https://ansible-config-light.readthedocs.io/en/latest/guide.html#setup
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansib
_roles
gives
msg: 'Dell is in in my_roles: True'
msg: Runing on Dell
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an em
On Wed, 16 Jun 2021 18:35:50 +0530
Komal Suthar wrote:
> Any approach to change the existing users password on 200 plus machines in
> a safe way.
Where do you keep the passwords?
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansi
es
ips:
- 192.168.100.14
Then test the presence of the address in the list, e.g.
- debug:
msg: "[OK] 192.168.100.14"
when: "'192.168.100.15' in ips"
vars:
ips: "{{ ansible_net_interfaces.GigabitEthernet1.ipv4|
m
ok: [localhost]
TASK [replace]
**
--- before: etc/file1 +++ after: etc/file1
@@ -1,3 +1,3 @@
10.1.3.50
-10.1.3.51
+10.2.3.54
10.1.3.52
changed: [localhost] => (item=etc/file1)
--
Vladimir Botka
--
You received this message because you ar
priate. Use get_url if the signatures are stored remotely
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/get_url_module.html
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from
d
If the hash differs the playbook will fail
TASK [assert]
*
fatal: [test_11]: FAILED! => changed=false assertion:
result.stat.checksum == my_hash evaluated_to: false
msg: Assertion failed
--
Vladimir Botka
--
You received this message b
On Tue, 1 Jun 2021 13:31:34 -0700 (PDT)
Vikram S wrote:
> Asynchronous actions closely matches my requirements but not exactly.
What requirement doesn't match the functionality of asynchronous
actions?
--
Vladimir Botka
--
You received this message because you are subscribed to the Goo
vars:
_arr: "{{ item.0.1.split() }}"
- debug:
msg: "{{ interfaces[item] }}"
loop:
- GigabitEthernet0/0/0
- Loopback0
gives
msg: 42.151.182.42
msg: 172.31.246.246
--
Vladimir Botka
--
You received this message because you are sub
ot;
should give
interfaces:
GigabitEthernet0/0/0: 42.151.182.42
Loopback0: 172.31.246.246
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails fr
reate a list of *portgroups*, e.g.
- set_fact:
portgroups: "{{ dvs.dvs_portgroup_info['DVS-Dev-Ork2']|
map(attribute='key')|list }}"
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible
y_dict:
a: test value
b: "{{ undefined_var }}"
gives
my_dict.a: VARIABLE IS NOT DEFINED!
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and
On Sun, 16 May 2021 22:51:02 +0200
Vladimir Botka wrote:
> On Sun, 16 May 2021 01:35:46 -0700
> Scott Mcdermott wrote:
>
> > I cannot use a default because this whole thing is relying
> > on whether it's defined or not later to take different actions.
> > the fuller
project == project_bake
> or hostvars[target].ipnet is defined
> set_fact:
> subnet: '{{
> (project == project_bake) | ternary(
> subnet_bake, determined_subnet
> )}}'
What value of *subnet* do you want to set when '(project !=
project_bake) and (determined_s
On Sun, 16 May 2021 08:54:29 +0200
Vladimir Botka wrote:
> On Sat, 15 May 2021 16:55:24 -0700
> Scott Mcdermott wrote:
>
> > Hello, why does short circuit only works for the first two cases:
> >
> > - hosts: localhost
> > become: false
>
ion of host vars is the exact same in cases
> 2 and 3, it's only going through an indirect variable in case 3.
>
> This seems to happen regardless of the source of variables ie
> extra vars, vars_files, etc.
>
> Is this a bug, or what am I missing?
Why don't you start debugg
https://en.wikipedia.org/wiki/Ansible_(software)#References
It seems that the question is rather "How are they supposed to
know that source code is the right place to look for a license?"
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Group
ot;github awx"
https://github.com/ansible/ansible
https://github.com/ansible/awx
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send a
to set the variables
- set_fact:
user: "{{ hpe_sut_cred[inventory_hostname]['user'] }}"
pwd: "{{ hpe_sut_cred[inventory_hostname]['pwd'] }}"
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project"
details see https://jinja.palletsprojects.com/en/master/
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to ansible-project+unsu
On Tue, 4 May 2021 12:05:36 +0200
Vladimir Botka wrote:
On Tue, 4 May 2021 05:27:53 -0400
Dimitri Yioulos wrote:
> - local_action:
> module: copy
> content: |
> {% for host in ansible_play_hosts %}
> {{ host }}
> {{ hostva
found
when: list_of_lines|
select('search', 'OpenJDK|Java\(TM\)')|
list|
length > 0
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from
g)) }}"
vars:
_mypkg: "{{ ansible_play_hosts_all|
map('extract', hostvars, 'mypkg_installed')|
list }}"
run_once: true
gives
mypkg_hosts:
srv1: true
srv2: false
--
Vladimir Botka
--
You received this message because you
uot;{{ groups_name|
default([])|
map('extract', d1)|
list }}"
The command
shell> ansible-playbook pb.yml -e '{"groups_name": ["G1","G2"]}'
should give
msg: A
msg: B
If you have to keep the data in the lists
;
> }
Use *set_fact* when you want to keep the "current" aka "instantiated"
(I'm not sure the wording is correct) value of the variable in
hostvars, e.g.
- set_fact:
testvar02: "{{ testvar02 }}"
- debug:
var: hostvars[ansible_host
asswd"
src: my_vault_passwd.j2
mode: "0600"
- include_vars: vault.yml
- template:
dest: "{{ playbook_dir }}/my_vault_passwd"
src: dummy_vault_passwd.j2
mode: "0600"
--
Vladimir Botka
--
You received this messa
What type is the attribute *stderr*? Try
- debug:
msg: "{{ sql_delete.stderr|type_debug }}"
If the type is string convert it to dictionary first, e.g
- debug:
msg: "{{ _stderr.xmlhint }}"
vars:
_stderr: "{{ sql_delete.stderr|from_yaml }}"
ession to look for in every line of the file ...
Only the last line found will be replaced."
You might want to mark the blocks and use *blockinfile* if you can't
use *template*.
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project
path: "{{ item.0 }}"
regexp: "{{ item.1.from }}"
line: "{{ item.1.replace_with }}"
with_nested:
- - “/opt/file1”
- “/opt/file2”
- - {from: parameter1=, replace_with: parameter1=test1}
- {from: parameter1=, replace_w
odule.html
- ini_file:
dest: /etc/ansible/hosts
section: MyServers
option: "{{ item }}"
allow_no_value: true
loop: "{{ servers }}"
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
ant.
--
Vladimir Botka
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web
'file', 'ip_list.txt').split('\n')|
map('from_yaml')|list }}"
should give
ip_list:
- [ipadd1, ipadd2, ipadd3, ipadd4]
- [ipadd5, ipadd6, ipadd7, ipadd8]
Select the items, e.g. the third item from the second list
- debug:
var: ip_list[1][2]
should give
ip
> > On Fri, Feb 26, 2021 at 10:28 PM Vladimir Botka wrote:
> > Intuitively, I'd expect `delegate_facts: True` is needed to change the
> > port of rhel8.
> On Fri, 26 Feb 2021 22:55:56 +0100
> Juerg Ritter wrote:
> I'm not sure what you are getting at... The above exa
101 - 200 of 688 matches
Mail list logo