Browse Source

Merge pull request #11 from salt-formulas/master

Sync Forc
pull/221/head
preussal 2 years ago
parent
commit
f4225af445
No account linked to committer's email address
8 changed files with 47 additions and 23 deletions
  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 View File

============ ============
Linux Fomula
Linux Formula
============ ============


Linux Operating Systems: Linux Operating Systems:
Linux with system users, some with password set: Linux with system users, some with password set:


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


.. code-block:: yaml .. code-block:: yaml


elizabeth: elizabeth:
name: 'elizabeth' name: 'elizabeth'
enabled: true enabled: true
full_name: 'With hased password'
full_name: 'With hashed password'
home: '/home/elizabeth' home: '/home/elizabeth'
password: "$6$nUI7QEz3$dFYjzQqK5cJ6HQ38KqG4gTWA9eJu3aKx6TRVDFh6BVJxJgFWg2akfAA7f1fCxcSUeOJ2arCO6EEI6XXnHXxG10" password: "$6$nUI7QEz3$dFYjzQqK5cJ6HQ38KqG4gTWA9eJu3aKx6TRVDFh6BVJxJgFWg2akfAA7f1fCxcSUeOJ2arCO6EEI6XXnHXxG10"




Sysfs definition with disabled automatic write. Attributes are saved Sysfs definition with disabled automatic write. Attributes are saved
to configuration, but are not applied during the run. 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 .. code-block:: yaml
rdo-icehouse: rdo-icehouse:
enabled: true enabled: true
source: 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6/' 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``) Ensure system repository to use czech Debian mirror (``default: true``)
Also pin it's packages with priority ``900``: Also pin it's packages with priority ``900``:

+ 4
- 14
_modules/linux_hosts.py View File

def __virtual__(): def __virtual__():
return 'linux_hosts' 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): def fqdn_sort_filter(iterable):
if iterable is None or isinstance(iterable, Undefined): if iterable is None or isinstance(iterable, Undefined):
return iterable return iterable
# Do effective custom sorting of iterable here # 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 View File



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


Args: Args:
retcode: Value of retcode field from response. retcode: Value of retcode field from response.

+ 23
- 1
linux/map.jinja View File

'services': [] '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']({ {% set banner = salt['grains.filter_by']({
'BaseDefaults': { 'BaseDefaults': {
}, },
}, },
}, merge=salt['grains.filter_by']({ }, merge=salt['grains.filter_by']({
'CentOS Stream 8': {
'lvm_services': ['lvm2-lvmpolld', 'lvm2-monitor'],
},
'focal': { 'focal': {
'lvm_services': ['lvm2-monitor'], 'lvm_services': ['lvm2-monitor'],
}, },
'buster': { 'buster': {
'lvm_services': ['lvm2-monitor'], 'lvm_services': ['lvm2-monitor'],
}, },
'bullseye': {
'lvm_services': ['lvm2-monitor'],
},
'bookworm': {
'lvm_services': ['lvm2-monitor'],
},
'sid': {
'lvm_services': ['lvm2-monitor'],
},
'trusty': { 'trusty': {
'lvm_services': ['udev'], 'lvm_services': ['udev'],
}, },

+ 3
- 0
linux/network/interface.sls View File

{%- if interface.name_servers is defined %} {%- if interface.name_servers is defined %}
- dns: {{ interface.name_servers }} - dns: {{ interface.name_servers }}
{%- endif %} {%- 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 is defined and grains.os_family == 'Debian' %}
{%- if interface.wireless.security == "wpa" %} {%- if interface.wireless.security == "wpa" %}
- wpa-ssid: {{ interface.wireless.essid }} - wpa-ssid: {{ interface.wireless.essid }}

+ 3
- 0
linux/system/job.sls View File

{%- if job.get('identifier', True) %} {%- if job.get('identifier', True) %}
- identifier: {{ job.get('identifier', job.get('name', name)) }} - identifier: {{ job.get('identifier', job.get('name', name)) }}
{%- endif %} {%- endif %}
{%- if job.get('commented', False) %}
- commented: True
{%- endif %}
- user: {{ job_user }} - user: {{ job_user }}
{%- if job.special is defined %} {%- if job.special is defined %}
- special: '{{ job.special }}' - special: '{{ job.special }}'

+ 7
- 1
linux/system/motd.sls View File

/etc/motd: /etc/motd:
file.absent file.absent


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

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


- source: salt://linux/files/motd.sh - source: salt://linux/files/motd.sh
- template: jinja - template: jinja
- mode: 755 - mode: 755
- require:
- require_in:
- file: /etc/update-motd.d - file: /etc/update-motd.d
- require:
- file: exist_/etc/update-motd.d
- defaults: - defaults:
index: {{ motd_index }} index: {{ motd_index }}
motd_name: {{ name }} motd_name: {{ name }}

+ 1
- 1
linux/system/user.sls View File

{%- if user.gid is defined and user.gid %} {%- if user.gid is defined and user.gid %}
- gid: {{ user.gid }} - gid: {{ user.gid }}
{%- else %} {%- else %}
- gid_from_name: true
- gid: {{ name }}
{%- endif %} {%- endif %}
{%- if user.groups is defined %} {%- if user.groups is defined %}
- groups: {{ user.groups }} - groups: {{ user.groups }}

Loading…
Cancel
Save