DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

The Latest Frameworks Topics

article thumbnail
Can You Beat the AI? How to Quickly Deploy TinyML on MCUs Using TensorFlow Lite Micro
Do you want to know how to use it on the microcontrollers you already work with? In this article, we provide an introduction to ML on microcontrollers.
October 19, 2022
by Nikolas Rieder
· 7,831 Views · 2 Likes
article thumbnail
Infrastructure as Code (IaC) for Java-Based Apps on Azure
A closer look at Java at Microsoft and Azure and what Microsoft can offer to modernize existing Java-based apps or bring new ones with the practice of IaC
Updated October 19, 2022
by Bobur Umurzokov
· 7,387 Views · 2 Likes
article thumbnail
How To Create Asynchronous and Retryable Methods With Failover Support
Learn about a new framework that allows processing methods asynchronously with retries in case of failure and the support of load-balancing and failover.
October 18, 2022
by Mohammed ZAHID
· 13,829 Views · 1 Like
article thumbnail
Angular 11 + Firebase Cloud Messaging Push Notifications
A push notification is a popup message similar to an SMS. Push notifications work the same as SMS text messages and mobile alerts.
October 18, 2022
by Kamal Singh
· 4,249 Views · 1 Like
article thumbnail
HTTP-Based OOP, Inheritance, and Polymorphism
Is anything magical about polymorphism that requires OOP? Good old HTTP can just as easily apply polymorphism and inheritance - possibly even BETTER - than OOP.
October 18, 2022
by Thomas Hansen DZone Core CORE
· 4,838 Views · 3 Likes
article thumbnail
How to Use QueryParamsHandling in Angular
QueryParamsHandling is a routing strategy that allows developers to control how query parameters are handled when the URL changes.
October 15, 2022
by Akash Chauhan
· 15,509 Views · 2 Likes
article thumbnail
Configure Cucumber Setup in Eclipse and IntelliJ [Tutorial]
Here's how to start using Cucumber, the widely used BDD framework for Selenium automation testing. This article helps you get set up in Eclipse and IntelliJ IDEA. It also provides a step-by-step guide on setting up Maven Cucumber project in Eclipse.
October 7, 2022
by Harshit Paul
· 9,490 Views · 1 Like
article thumbnail
Develop a Full-Stack Java Application With Kafka and Spring Boot
This tutorial shows how to publish and subscribe to Kafka messages in a Spring Boot application and how to display the messages live in the browser.
Updated October 6, 2022
by Marcus Hellberg
· 7,570 Views · 4 Likes
article thumbnail
Easily Update and Reload SSL for a Server and an HTTP Client
In this tutorial, learn how to update and reload your SSL configuration whenever needed without restarting your server or recreating your HTTP client.
October 4, 2022
by Hakan Altındağ
· 11,145 Views · 4 Likes
article thumbnail
Using Rails Service Objects
In this article, we'll find out what Rails Service Objects are and how you can use them to make your app cleaner and maintain it.
September 29, 2022
by Aleksandr Ulanov
· 5,387 Views · 4 Likes
article thumbnail
Pagination With Spring Data Elasticsearch 4.4
Explanation of the pagination options within Spring Data Elasticsearch 4.4 using Elasticsearch 7 as a NoSQL database.
September 27, 2022
by Arnošt Havelka DZone Core CORE
· 13,519 Views · 1 Like
article thumbnail
An Introduction to Ansible Inventory
In this post, you will learn how to set up a basic Ansible Inventory. Besides that, you will learn how to encrypt sensitive information by means of Ansible Vault. Enjoy! 1. Introduction In a previous post, you learned how to set up an Ansible test environment. In this post, you will start using the test environment. Just as a reminder, the environment consists of one Controller and two Target machines. The Controller and Target machines run in a VirtualBox VM. Development of the Ansible scripts is done with IntelliJ on the host machine. The files are synchronized from the host machine to the Controller by means of a script. In this blog, you will create an inventory file. The inventory file contains information about the Target machines in order for the Controller to locate and access the machines for executing tasks. The inventory file will also contain sensitive information such as the password being used for accessing the Target machines. In a second part of this blog you will solve this security problem by means of Ansible Vault. The files being used in this blog are available in the corresponding git repository at GitHub. 2. Prerequisites The following prerequisites apply to this blog: You need an Ansible test environment, see a previous blog how to set up a test environment; If you use your own environment, you should know that Ubuntu 22.04 LTS is used for the Controller and Target machines and Ansible version 2.13.3; Basic Linux knowledge. 3. Create an Inventory File The Ansible Controller will need to know some information about the Targets in order to be able to execute tasks. This information can be easily provided by means of an inventory file. Within an inventory, you will specify the name of the Target, its IP address, how to connect to the Target, etc. Take a look at the Ansible documentation for all the details. In this section, you will experiment with some of the inventory features. By default, Ansible will search for the inventory in /etc/ansible/hosts but you can also provide a custom location for the inventory when executing Ansible. That is what you will do in this section. Create in the root of the repository a directory inventory and create an inventory.ini file. Add the following content to the file: Plain Text target1 target2 [targets] target1 target2 [target1_group] target1 [target2_group] target2 [target_groups:children] target1_group target2_group The first two lines contain the names for the Target machines. You can give this any name you would like, but in this case, you just call them target1 and target2. When you want to address several machines at once, you can create groups. A group is defined between square brackets followed by the list of machines belonging to this group. In the inventory above, you can recognize group targets which contains target1 and target2. This group is not really necessary, because by default a group all exists which is equal to the group targets in this case. The groups target1_group and target2_group are for illustrative purposes and do not make much sense because they contain only one machine. However, in real life, you can imagine to have groups for application machines, database machines, etc. or you might want to group machines by region for example. You can also define a group of groups like target_groups. You need to add :children to the definition and then you can combine several groups into a new group. The group target_groups consists of the group target1_group and target2_group. This actually means that group target_groups consists of machines target1 and target2. 4. Define Variables The inventory file you created just contains names of machines and groups. But this information is not enough for Ansible to be able to locate and connect to the machines. One approach is to add variables in the inventory file containing this information. A better approach is to define a directory host_vars containing subdirectories for each machine containing the variables. Ansible will scan these directories in order to find the variables for each machine. You can also define variables for the groups. In this case, you create a directory group_vars. Create in directory inventory a directory host_vars containing the directories target1 and target2. The directory tree of directory inventory looks as follows: Plain Text ├── host_vars │ ├── target1 │ └── target2 └── inventory.ini Create in directory target1 a file vars with the following contents: YAML ansible_host: 192.168.2.12 ansible_connection: ssh ansible_user: osboxes ansible_ssh_pass: osboxes.org The variables defined here are some special variables for Ansible to be able to locate and connect to the machine: ansible_host: the IP address of the target1 machine; ansible_connection: the way you want to connect to target1; ansible_user: the system user Ansible can use to execute tasks onto the machine; ansible_ssh_pass: the password of the ansible_user. Do not store passwords in plain text in real life! This is only done for testing purposes and a proper solution is provided later on this post. Note that you can also define these variables in the inventory file on the same line as where you define the name of the machine. In this case, the variables need to be defined as key=value (with an equal sign and not with a colon). Add a vars file to directory target2 with similar contents but with the connection values for target2. 5. Test Inventory Settings Now it is time to do some testing in order to verify whether it works. Start the Controller and the two Target machines. Synchronize the files you created to the Controller machine and navigate in a terminal window to the MyAnsiblePlanet directory. Connect once manually to both Target machines so that the SSH fingerprint is available onto the Controller machine, otherwise you will get an error message when Ansible tries to connect to the Target machines. Shell $ ssh [email protected] $ ssh [email protected] With the following command, you will ping the target1 machine. The command consists of the following items: ansible: The Ansible executable; target1: The name of the machine where you want to execute the task. This corresponds to the name in the inventory; -m ping: Execute the ping command; -i inventory/inventory.ini: The path of the inventory file. The command to execute: Shell $ ansible target1 -m ping -i inventory/inventory.ini target1 | SUCCESS => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python3" }, "changed": false, "ping": "pong" } The response indicates a success. Execute the same command but for the target2 machine. The result should also be a success response. Just like you can execute a task on a single machine, you can also execute a task on a group. Execute the command for the targets group: Shell $ ansible targets -m ping -i inventory/inventory.ini target2 | SUCCESS => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python3" }, "changed": false, "ping": "pong" } target1 | SUCCESS => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python3" }, "changed": false, "ping": "pong" } As you can see, the command is executed on both Target machines, as expected. Execute the command for the other groups as well. 6. Encrypt Password Now that you know that the inventory configuration is working as expected, it is time to get back to the password in plain text problem. This can be solved by using Ansible Vault. Ansible Vault probably deserves its own blog, but in this section you just going to apply one way of encrypting sensitive information. The encryption will be done for the target1 machine. Create in directory inventory/target1 a file vault and copy the ansible_ssh_pass variable to this vault file. Change the variable name from ansible_ssh_pass into vault_ansible_ssh_pass. YAML vault_ansible_ssh_pass: osboxes.org In the vars file, you replace the plain text password with a reference to this new vault_ansible_ssh_pass variable using Jinja2 syntax. Note that it is also required to add double quotes around the reference. YAML ansible_host: 192.168.2.12 ansible_connection: ssh ansible_user: osboxes ansible_ssh_pass: "{{ vault_ansible_ssh_pass }" Encrypt the vault file with password itisniceweather (or whatever password you would like). Shell $ ansible-vault encrypt inventory/host_vars/target1/vault New Vault password: Confirm New Vault password: Encryption successful The vault file contents is now encrypted. Plain Text $ANSIBLE_VAULT;1.1;AES256 34353662643861663663363161366239343633636561663564653030663134623266323363353433 6233383939396335343639623165306330393031383836320a616430336132643638333862363965 36303837313239386566633332326165663336363464623437383638333936613038663366343833 3737316665323230620a343163356138656535363837646566643962393366353266613462616437 32346531613637396666623864333330643261366139306162373038633636633934326165616438 6565363034333137623539643539666234386339393965663362 The password you have used for encrypting the file should be saved in a password manager. Ansible will need it to decrypt the password. Try to execute the ping command for target1 like you did before. Shell $ ansible target1 -m ping -i inventory/inventory.ini ERROR! Attempting to decrypt but no vault secrets found This fails because Ansible cannot decrypt the password field. Add the parameter --ask-vault-pass to the command in order that Ansible asks you for the vault password. Shell $ ansible target1 -m ping -i inventory/inventory.ini --ask-vault-pass Vault password: target1 | SUCCESS => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python3" }, "changed": false, "ping": "pong" } And now it works again! This is a better way for handling sensitive information in your Ansible files. There are several more ways of handling sensitive information. As said before, Ansible Vault deserves its own blog. In the meanwhile, more information can be found in the Ansible documentation. 7. Conclusion In this post, you learned the basics of an Ansible Inventory file and you learned how to encrypt sensitive information in the inventory file. You have gained the basic skills to start setting up an inventory file yourself for your environment.
September 27, 2022
by Gunter Rotsaert DZone Core CORE
· 4,106 Views · 1 Like
article thumbnail
Bypassing Spring Interceptors via Decoration
This article documents a simple yet very useful way of bypassing some of the configured HandlerInterceptors depending on the request's mapping.
September 27, 2022
by Horatiu Dan DZone Core CORE
· 5,290 Views · 5 Likes
article thumbnail
Two Cool Java Frameworks You Probably Don’t Need
Mutation testing and property-based testing are two relatively niche technologies in the Java tester's toolkit. Read more in this article.
September 26, 2022
by Jasper Sprengers
· 10,455 Views · 6 Likes
article thumbnail
Jakarta EE 10 Has Landed!
The Jakarta EE Ambassadors are thrilled to see Jakarta EE 10 being released! This is a milestone release that bears great significance to the Java ecosystem.
September 26, 2022
by Reza Rahman
· 5,970 Views · 5 Likes
article thumbnail
Spice Up Your 'CI/CD Process' With Automation Using Cucumber, Selenium, and Kotlin
This article shows how to use Cucumber, Selenium, and Kotlin in your CI/CD process in four easy steps.
September 26, 2022
by Ashok Gudise
· 3,871 Views · 1 Like
article thumbnail
Elasticsearch Fundamentals and Setup Progress
Explore fundamentals of Elasticsearch, a full-text search engine and analysis tool developed using Java programming language on Apache Lucene infrastructure.
September 23, 2022
by Omer Yilmaz
· 6,202 Views · 1 Like
article thumbnail
Using Hazelcast in Spring Boot Running on Kubernetes
A simple Spring Boot application with Data JPA (Hibernate) using embedded Hazelcast for the second-level cache with the support of the Kubernetes cluster.
September 22, 2022
by Ruslan Appazov
· 12,979 Views · 1 Like
article thumbnail
Top Mobile App Development Frameworks
You need to consider multiple factors when choosing frameworks for mobile app development, from the number of built-in features to user interface complexity.
September 21, 2022
by Veronika Nedashkovskaya
· 5,700 Views · 1 Like
article thumbnail
Painless WebSocket Tests With Spock Framework
Testing asynchronous code is never easy. Still, simplicity and maintainability is possible with the right set of tools.
Updated September 21, 2022
by Jakub JRZ
· 5,175 Views · 1 Like
  • Previous
  • ...
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • ...
  • Next
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook
×