Add support for setting timezone
This commit is contained in:
@@ -11,6 +11,7 @@ Please refer to the SaltStack [Release Notes](https://docs.saltstack.com/en/deve
|
|||||||
- Add `PyGit2` support
|
- Add `PyGit2` support
|
||||||
- Expose `/home/salt/data/logs`
|
- Expose `/home/salt/data/logs`
|
||||||
- Run `salt-master` as `salt` user
|
- Run `salt-master` as `salt` user
|
||||||
|
- Add support for setting timezone
|
||||||
|
|
||||||
**2018.3.2**
|
**2018.3.2**
|
||||||
|
|
||||||
|
|||||||
1
LICENSE
1
LICENSE
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ gitfs_privkey: /home/salt/data/keys/gitfs/gitfs_ssh
|
|||||||
gitfs_pubkey: /home/salt/data/keys/gitfs/gitfs_ssh.pub
|
gitfs_pubkey: /home/salt/data/keys/gitfs/gitfs_ssh.pub
|
||||||
```
|
```
|
||||||
|
|
||||||
**Important Note**
|
**Important Note**
|
||||||
|
|
||||||
If you get the following error while using `gitfs` with `pygit2`
|
If you get the following error while using `gitfs` with `pygit2`
|
||||||
|
|
||||||
@@ -178,7 +178,9 @@ Please refer the docker run command options for the `--env-file` flag where you
|
|||||||
Below is the list of available options that can be used to customize your SaltStack master installation.
|
Below is the list of available options that can be used to customize your SaltStack master installation.
|
||||||
|
|
||||||
| Parameter | Description |
|
| Parameter | Description |
|
||||||
|-----------|-------------|
|
|:----------|:------------|
|
||||||
|
| `DEBUG` | Set this to `true` to enable entrypoint debugging. |
|
||||||
|
| `TIMEZONE` | Set the container timezone. Defaults to `UTC`. Values are expected to be in Canonical format. Example: `Europe/Madrid`. See the list of [acceptable values](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). |
|
||||||
| `SALT_LOG_LEVEL` | The level of messages to send to the console. One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'. Default: `warning` |
|
| `SALT_LOG_LEVEL` | The level of messages to send to the console. One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'. Default: `warning` |
|
||||||
| `SALT_LEVEL_LOGFILE` | The level of messages to send to the log file. One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'. Default: `warning` |
|
| `SALT_LEVEL_LOGFILE` | The level of messages to send to the log file. One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'. Default: `warning` |
|
||||||
| `SALT_MASTER_SIGN_PUBKEY` | Sign the master auth-replies with a cryptographic signature of the master's public key. Possible values: 'True' or 'False'. Default: `False` |
|
| `SALT_MASTER_SIGN_PUBKEY` | Sign the master auth-replies with a cryptographic signature of the master's public key. Possible values: 'True' or 'False'. Default: `False` |
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
DEBUG=${DEBUG:-false}
|
||||||
|
TIMEZONE=${TIMEZONE:-UTC}
|
||||||
|
|
||||||
# https://docs.saltstack.com/en/latest/ref/configuration/master.html
|
# https://docs.saltstack.com/en/latest/ref/configuration/master.html
|
||||||
|
|
||||||
##### Logging settings #####
|
##### Logging settings #####
|
||||||
|
|||||||
@@ -57,11 +57,31 @@ function update_template()
|
|||||||
rm -f ${tmp_file}
|
rm -f ${tmp_file}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# This function configures containers timezone
|
||||||
|
function configure_timezone()
|
||||||
|
{
|
||||||
|
echo "Configuring container timezone ..."
|
||||||
|
|
||||||
|
# Perform sanity check of provided timezone value
|
||||||
|
if [ -e /usr/share/zoneinfo/${TIMEZONE} ]; then
|
||||||
|
echo "Setting TimeZone -> ${TIMEZONE} ..."
|
||||||
|
|
||||||
|
# Set localtime
|
||||||
|
ln -snf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime
|
||||||
|
|
||||||
|
# Set timezone
|
||||||
|
echo ${TIMEZONE} > /etc/timezone
|
||||||
|
else
|
||||||
|
echo "Timezone: '${TIMEZONE}' is not valid. Check available timezones at: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# This function generates a master_sign key pair and its signature
|
# This function generates a master_sign key pair and its signature
|
||||||
function gen_signed_keys()
|
function gen_signed_keys()
|
||||||
{
|
{
|
||||||
local key_name=${1:-master}
|
local key_name=${1:-master}
|
||||||
|
|
||||||
mkdir -p ${SALT_KEYS_DIR}/generated/
|
mkdir -p ${SALT_KEYS_DIR}/generated/
|
||||||
GENERATED_KEYS_DIR=$(mktemp -d -p ${SALT_KEYS_DIR}/generated/ -t ${key_name}.XXXXX)
|
GENERATED_KEYS_DIR=$(mktemp -d -p ${SALT_KEYS_DIR}/generated/ -t ${key_name}.XXXXX)
|
||||||
|
|
||||||
@@ -146,7 +166,7 @@ function configure_salt_master()
|
|||||||
function initialize_datadir()
|
function initialize_datadir()
|
||||||
{
|
{
|
||||||
echo "Configuring directories ..."
|
echo "Configuring directories ..."
|
||||||
|
|
||||||
# This symlink simplifies paths for loading sls files
|
# This symlink simplifies paths for loading sls files
|
||||||
[[ -d /srv ]] && [[ ! -L /srv ]] && rm -rf /srv
|
[[ -d /srv ]] && [[ ! -L /srv ]] && rm -rf /srv
|
||||||
ln -sfnv ${SALT_BASE_DIR} /srv
|
ln -sfnv ${SALT_BASE_DIR} /srv
|
||||||
@@ -174,6 +194,7 @@ function initialize_system()
|
|||||||
{
|
{
|
||||||
map_uidgid
|
map_uidgid
|
||||||
initialize_datadir
|
initialize_datadir
|
||||||
|
configure_timezone
|
||||||
configure_salt_master
|
configure_salt_master
|
||||||
setup_salt_keys
|
setup_salt_keys
|
||||||
setup_ssh_keys
|
setup_ssh_keys
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ services:
|
|||||||
master:
|
master:
|
||||||
container_name: salt_master
|
container_name: salt_master
|
||||||
image: cdalvaro/saltstack-master:2018.3.3
|
image: cdalvaro/saltstack-master:2018.3.3
|
||||||
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- "./srv/:/home/salt/data/srv"
|
- "./srv/:/home/salt/data/srv"
|
||||||
ports:
|
ports:
|
||||||
@@ -11,6 +12,7 @@ services:
|
|||||||
- "4506:4506/tcp"
|
- "4506:4506/tcp"
|
||||||
environment:
|
environment:
|
||||||
- DEBUG=false
|
- DEBUG=false
|
||||||
|
- TIMEZONE=Europe/Madrid
|
||||||
- USERMAP_UID=1000
|
- USERMAP_UID=1000
|
||||||
- USERMAP_GID=1000
|
- USERMAP_GID=1000
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user