Do we have any options to apply security patches only with Zypper ansible module for suse linux server. We don't want to use shell or command module and incorporate the command.
Equivalent command shell: zypper patch --category=security
Do we have any options to apply security patches only with Zypper ansible module for suse linux server. We don't want to use shell or command module and incorporate the command.
Equivalent command shell: zypper patch --category=security
I need to create users inputting from 2 list files as below:
cat user.yml
user1
user2
user3
cat group.yml
group1
group2
group3
cat playbook.yml
- name: Add the user
user:
name: "{{ item[0] }}"
group: "{{ item[1] }}"
with_nested:
- cat user.yml
- cat group.yml
The two files will get inputs dynamically from other tasks, so I will not be able to mention the list in ['user1', 'user2'] like that. Kindly suggest how to cat two lists using with_nested
I'm trying to install pyodbc using pip3 but getting the below error:
[hvr@07EUW1HVRHAP02A ~]$ pip3 install pyodbc
Collecting pyodbc
Using cached https://files.pythonhosted.org/packages/81/0d/bb08bb16c97765244791c73e49de9fd4c24bb3ef00313aed82e5640dee5d/pyodbc-4.0.30
.tar.gz
Installing collected packages: pyodbc
Running setup.py install for pyodbc ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-dp0ls1b2/pyodbc/setup.py'
;f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" insta
ll --record /tmp/pip-0dv3z9sq-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'pyodbc' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-s
trong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYODBC_VERSION=4.0.30 -I/
usr/include/python3.6m -c src/buffer.cpp -o build/temp.linux-x86_64-3.6/src/buffer.o -Wno-write-strings -DHAVE_UNISTD_H -DHAVE_PWD_H -D
HAVE_SYS_TYPES_H -DHAVE_LONG_LONG -DSIZEOF_LONG_INT=8 -I/usr/include
In file included from src/buffer.cpp:12:0:
src/pyodbc.h:56:17: fatal error: sql.h: No such file or directory
#include <sql.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-dp0ls1b2/pyodbc/setup.py';f=getattr(tokenize, 'op
en', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-0dv
3z9sq-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-dp0ls1b2/pyod
bc/
I'm preparing a playbook to find the newly scanned HDD from vmware, I used below filtering to fetch the no. of HDDs:
before_add: "{{ hostvars[inventory_hostname].ansible_devices.keys() | select('string') | list }}"
OUTPUT- ['sr0', 'sda', 'sdb', 'sdc', 'dm-2', 'dm-3', 'dm-0', 'dm-1']
then add a new HDD using vmware_guest_disk module and then I executed the setup module to fetch the latest no. of disks
after_add: "{{ hostvars[inventory_hostname].ansible_devices.keys() | select('string') | list }}"
OUTPUT: ['sr0', 'sda', 'sdb', 'sdc', 'sdd', 'dm-2', 'dm-3', 'dm-0', 'dm-1']
Since the managed host is remote node, I'm not able to think of lookup and difference filtering. Kindly suggest how to fetch the difference: "SDD"
- name: Check the VolumeGroup has 5gb space
assert:
that: ansible_lvm.vgs.VG00.free_g|int >= 5
fail_msg: 'VG has no free space'
success_msg: "{{ ansible_lvm.vgs.rhel.free_g }}"
register: vg00
- name: Line in file
shell: echo -e "{{ ansible_fqdn }},VG_FREE=0" >> /tmp/failed.txt
delegate_to: localhost
when: "'FATAL' in vg00"
I need only the failed hosts to be redirected using when condition but it is not working. Any different condition will help
I'm trying to write to task when /var partition exists. I used assert variable
- name: Apply patch if /var exist and > 300MB
yum:
name: '*'
state: latest
loop: "{{ ansible_mounts }}"
when: item.mount == "/var" and item.size_available > 300000000
It should fail or skip if /var does not exist. Which is not happening. Please suggest how to skip if /var does not exist