Ansible comes with a vault feature. It is meant to be used in the context of configuration management. But you can also use it as a standalone simple password vault for your personal or organization's use.
Initial setup of password vault:
ansible-vault create myvault.secret
git add myvault.secret git commit -m "My vault"
At this point, your password vault is setup and pushed to your central Git repository. The next time you want to use it on another or same device, here's the flow you could use:
ansible-vault view myvault.secret
ansible-vault edit myvault.secret
git add myvault.secret git commit -m "Save again"
Keep in mind that Git will treat your password vault as a binary file.
How do you install a specific version of Ruby on CentOS 7?
The answer: via SCL.
The Ansible role bngsudheer.ruby makes it even more easier.
Create the file ruby_playbook.yml and insert the following contents:
- hosts: my_ruby_servers vars: ruby_version: 2.3 roles: - bngsudheer.ruby
Once done, run the Ansible playbook:
What if I want to install Ruby 2.4 on CentOS?
2.4. Similarly, if you want to install Ruby
It is also possible to enable particular version of Ruby on a per-user basis. For example, to enable Ruby 2.5 for the user
myproject user, set
On recent versions of Fedora, CentOS and RHEL, /var/run and /var/lock are mounted as /tmpfs. Also, /var/run is a symlink to /run. Because of this, if you create a directory under /run it won't stay there after a reboot.
If you are starting to migrate your service to systemd or just want to create a directory under /run using systemd, use this simple unit file. The contents of:
[Unit] Description=My Service [Service] # We just want to create the myservice run directory Type=oneshot RuntimeDirectory=myservice User=myuser Group=myuser ExecStart=/bin/true RemainAfterExit=yes [Install] WantedBy=multi-user.target
Replace my.service with an appropriate name for your service. Replace the description, User and Group values to your needs.
Start the unit:
systemctl start my.service
Enable the unit so that it starts when the system boots:
systemctl enable my.service
Systemd can handle directory creation and setting up its attributes for you. You just specifiy the name of the directory in the RuntimeDirectory= directory. When the unit starts, systemd creates the directory and sets its owner and group to the values you specify in User= and Group= directives. So, the counter question is, when systemd can do it for you using a simple directive, why do you want to do it yourself? Also, note that the - prefix just ignores the error when the directory already exists and another attempt is made to create it. Although the error is ignored, it still shows up in red when you check the status of the service.
Type=oneshot means the process is expected to exit before systemd starts follow-up units. Along with this, we also specify RemainAfterExit=yes. We tell systemd that my.service shall be considered active even when all its processes exited. When you query the status of the service, you will see that the unit is active because of this directive.
Typically, you would put the path to your service executable in ExecStart= directive. In our example, we're not doing that yet. We're simply using the sytemd unit file to create the /run/myservice directory. So, we use the placeholder command /bin/true. /bin/true simply returns 0 indicating that the command was executed successfully.
journalctl --since "2017-10-20" --until "2017-10-21"
journalctl --since "2017-10-20 10:00:00" --until "2017-10-21 11:00:00"
journalctl --since "2017-10-20 10:00:00" --until "1 hour ago" journalctl --since "1 hour ago" journalctl --since "2 hour ago" --until "1 hour ago"
journalctl -u alertmanager
where alertnamaner is the systemd unit name.
journalctl -p crit
journalctl -fu prometheus
This is particularly useful when your last command results in an error and you want to the most recent errors. The -x flag adds useful descriptive messages to errors when they are available.
The version of textlive shipped with Fedora 25 was too old for my needs.
$ dnf info texlive
Last metadata expiration check: 22 days, 8:44:09 ago on Wed Apr 26 22:34:24 2017. Available Packages Name : texlive Arch : x86_64 Epoch : 6 Version : 2016 Release : 33.20160520.fc25 Size : 33 k Repo : updates Summary : TeX formatting system URL : http://tug.org/texlive/ License : Artistic 2.0 and GPLv2 and GPLv2+ and LGPLv2+ and LPPL and MIT and Public Domain and UCD and Utopia Description : The TeX Live software distribution offers a complete TeX system for a : variety of Unix, Macintosh, Windows and other platforms. It : encompasses programs for editing, typesetting, previewing and printing : of TeX documents in many different languages, and a large collection : of TeX macros and font libraries. : : The distribution includes extensive general documentation about TeX, : as well as the documentation for the included software packages.
Specifically, I wanted the updated version of tex4ebook package. The version shipped by Fedora didn't cut it. So, I had to install newer version of textlive only for certain tasks. So, I downloaded and installed texlive on a separate user account.
adduser somenewuser su - somenewuser
Go to https://www.tug.org/texlive/acquire-netinstall.html and get the link to the latest tarball.
Unpack the archive.
tar -zxvf install-tl-unx.tar.gz `` Execute the installer. Your directory name may vary depending on the build number. ```sh cd install-tl-20170413/ ./install-tl
In the installation wizard, set the TEXDIR using the D option. I set mine to ~/texlive/2016/.
The installation takes some time. Enjoy the new version of tex4ebook using the path
This way, you can use the Fedora provided version of texlive on your regular user accounts and custom textlive on special user.
The plugins I use for Vim. Recently, I have started using Atom for web development. For rest my editing needs, I use Vim.
Rakesh: Golix, what's lucky for you?
Golix: Lucky, I learned probability.
yum install postgresql-server
host all all 127.0.0.1/32 md5
CREATE USER username login PASSWORD 'password';
CREATE DATABASE databasename WITH OWNER = username;
pg_dump -U username -h 127.0.0.1 dbname -t tablename --schema-only
You must have gone through the webpack tutorial to understand this blog post. If you have done that, using Sass version of Bootstrap is a breeze.
In your project directory install these packages using npm.
npm install bootstrap-loader css-loader node-sass resolve-url-loader sass-loader style-loader url-loader file-loader jquery imports-loader bootstrap-sass --save-dev
Create the file webpack.config.js
index.js: your project entry file.
/* Put whatever you want in your entry JS file */
index.html: Minimalist HTML file to check whether Bootstrap styles are loaded.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Minimalistic webpage</title> <script src="output/bundle.bootstrap-sass.js"></script> </head> <body role="document"> <button type="button" class="btn btn-primary" aria-label="Left Align"><span class="glyphicon glyphicon-align-left" aria-hidden="true"></span>Some text</button> </body> </html>
Generate the build
Open index.html in your browser and you should see the web page with Bootstrap styles loaded.
firewall-cmd --permanent --zone=<zone_name> --add-source=<ip_address>
firewall-cmd --permanent --zone=<zone_name> --remove-source=<ip_address>
firewall-cmd --permanent --zone=<zone_name> --add-service=<service_name>
firewall-cmd --permanent --zone=<zone_name> --add-interface=<interface_name>
firewall-cmd --permanent --zone=<zone_name> --remove-interface=<interface_name>
Copy from a template.
cp /usr/lib/firewalld/services/https.xml /etc/firewalld/services/myservice.xml
and edit the values. If you have an interface alias, this method might suit your needs: