Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to implement? #31

Open
ghost opened this issue May 12, 2020 · 1 comment
Open

How to implement? #31

ghost opened this issue May 12, 2020 · 1 comment
Labels

Comments

@ghost
Copy link

ghost commented May 12, 2020

I'm currently facing some issue using saltstack to enroll my landscape.
I would like that salt manages the /etc/hosts file on all my minions/servers.
Therefor I added the hostsfile-formular to my saltstack via a Git-remoteFS
but it seems to have no effect. No hosts file gets placed anywhere, Please also see:
What i'm doing wrong here?

my tree:

root@salt:/srv# tree
.
├── formulas
├── pillar
│   ├── hostsfile.sls
│   └── timezone.sls
├── README.md
└── salt
    ├── base.sh
    ├── docker
    │   └── init.sls
    ├── fail2ban
    │   ├── init.sls
    │   ├── jail.conf
    │   └── jail.local
    ├── glusterfs
    │   └── init.sls
    ├── iptables
    │   ├── init.sls
    │   ├── nodes
    │   └── template.j2
    ├── minion
    ├── scripts
    │   ├── add_minion.sh
    │   ├── remove_minion.sh
    │   └── salt_master_enroll.sh
    ├── ssh
    │   ├── authorized_keys
    │   ├── init.sls
    │   ├── motd
    │   ├── server.sls
    │   └── sshd_config
    ├── toolstack
    │   └── init.sls
    └── top.sls

/etc/salt/minion (same on all minions):

mine_functions:
  network.interfaces: []
  network.ip_addrs:
    - enp7s0
mine_interval: 2

/etc/salt/master (salt master only)

interface: 10.10.10.2


pillar_roots:
  base:
    - /srv/pillar


fileserver_backend:
  - git
  - roots

# Add your remote formular repos here:
gitfs_remotes:
  - https://github.com/saltstack-formulas/timezone-formula.git
  - https://github.com/saltstack-formulas/hostsfile-formula.git
  - https://github.com/salt-formulas/salt-formula-glusterfs.git

gitfs_provider: gitpython

/etc/salt/top.sls:

base:           # Apply SLS files from the directory root for the 'base' environment

  '*':
    - timezone  # Set the general timezone
    - hostsfile # Set the /etc/hosts file

  'salt':    	# For salt master node as there is only one
    - toolstack # Apply basic toolstack to node
...

Finally my hostsfile.sls pillar at /srv/pillar/hostsfile.sls:

hostsfile:
  domain: local
  hosts:
    salt: 10.10.10.2
    master1: 10.10.10.3
  only:
    127.0.0.1:
      - localhost
      - localhost.localdomain
    # Removes all entries for 127.0.1.1:
    127.0.1.1: []

Can smb explain to me why my hostsfile has no effect at all. What do I miss here?

@ghost ghost added the bug label May 12, 2020
@ghost ghost changed the title [BUG] How to implement? May 12, 2020
@ghost ghost closed this as completed May 12, 2020
@ghost ghost reopened this May 12, 2020
@daks
Copy link
Member

daks commented Jul 15, 2020

are you still blocked by this? Can you come ask for help on IRC #saltstack-formulas or on the saltstack slack instance on #formulas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant