Skip to content

An Ansible role to install and configure Saltstack's on nodes. Masters will suport gitfs (also over https and with authentication), for minions - Windows is supported.

Notifications You must be signed in to change notification settings

denis-kalinin/saltstack-installer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

saltstack-installer

Build Status

There was a joke:

— What is there Internet Explorer on Windows for?
— Just to download Firefox!

The same I would say about Ansible and Saltstack. Indeed there is Salt-SSH, but it has some disadvantages versus Ansible for agentless configuration:

Saltstack is more robust and flexible than Ansible, (imho!!!) and my tactic is to install Saltstack and its configuration on nodes with Ansible.

Also this playbook will install Saltstack masters with fully fledged GitFS (Git fileserver backend) — compiles and installs Pygit2 as provider.
Pygit2 is the only provider supporting HTTPS and Authentication to GIT servers – as I found out, others (GitPython and Dulwich) are lacking these features.
Ubuntu and Centos have inappropriate versions in their repositories, that's why we need to compile libgit2, the pygit2's backbone, from source.

Requirements

Role Variables

A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.

  1. dk_salt_master_addresses – array of salt masters, to be provided to dk_salt_minion_config
  2. dk_salt_minion_config – location of minion's jinja-template in your playbook
  3. dk_salt_master_config – location of master's jinja-template in your playbook

dk_salt_master_addresses

The array can be fetched, say, from group [master] in the playbook's inventory:

[master]
10.24.53.2
10.24.53.4

Just add pre_task:

  pre_tasks:
    - name: setting fact about masters IP addresses
      set_fact:
        master_ips: "{% set masters = [] %}{% for host in groups.master %}{% set masters = masters.append(hostvars[host].ansible_default_ipv4.address) %}{% endfor %}{{ masters | to_json }}"
      when: (master_ips is not defined)

and then, in the role definition:

  roles:
    - role: saltstack-installer
      dk_salt_master_addresses: "{{master_ips}}"
      dk_salt_minion_config: "{{ minion_config_file | default(None) }}"
      dk_salt_master_config: "{{ master_config_file | default(None) }}"

dk_salt_minion_config

dk_salt_minion_config should reside somewhere in your playbook. Example of minion config as Jinja template:

master: {{ dk_salt_master_addressess }}
id: {{ inventory_hostname }}
hash_type: sha256
master_tries: -1
auth_tries: 15
auth_safemode: true
mine_interval: 3
startup_states: highstate
grains:
  role: {{ roles | to_json }}
  cluster: test-1
  {% if public_cname is defined -%}
  public_network:
    ip: {{ ansible_host }}
    cname: {{ public_cname }}
  {% endif %}

Dependencies

This role doesn't depend on other roles.

Example Playbook

---
- name: Install Salt minions on hosts
  hosts: all
  gather_facts: true
  become: false
  roles:
    - role: saltstack-installer
      dk_salt_master_addresses: "{{master_ips}}"
      dk_salt_minion_config: "{{ minion_config_file | default(None) }}"
      dk_salt_master_config: "{{ master_config_file | default(None) }}"

License

MIT

Author Information

Denis Kalinin, http://github.com/denis-kalinin

About

An Ansible role to install and configure Saltstack's on nodes. Masters will suport gitfs (also over https and with authentication), for minions - Windows is supported.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published