Bläddra i källkod

Merge pull request #11 from salt-formulas/master

Sync Forc
pull/221/head
preussal 2 år sedan
förälder
incheckning
f4225af445
Inget konto är kopplat till bidragsgivarens mejladress
8 ändrade filer med 47 tillägg och 23 borttagningar
  1. +5
    -5
      README.rst
  2. +4
    -14
      _modules/linux_hosts.py
  3. +1
    -1
      _modules/ovs_config.py
  4. +23
    -1
      linux/map.jinja
  5. +3
    -0
      linux/network/interface.sls
  6. +3
    -0
      linux/system/job.sls
  7. +7
    -1
      linux/system/motd.sls
  8. +1
    -1
      linux/system/user.sls

+ 5
- 5
README.rst Visa fil

@@ -1,5 +1,5 @@
============
Linux Fomula
Linux Formula
============

Linux Operating Systems:
@@ -33,7 +33,7 @@ Basic Linux box
Linux with system users, some with password set:

.. warning:: If no ``password`` variable is passed,
any predifined password will be removed.
any predefined password will be removed.

.. code-block:: yaml

@@ -67,7 +67,7 @@ Linux with system users, some with password set:
elizabeth:
name: 'elizabeth'
enabled: true
full_name: 'With hased password'
full_name: 'With hashed password'
home: '/home/elizabeth'
password: "$6$nUI7QEz3$dFYjzQqK5cJ6HQ38KqG4gTWA9eJu3aKx6TRVDFh6BVJxJgFWg2akfAA7f1fCxcSUeOJ2arCO6EEI6XXnHXxG10"

@@ -889,7 +889,7 @@ Optional: You can also use list that will ensure order of items.

Sysfs definition with disabled automatic write. Attributes are saved
to configuration, but are not applied during the run.
Thay will be applied automatically after the reboot.
They will be applied automatically after the reboot.


.. code-block:: yaml
@@ -980,7 +980,7 @@ RedHat-based Linux with additional OpenStack repo:
rdo-icehouse:
enabled: true
source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/'
pgpcheck: 0
gpgcheck: 0

Ensure system repository to use czech Debian mirror (``default: true``)
Also pin it's packages with priority ``900``:

+ 4
- 14
_modules/linux_hosts.py Visa fil

@@ -9,22 +9,12 @@ from jinja2 import Undefined
def __virtual__():
return 'linux_hosts'

def fqdn_sort_fn(n1, n2):
l1 = n1.split('.')
l2 = n2.split('.')
if len(l1) > len(l2):
return -1
if len(l1) < len(l2):
return 1
for i1, i2 in zip(l1, l2):
if i1 < i2:
return -1
if i1 > i2:
return 1
return 0
def fqdn_sort_fn(n1):
length = len(n1)
return length

def fqdn_sort_filter(iterable):
if iterable is None or isinstance(iterable, Undefined):
return iterable
# Do effective custom sorting of iterable here
return sorted(set(iterable), cmp=fqdn_sort_fn)
return sorted(set(iterable), key=fqdn_sort_fn)

+ 1
- 1
_modules/ovs_config.py Visa fil

@@ -22,7 +22,7 @@ def __virtual__():

def _retcode_to_bool(retcode):
'''
Evaulates ovs-vsctl command`s retcode value.
Evaluates ovs-vsctl command`s retcode value.

Args:
retcode: Value of retcode field from response.

+ 23
- 1
linux/map.jinja Visa fil

@@ -109,7 +109,17 @@
'services': []
},
},
}, grain='os_family', merge=salt['pillar.get']('linux:system')) %}
}, merge=salt['grains.filter_by']({
'bullseye': {
'pkgs': ['python3-apt', 'apt-transport-https', 'libmnl0'],
},
'bookworm': {
'pkgs': ['python3-apt', 'apt-transport-https', 'libmnl0'],
},
'sid': {
'pkgs': ['python3-apt', 'apt-transport-https', 'libmnl0'],
},
}, grain='oscodename', merge=salt['pillar.get']('linux:system'))) %}

{% set banner = salt['grains.filter_by']({
'BaseDefaults': {
@@ -383,12 +393,24 @@ Debian:
},
},
}, merge=salt['grains.filter_by']({
'CentOS Stream 8': {
'lvm_services': ['lvm2-lvmpolld', 'lvm2-monitor'],
},
'focal': {
'lvm_services': ['lvm2-monitor'],
},
'buster': {
'lvm_services': ['lvm2-monitor'],
},
'bullseye': {
'lvm_services': ['lvm2-monitor'],
},
'bookworm': {
'lvm_services': ['lvm2-monitor'],
},
'sid': {
'lvm_services': ['lvm2-monitor'],
},
'trusty': {
'lvm_services': ['udev'],
},

+ 3
- 0
linux/network/interface.sls Visa fil

@@ -283,6 +283,9 @@ linux_interface_{{ interface_name }}:
{%- if interface.name_servers is defined %}
- dns: {{ interface.name_servers }}
{%- endif %}
{%- if interface.metric is defined and grains.os_family == 'Debian' %}
- metric: {{ interface.metric }}
{%- endif %}
{%- if interface.wireless is defined and grains.os_family == 'Debian' %}
{%- if interface.wireless.security == "wpa" %}
- wpa-ssid: {{ interface.wireless.essid }}

+ 3
- 0
linux/system/job.sls Visa fil

@@ -16,6 +16,9 @@ linux_job_{{ job.command }}:
{%- if job.get('identifier', True) %}
- identifier: {{ job.get('identifier', job.get('name', name)) }}
{%- endif %}
{%- if job.get('commented', False) %}
- commented: True
{%- endif %}
- user: {{ job_user }}
{%- if job.special is defined %}
- special: '{{ job.special }}'

+ 7
- 1
linux/system/motd.sls Visa fil

@@ -25,6 +25,10 @@ motd_fix_pam_sshd:
/etc/motd:
file.absent

exist_/etc/update-motd.d:
file.directory:
- name: /etc/update-motd.d

{%- for motd in system.motd %}
{%- set motd_index = loop.index %}

@@ -35,8 +39,10 @@ motd_{{ motd_index }}_{{ name }}:
- source: salt://linux/files/motd.sh
- template: jinja
- mode: 755
- require:
- require_in:
- file: /etc/update-motd.d
- require:
- file: exist_/etc/update-motd.d
- defaults:
index: {{ motd_index }}
motd_name: {{ name }}

+ 1
- 1
linux/system/user.sls Visa fil

@@ -49,7 +49,7 @@ system_user_{{ name }}:
{%- if user.gid is defined and user.gid %}
- gid: {{ user.gid }}
{%- else %}
- gid_from_name: true
- gid: {{ name }}
{%- endif %}
{%- if user.groups is defined %}
- groups: {{ user.groups }}

Laddar…
Avbryt
Spara