Skip to main content

Posts

Showing posts with the label linux

Useful ansible stuff

inventory_hostname ‘ inventory_hostname ‘ contains the name of the current node being worked on…. (as in, what it is defined in your hosts file as) so if you want to skip a task for a single node – - name: Restart amavis service: name=amavis state=restarted when: inventory_hostname != "boris" (Don’t restart Amavis for boris,  do for all others). You could also use : ... when: inventory_hostname not in groups['group_name'] ... if your aim was to (perhaps skip) a task for some nodes in the specified group.   Need to check whether you need to reboot for a kernel update? If /vmlinuz doesn’t resolve to the same kernel as we’re running Reboot Wait 45 seconds before carrying on… - name: Check for reboot hint. shell: if [ $(readlink -f /vmlinuz) != /boot/vmlinuz-$(uname -r) ]; then echo 'reboot'; else echo 'no'; fi ignore_errors: true register: reboot_hint - name: Rebooting ... command: shutdown -r now "Ansible kernel update applied...

PAE - Physical Address Extension

In  computing ,  Physical Address Extension  ( PAE ), sometimes referred to as  Page Address Extension ,  is a memory management feature for the x86 architecture. PAE was first introduced by Intel in the  Pentium Pro , and later by AMD in the  Athlon  processor.  It defines a  page table  hierarchy of three levels (instead of two), with table entries of 64 bits each instead of 32, allowing these CPUs to directly access a physical  address space  larger than 4  gigabytes  (2 32  bytes). The page table structure used by  x86-64  CPUs when operating in  long mode  further extends the page table hierarchy to four levels, extending the virtual address space, and uses additional physical address bits at all levels of the page table, extending the physical address space. It also uses the topmost bit of the 64-bit page table entry as a no-execute or  "NX" bit , indicating that code cannot be executed from the associated page. The NX feature is also available in  protected mode  when ...

Salt stack formulas:

Add all the configurations in pillar.sls into the target file: 1 2 3 4 5 6 7 8 9 10 11 {%- if salt['pillar.get']('elasticsearch:config') %} /etc/elasticsearch/elasticsearch.yml:    file.managed:      - source: salt://elasticsearch/files/elasticsearch.yml      - user: root      - template: jinja      - require:        - sls: elasticsearch.pkg      - context:          config: {{ salt['pillar.get']('elasticsearch:config', '{}') }} {%- endif %} 2. Create multiple directories if it does not exists 1 2 3 4 5 6 7 8 9 10 11 12 {% for dir in (data_dir, log_dir) %} {% if dir %} {{ dir }}:    file.directory:      - user: elasticsearch      - group: elasticsearch  ...