Last active
December 27, 2015 23:09
-
-
Save LeeBrown/7403445 to your computer and use it in GitHub Desktop.
example call: salt -l debug -v NetMon_Sonoma state.sls ssh-keys.generate-host-key. generate-host-key is executed on NetMon_Sonoma. NetMon_Sonoma fires an event on the master. Master executes the sync-shared-keys.sls with data['data']['foo'] equal to 'mMaster', filters correctly How do I pass information to the fetch-host-keys when I execute the …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# salt -l debug -v NetMon_Sonoma state.sls ssh-keys.generate-host-key. | |
generate-host-key is executed on NetMon_Sonoma. | |
NetMon_Sonoma fires an event on the master. | |
Master executes the sync-shared-keys.sls with data['data']['foo'] equal to 'mMaster'. the ssh-keys/fetch-host-keys.sls is executed on the mMaster minion. | |
How do I pass information to the fetch-host-keys when I execute the sls? | |
Is this what kwargs is used for? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remove_known_host: | |
module.run: | |
- name: ssh.rm_known_host | |
- {{ kwargs['something'] }} | |
How do I get this data ^^^^^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/etc/ssh/ssh_host_rsa_key: | |
file.absent | |
update_ssh_host_rsa_key: | |
cmd.run: | |
- name: "/usr/bin/ssh-keygen -t rsa -b 2048 -N \"\" -q -f /etc/ssh/ssh_host_rsa_key" | |
- cwd: /root | |
update_ssh_host_rsa_key.pub: | |
module.run: | |
- name: "event.fire_master" | |
- fun: fire_master | |
- tag: RefreshHostSSHPub | |
- data: {"foo": "mMaster"} | |
### The data foo is usable in the reactor's sync-shared-keys.sls. We use it to build the targeting filter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reactor: | |
- 'RefreshHostSSHPub': | |
- /usr/local/etc/salt/states/ssh-keys/reactor/sync-shared-keys.sls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Unfortunately the
kwargs
parameter is not used for what you're trying to do. However there is a keyword argument that will work for what your'e doing:pillar
.At the CLI you can do something like:
And access that Pillar data in "mysls.sls" via the usual way:
So if you change the
kwargs
in yoursync-shared-keys.sls
topillar
it should work.