Reputation: 243
Rightfully or wrongly, I am assuming that in order to achieve the declarative config defined in the *.sls
files the salt master must execute a sequence of imperative commands on each minion. E.g., for something like
install_docker_1703:
pkgrepo.managed:
- humanname: Docker CE Repository
- name: deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
- key_url: https://download.docker.com/linux/ubuntu/gpg
- require_in:
- pkg: docker-ce
pkg.installed:
- name: docker-ce
- hold: True
- refresh: True
- cache_valid_time: 30 # very low value for testing purposes
- version: '17.03.2*'
the sequence of these commands is executed
add-apt-repository <docker-repo>
apt-get update
apt-get install docker-ce=17.03.2-xxxxxxx
plus some checks to verify and compare the current state to the desired one.
I am having trouble debugging the behavior of salt. In the context of the above example, I'm having trouble verifying, whether the apt cache is updated every time I run the salt master (salt '*' state.apply
), or no more frequently than every 30 seconds, or not at all.
How can I output to stdout
(or find in some logfile) the exact sequence of commands executed, plus their respective outputs?
Upvotes: 0
Views: 578
Reputation: 580
You can find detailed command on the minion in the /var/log/salt/minion
file,
Most likely you will need to adjust logging level to DEBUG
, the log_level_logfile: debug
should suffice. Otherwise you will find errors/warns only.
Debugging the behavior: it's best to checkout the salt sources and find by yourself. There are simply far too many branches of execution given different conditions salt minion works in.
Each state (state module) consists of multiple module calls (execution modules). In the execution modules you will find the commands. This is the easiest way of determining what are the exact commands for given state
Upvotes: 1