Saltstack check before using pillar - salt-stack

Good afternoon, if you can help, I will be grateful, I use saltstack with napalm to automate the cisco configuration in the /srv/salt/interfaces/ folder there are 2 files vlan.sls and vlan.jinja, I successfully execute this command from this files when I run, but how to check not applying this config on hardware? Because by default, it immediately applies the change and applies it in startup -config. Thank you very much!!

Related

How to modify the target folder for generated pact files while doing Contract Driven Testing using ScalaPact

I am using scalapact for CDC test.
My tests are running fine and the pact file is generated under target>pacts folder.
I have another folder "files" where I want those pact files to be generated after running the pact tests.
Is there any way I configure the default path for pact files?
This is an area that needs some attention in Scala-Pact, however, someone kindly did a PR for us a while ago that lets you set an environment variable called pact.rootDir.
In practice, on linux/mac that variable is a bit tricky to set because of the ., so exporting it or just using -Dpact.rootDir="<my desired path>" in the command arguments doesn't seem to work. Instead, you need to do this:
env "pact.rootDir=<my desired path>" bash. I haven't tried this on Windows so I don't know if you'd have the same issue.
I've just raised an issue to try and make this easier in the future:
https://github.com/ITV/scala-pact/issues/101
As an alternative, note that the pact directory is really kind of a scratch/tmp area to allow Scala-Pact to compile it's output. If you're running this as part of a build script, you may just want to add a step to copy the assets to a new location once they've been generated.
Also, for some reason we made reading from a directory way easier than writing to one. If you need to read from a dir such as during verification, you can just add --source <my desired path> on the command line.
Hope that helps.

How to handle environment variables on a deployed SF4 application

Symfony introduced a new Dotenv component since Symfony 3 which allows us to handle environment variables as application parameters. This looks really nice and it's the best practice to follow according to 12factor app manifesto.
Now, regarding Symfony 4 they went further by pushing forward this practice and that's why I started using environment variables via the .env file.
And then I wanted to deploy and I realized that the .env file must not be persisted on the server as it would be the same as having a parameters.yml file.
So I've been digging into the documentation a bit and I found this article which explains that we can directly create environment variables via some webserver directives. That's great for code being executed via FPM but it does not tell us how to handle environment variables when running a command via the CLI for instance.
How can I achieve this ?
Should there be an equivalent of a .env file stored somewhere? But then parameters would be duplicated ?
I'm welcoming any help ;)
Finally had the time to check the link Neodan posted and everything is in there!
So for those of you wondering what to do, simply edit the /etc/environment file and add your variables. Then reboot your server and all your processes will have access to these variables.
I guess that's the simplest solution. The only drawback of this method is that these variables are available by any process / users but that's ok as far as I'm concerned.
If you want a more secure solution I suppose that you could, as I stated before, configure your webserver to add environment variables and export them via your .bash_profile or .bashrc file but be careful about how you start your shell (when deploying your application for instance). It's more complicated to maintain and prone to errors I'd say.
N.B.: You also might want to be careful about how you name your variables to prevent collisions.

Writing an appspec.yml File for Deployment from S3 (and/or Bit Bucket) to AWS CodeDeploy

I'd like to make it so that a commit to our BitBucket repo (or S3 Bucket) automatically deploys code (using CodeDeploy) to our EC2 instances. I'm not clear what to use for the 'source' and 'destination' entry under the 'files' section in the appspec.yml file and also I am not cleared what to mention in BeforeInstall and AfterInstall under 'Hooks' section. I've found some examples on Google and AWs documentation but I am confused what to mention in above fields. The more I am exploring more I am getting confused.
Consider I am new to AWS Code Deploy.
Also it will be very helpful if someone can provide me step y step link how to configure and how to automate the CodeDeploy.
I was wondering if someone could help me out?
Thanks in advance for your help!
Thanks for using CodeDeploy. For new users, I'd like to recommend the following things to do:
Try to run First Run Wizard on console, it will should you the general process how the deployment goes. It also provide a default deployment bundle, also an appspec file included.
Once you want to try a deployment yourself, the Get Started doc is a great place to help you with some pre-requiste settings like IAM role
Then probably try some tutorials for a sample app too, which gives you some idea about deployment groups, deployment configuration, revision and so on.
The next step should be create a bundle for your own use cases, Appspec file doc would be a great place to refer. And for your concerns about BeforeInstall and AfterInstall, if your application doesn't need to do anything, the lifecycle events can be left as empty. BeforeInstall can be used to for for preinstall tasks, such as decrypting files and creating a backup of the current version, while AfterInstall can be used for tasks such as configuring your application or changing file permissions.
Now it comes to the fun part! This blog talks about details about how to integrate with Github(similar for Bitbucket). It's a little long, but really useful, and it also includes how to do automatically deployment once there is a new pushed commit. Currently Jenkins and CodePipline are really popular for auto-triggered deplyoments, but there are always a lot of other ways can achieve the same purpose like Lamda and so on

Restarting CoreOS missing files

Trying to evaluate CoreOS. It really looks like it is an interesting product and I was trying to see about simply starting up networking. I got a static configuration to work by doing the following:
Create a static network file in the /etc/systemd/network/ folder.
It is my understanding that the important parts of the file name I drop into this directory are the number at the beginning of the file for cases when I have multiple network files this will help to determine which file is applied first and the ".network" suffix to declare that this is a network configuration file
The contents of /etc/systemd/network/10-static.network is as follows (yes, this is a very simple configuration):
[Network]
Address=192.168.1.102/24
Gateway=192.168.1.2
I then tried starting the service: sudo systemctl start systemd-networkd
This actually worked and assigned a static ip address that was visible when running ifconfig.
Here is my problem. I rebooted the CoreOS virtual machine and noticed that the networking was no longer set on reboot. When I check the /etc/systemd/network/ folder it is empty and my configuration file apparently disappeared on reboot.
Does anyone know why this would have happened?
Thanks in advance for any help on this!
You must remove ISO image, coreOS maybe reboot same ISO image. If you remove ISO image, coresystem can reboot from new system.
I experienced the same situation before.
Files on disk shouldn't disappear on you like that. Did you happen to PXE-boot this VM or somehow use a file system in RAM?
A better way to do this config is with cloud-config, which CoreOS uses to configure machines at boot. It's intended to provide a repeatable way to set up networking, mount disks and things like that. The steps that you completed manually can be done with cloud-config like this: https://coreos.com/docs/cluster-management/setup/network-config-with-networkd/
More info about cloud-config in general: https://coreos.com/docs/cluster-management/setup/cloudinit-cloud-config/

Is there any way to run Jubula tests from console?

I want to run prewritten Jubula tests (possibly on remote machine) from console and receive output in logfile. Is there any way to do it? I haven't found any information about that nor in Google neither in Jubula help.
Sure there is!
You need to call the testexec.exe (It's placed in "jubula_install"/jubula/ folder)
It has a LOT of parameters and many of them is mandatory. See them below:
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jubula.client.ua.help%2Fhtml%2Fmanual%2Fnode260.html
Thus I'd recommend you writing batch files for your favorite configurations.

Resources