You are reading the article Learn The Examples Of Bootstrap Combobox updated in December 2023 on the website Kientrucdochoi.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested January 2024 Learn The Examples Of Bootstrap Combobox
Introduction to Bootstrap ComboboxThe Combo-box in bootstrap is a combination of the list box, input field, and dropdown box. The dropdown list mostly used for the combo box with the search button. The list box with the search field is used in the combo box. Sometimes users can choose multiple items using the list box. The input field is editable in the combo box of bootstrap. You can add the value according to the requirement. The user can choose the value from the list otherwise enter the value as per demand and requirement. The developer needed bootstrap and JavaScript together to make a combo box in bootstrap. In this topic, we are going to learn about Bootstrap Combobox.
Start Your Free Software Development Course
Web development, programming languages, Software testing & others
SyntaxTo understand how to work in combo box, we need syntax of list/ dropdown in bootstrap. How to work search and list/ dropdown together, we need basic JavaScript syntax.
The following syntax is a list box with a search in bootstrap syntax.
The bootstrap syntax for the list.
JavaScript syntax for search.
$(document) .ready(function(){ $("#listbox") .on("keyup", function() { var values = $(this) .val() .toLowerCase(); $("#listItem li") .filter(function() { }); }); });The toLowerCase() used to convert the characters uppercase to lowercase for display and search.
Examples of Bootstrap ComboboxHere are the following examples mentioned below
Example #1You can see the combination of the list box with the input box together.
The form-control class used for the input search box in bootstrap.
The list-group and list-group-item used for the list box.
The filter() function used for search the item given list using JavaScript.
Code:
$(document) .ready(function(){ $(“#listbox”) .on(“keyup”, function() { var values = $(this) .val() .toLowerCase(); $(“#listItem li”) .filter(function() { }); }); });
Output
Before search
After search
Description:
The example, IN search in the search box and INDIA and CHINA display.
Example #2The combination of the dropdown with an input field for searching.
The dropdown class is used to button and input attributes used for search.
Code:
$(document) .ready(function(){ $(“#listbox”) .on(“keyup”, function() { var values = $(this) .val() .toLowerCase(); $(“#listItem li”) .filter(function() { }); }); });
Output
Before Searching
After searching
Example #3In the dropdown box, the user can directly connect with the search tag and display the required value. If the user can Type required character in the search box then dropdown automatically displays the values.
$(document) .ready(function(){ $(“#listbox”) .on(“keyup”, function() { var values = $(this) .val() .toLowerCase(); $(“#listItem li”) .filter(function() { }); }); });
Output
Example #4The combo box can add the item in list and dropdown box as per requirement. See the below example.
Code:
<script src= $(function() { var add1 = $(‘#adding’); var listCon = $(‘#listItem’); event .preventDefault(); input1 = $(‘#listbox’).val(); $(‘#listbox’) .val(”); }); });
Output
Before adding the item in the list.
After adding the item in the list.
ConclusionThe combo box in bootstrap is a combination of many tags and attributes in one form. Along with Bootstrap, JavaScript or JQuery is required for the combo box. Users can search and add the items in the list box or dropdown list. The input field is required for add and search items for the list.
Recommended ArticlesThis is a guide to Bootstrap Combobox. Here we discuss the Examples of Bootstrap Combobox which explains that Users can search and add the items in the list box or dropdown list. You may also have a look at the following articles to learn more –
You're reading Learn The Examples Of Bootstrap Combobox
Learn The Different Examples Of Sqlite Function
Introduction to SQLite functions
SQLite provides different kinds of functions to the user. Basically, SQLite has different types of inbuilt functions, and that function we easily use and handle whenever we require. All SQLite functions work on the string and numeric type data. All functions of SQLite are case sensitive that means we can either use functions in uppercase or lowercase. By using the SQLite function, we sort data as per the user requirements. SQLite functions have a different category, such as aggregate functions, data functions, string functions, and windows functions, and that function we can use as per the requirement.
Start Your Free Data Science Course
Hadoop, Data Science, Statistics & others
SQLite functionsNow let’s see the different functions in SQLite as follows.
1. Aggregate Functions
AVG: It is used to calculate the average value of a non-null column in a group.
COUNT: It is used to return how many rows from the table.
MAX: It is used to return the maximum value from a specified
MIN: It is used to return the minimum value from a specified
SUM: is used to calculate the sum of non-null columns from the specified table.
GROUP_CONCAT: It is used to concatenate the null value from the column.
2. String Functions
SUBSTR: It is used to extract and return the substring from the specified column with predefined length and also its specified position.
TRIM: It is used to return the copy of the string, and it removes the start the end character.
LTRIM: It is used to return the copy of the string that removed the starting character of the string.
RTRIM: It is used to return the copy of the string that removed the ending character of the string.
LENGTH: It is used to return how many characters in the string.
REPLACE: It is used to display the copy of the string with each and every instance of the substring that is replaced by the other specified string.
UPPER: It is used to return the string with uppercase that means it is used to convert the all character into the upper cases.
LOWER: It is used to return the string with a lowercase, which means converting all character into lower cases.
INSTR: It is used to return the integer number that indicates the very first occurrence of the substring.
3. Control Flow Functions
COALESCE: It is used to display the first non-null argument.
IFNULL: It is used to implement if-else statements with the null values.
IIF: By using this, we can add if – else into the queries.
NULLIF: It is used to return the null if first and second the element is equal.
4. Data and Time Function
DATE: It is used to determine the date based on the multiple data modifiers.
TIME: It is used to determine the time based on the multiple data modifiers.
DATETIME: It is used to determine the date and time based on the multiple data modifiers.
STRFTIME: That returns the date with the specified format.
5. Math Functions
ABS: It is used to return the absolute value of the number.
RANDOM: It is used to return the random floating value between the minimum and maximum integer.
ROUND: It is used to specify the precision.
ExamplesNow let’s see the different examples of SQLite functions as follows.
create table comp_worker(worker_id integer primary key, worker_name text not null, worker_age text, worker_address text, worker_salary text);Explanation
In the above example, we use the create table statement to create a new table name as comp_worker with different attributes such as worder_id, worker_name, worker_age, worker_address, and worker_salary with different data types as shown in the above example.
Now insert some record for function implementation by using the following insert into the statement as follows.
insert into comp_worker(worker_id, worker_name, worker_age, worker_address, worker_salary) values(1, "Jenny", "23", "Mumbai", "21000.0"), (2, "Sameer", "31", "Pune", "25000.0"), (3, "John", "19", "Mumbai", "30000.0"), (4, "Pooja", "26", "Ranchi", "50000.0"), (5, "Mark", "29", "Delhi", "45000.0");Explanation
In the above statement, we use to insert it into the statement. The end output of the above statement we illustrate by using the following screenshot as follows.
Now we can perform the SQLite different functions as follows.
a. COUNT FunctionSuppose users need to know how many rows are present in the table at that time; we can use the following statement.
select count(*) from comp_worker;Explanation
In the above example, we use the count function. The end output of the above statement we illustrate by using the following screenshot.
b. MAX FunctionSuppose we need to know the highest salary of the worker so that we can use the following statement as follows.
select max(worker_salary) from comp_worker;Explanation
In the above example, we use the max function to know the max salary of a worker from the comp_worker table. The end output of the above statement we illustrate by using the following screenshot.
c. MIN Function select min(worker_salary) from comp_worker;Explanation
The end output of the above statement we illustrate by using the following screenshot.
d. AVG FunctionSuppose users need to know the total average salary of a worker from comp_worker at that time; we can use the following statement as follows.
select avg(worker_salary) from comp_worker;Explanation
The end output of the above statement we illustrate by using the following screenshot.
e. SUM FunctionSuppose users need to know the total sum salary of a worker from comp_worker at that time; we can use the following statement as follows.
select sum(worker_salary) from comp_worker;Explanation
The end output of the above statement we illustrate by using the following screenshot.
f. Random Function select random() AS Random;The end output of the above statement we illustrate by using the following screenshot.
g. Upper FunctionSuppose we need to return the worker_name column in the upper case at that time, we can use the following statement as follows.
select upper(worker_name) from comp_worker;Explanation
The end output of the above statement we illustrate by using the following screenshot.
h. Length Function select worker_name, length(worker_name) from comp_worker;Explanation
The end output of the above statement we illustrate by using the following screenshot.
ConclusionWe hope from this article you have understood about the SQLite Function. From the above article, we have learned the basic syntax of Function statements, and we also see different examples of Function. From this article, we learned how and when we use SQLite Functions.
Recommended ArticlesWe hope that this EDUCBA information on “SQLite functions” was beneficial to you. You can view EDUCBA’s recommended articles for more information.
Learn The Different Examples Of Bind Function
Introduction to DB2 bind
Database management systems provide a different kind of function to the user; the DB2 bind function is one of the functions provided by the database management system. In which that bind function () is used to establish the relationship between the application program and relational data. When we execute the bind function, that means during the execution of the binding process or function, it performs different kind of actions such as it validate all referenced objects in the SQL statement of the specified program that means the user-created table, created view column name per the DB2 catalog that is given.
Start Your Free Data Science Course
Hadoop, Data Science, Statistics & others
Syntax
Explanation
In the above syntax, we select statements with different parameters as follows.
colm 1, 2, and N: It is a column name that is created inside the table.
specified schema name: It is a user-defined schema.
specified table name: Specified table name means an actual table that the user creates.
where: It is used for the condition, and it contains an input bind function.
How does the bind function work in DB2?Now let’s see how the bind function works in DB2 as follows.
Utilizing the input bind function, we can improve execution. A query can be arranged once and executed at various times, changing the bind variable values between every execution of the SQL statement at the server-side.
Utilizing the bind function, we can improve the reserve hit rate for data sets as well as which is used to store prepared queries. Information bases that support to bind function variables parse the query at that point plug input bind function into the generally parsed code. On the off chance that a similar query is run a lot of times, even with various qualities for the info tie factors, the database will have the code stored and will not need to parse the inquiry once more. In the event that you don’t utilize input bind faction, the information base will parse the query each time on the grounds that the where the condition will be marginally extraordinary each time and the code for every one of those somewhat various queries will stop up the reserve.
As a dependable guideline, you should utilize input bind variables rather than replacements in the WHERE clause of SELECT explanations at whatever point you can.
Output bind variable permit esteems to be passed straightforwardly from procedural code into cushions in your program, that means user-defined program. For the most part, this is more helpful and proficient than constructing a query that calls procedural code or building procedural code that fabricates an outcome set.
SQL Relay will counterfeit information and bind variables for data set API’s which don’t locally uphold ties. Presently that is only the MDB Tools association. Postgresql 8, MySQL 4.1.2, and current SQLite support bind variables, yet more seasoned variants don’t. SQL Relay fakes input binding for Postgresql, MySQL, and SQLite renditions that don’t uphold them. For variants that do, the “fackebinds” interface string boundary can be utilized to compel SQL Relay to counterfeit ties instead of utilizing the data set’s implicit help. You can utilize either Oracle style or DB2/Firebird style tie factors with those data sets. Yield ties are not upheld when utilizing “fakebinds”.
When utilizing a data set for which SQL Relay fakes bind variable, you should make a point not to pass some unacceptable sort of information into a bind variable.
The SQL explanation in the past area is an illustration of a named tie. Every placeholder in the articulation has a name related to it, for example, ’emp_name’ or ’emp_sal’. At the point when this assertion is readied, and the placeholders are related with values in the application, the name makes the affiliation of the placeholder utilizing the OCIBindByName() call with the name of the placeholder passed in the placeholder boundary.
The second sort of bind is known as a positional bind. In a positional tough situation, the placeholders are alluded to by their situation in the articulation instead of their names. For restricting purposes, an affiliation is made between information esteem and the situation of the placeholder.
Insert into employee values(:emp_no, :emp_name, :emp_job, :emp_sal)
ExamplesNow let’s see the different examples of the bind function to better understand as follows.
First, create a new table by using the following create table statement as follows.
create a new table by using the create table statement as follows.
comp_address text);
Explanation
In the above example, we use a create table statement to create a new table name as a company with different attributes such as Comp_id, comp_name, and comp_address with different data types and different sizes as shown in the above statement.
For confirmation, insert some records by using the following insert into the statement as follows.
select * from company;
In the above example, we use to insert into statement. The end out we illustrate by using the following screenshot as follows.
Select count(*) from company where comp_name = :Dell and comp_address = :Pune;
Explanation
In the above example, we use a select statement with a count function as shown in the above statement; here, we use a bind variable such as comp_name and comp_address in the above statement. The end out we illustrate by using the following screenshot as follows.
Now execute the following statement as follows.
AND comp_address = ‘Pune’;
After checking the performance of the above statement, you will get a difference between them.
ConclusionWe hope from this article you have understood about the DB 2 bind functions. From the above article, we have learned the basic syntax of the bind function, and we also see different examples of bind function. We also learn the rule for the bind function. From this article, we learned how and when we use the DB 2 bind function.
Recommended ArticlesThis is a guide to DB2 bind. Here we discuss the basic syntax of the bind function, and we also see different examples of bind function. You may also have a look at the following articles to learn more –
Learn The Different Examples Of Matlab Exponent
Introduction to MATLAB exponent
MATLAB offers us different types of exponent functions that can compute the exponential of an array or matrix. These functions can be used to compute basic exponential, matrix exponential, or exponential integral as per our requirement. In this article, we will learn about 3 exponent functions offered by MATLAB: exp, expint, and expm. With the help of these functions, we can compute the solution when our input is an array, matrix, or a complex number and ‘e’ is raised to this power.
Start Your Free Data Science Course
Hadoop, Data Science, Statistics & others
Syntax of exponent function:
E = exp (I)
E = expint (I)
E = expm (I)
Description of the syntax:
E = exp (I) is used to return the exponential ‘e’ raised to the power (I). For an array, it will compute the exponential of every element
E = expint (I) is used to return the exponential integral of every element in the input ‘I’
E = expm (I) is used to compute the matrix exponential for our input matrix ‘I’. Please note that matrix exponential is given by the formula:
Examples of Matlab exponentLet us now understand the code for these exponent functions in MATLAB
Example #1 (exp (I))In this example, we will find the exponent of an array in MATLAB by using the exp (I) function. Below are the steps to be followed:
Initialize the array whose exponent we need to compute
Pass the input array as an argument to the exp function
Code:
I = [2 4 6 2 6] [Initializing the array whose exponent we need to compute] [Passing the input array as an argument to the exp function]
This is how our input and output will look like in MATLAB:
Input:
Output:
As we can see in the output, the exp function has computed the exponential of every element in our input array ‘I’.
Next, we will learn the use of the expint function
Example #2 (expint (I))
In this example, we will find the integral exponent of an array in MATLAB by using the expint (I) function. Below are the steps to be followed:
Initialize the array whose integral exponent we need to compute
Pass the input array as an argument to the expint function
Code:
I = [2 3 5 1 6] [Initializing the array whose integral exponent we need to compute] [Passing the input array as an argument to the expm function]
This is how our input and output will look like in MATLAB:
Input:
Output:
As we can see in the output, the expint function has computed the integral exponential of every element in our input array ‘I’.
Next, we will learn the use of the expm function
Example #3 (expm (I))In this example, we will find the matrix exponent of a matrix in MATLAB by using the expm (I) function. Below are the steps to be followed:
Initialize the matrix whose matrix exponent we need to compute
Pass the input matrix as an argument to the expm function
Code:
I = [2 3 5; 1 0 3; 2 5 7] [Passing the input matrix as an argument to the expm function]
This is how our input and output will look like in MATLAB:
Input:
Output:
As we can see in the output, the expm function has computed the matrix exponential of our input matrix ‘I’.
The exponent functions discussed above can also be used to compute the exponential of complex numbers. Let us understand this with an example.
Example #4 (exp (I))In this example, we will find the exponent of an array of complex numbers in MATLAB by using the exp (I) function. Below are the steps to be followed:
Initialize the array of complex numbers whose exponent we need to compute
Pass the input array as an argument to the exp function
Code:
I = [2 + 3i 5 - 1i 4 + 5i] [Initializing the array of complex numbers whose exponent we need to compute] [Passing the input array as an argument to the exp function]
This is how our input and output will look like in MATLAB:
Input:
Output:
As we can see in the output, the exp function has computed the exponential of every complex element in our input array ‘I’.
Conclusion
Different forms of Exponent function can be used to compute the exponentials as per our requirement.
Basic exponential, integral exponential, matrix exponential are the types of exponentials we can compute using the exponent functions.
The exponential of complex numbers can also be calculated using the exponent functions.
Recommended ArticlesThis is a guide to Matlab exponent. Here we discuss the 3 exponent functions offered by MATLAB: exp, expint and expm, along with the examples. You may also have a look at the following articles to learn more –
Learn The Different Examples Of Numpy Random
Introduction to NumPy random
A Random number is a number that is generated without following any logic or pattern so that it cannot be used again for any process; such kind of random number generation is very useful in the security or encryption of crucial information, and so serve this purpose python has a library that performs a variety of numerical operation very easily called Numpy (Numerical Python) which can be used in the generation of Pseudo-Random numbers using BitGenerator that gives different combinations of sequences and the Generator then transforms the sequences into numbers following probability distribution.
Start Your Free Software Development Course
Web development, programming languages, Software testing & others
SyntaxNumpy can generate a Random sequence for various data types like float, int, array, etc. Random number generation is performed by importing the Random package from the Numpy library. The basic syntax for numpy random generation is
from numpy import random randint(int) Examples of NumPy randomLet us discuss a different example of using different random generation techniques for better understanding.
Example #1Code:
from numpy import random a = random.randint(10) b= random.randint(50) print(a) print(b)In this example, we have imported the random package from the numpy library to operate. We have generated random integer a & b using the numpy random.randint() syntax and the value we gave in the bracket is the maximum limit for generating a random number. The output 4 is below the 10 we declared, and 44 is below the 50 we have declared.
Example #2We Numpy random to generate a list of float values in this example,
Code:
from numpy import random a = random.rand() b= random.rand(5) print(a) print(b)Output:
In this example, we have used the random.rand() syntax, which allows us to generate float values. We haven’t declared any number in the variable’ a’, so it generates a random float from 0 to 1 by default. In variable ‘b,’ we have declared a limit of 5, so we have a list of 5 random float values. We can declare any number to generate float values of that limit we have declared.
Example #3In this example, we’ll discuss the random generation of numpy arrays using a similar syntax we used in the previous examples.
Code:
from numpy import random a = random.randint(10, size=(3)) b= random.randint(50, size=(7)) print(a) print(b)Output:
We have used the randint syntax and declared the maximum limit and the sequence size we are generating in this example. This method is a random generation of 1-dimensional arrays. For ‘a’, we declared the maximum limit to be 10 and the sequence length to be 3; for ‘b,’ we declared the maximum limit to be 50 and the sequence length to be 7, and we got the corresponding output.
Similarly, we’ll try to generate 2-dimensional arrays in the following code.
Code:
from numpy import random a = random.randint(10, size=(3,3)) b= random.randint(50, size=(5,5)) print(a) print(b)Output:
Using a similar code, we have generated the 2-dimensional random arrays by declaring the size of the generation in two dimensions. For example, in variable ‘a’, we have declared the maximum limit to be 10 and the length of the sequence to be 3, 3, which is a two-dimensional array, and for ‘b,’ we have declared the maximum limit to be 50 and the length of the sequence to be 5, 5, and we got the corresponding 2-dimensional array as output.
We can also generate 3-dimensional arrays using the same technique as shown below.
Code:
from numpy import random a = random.randint(10, size=(3,2,1)) print(a)Code:
from numpy import random b= random.randint(50, size=(5,2,1)) print(b)Output:
In the above example, we have generated 3-dimensional random arrays for variables ‘a’ and ‘b’ where the size we have ‘a’ we have declared the maximum limit to be 10 and the length of the sequence to be (3, 2, 1), which is a two-dimensional array and for ‘b’ we have declared the maximum limit to be 50 and length of the sequence to be (5,2, 1) and we got the corresponding 3-dimensional array as output.
Example #4In the previous example, we have discussed the generation of multiple dimensional arrays using integer values; here, we will discuss the generation of float values.
Code:
from numpy import random a = random.rand(3,2) b = random.rand(5,2) print(a) print(b)Output:
When we are using chúng tôi syntax, it generates float values as default from 0 to 1, so when we declared the size of the random generation in two dimensions as we did in the above code where ‘a’ and ‘b’ is given a two-dimensional size of (3,2) & (5,2) we get the two-dimensional float array.
Similarly, for 3-dimensional float array,
Code:
from numpy import random a = random.rand(3,2,2) b = random.rand(5,2,2) print(a) print(b)Output:
So in this code, we have declared the three-dimension size for a & b as (3,2,2) & (5,2,2), so we got the output in a three-dimensional array.
Example #5Another method in Numpy random generation uses a function as a choice(), which allows the computer to make a random choice from the given sequence of values.
Code:
from numpy import random a = random.choice([8, 10, 16]) b= random.choice([80, 100, 160,1100]) print(a) print(b)Output:
In this method, we use a function called choice(), which allows the computer to randomly select a value from the array of values the user declares.
The choice() function gets an array as input and gives a randomly selected value as output. Thus, we can give an array of any length and generate a random value from it.
Similarly, we can generate multi-dimensional arrays using the choice() function by giving the size of the dimension.
Code:
from numpy import random a = random.choice([8, 10, 16],size=(3, 2)) b= random.choice([80, 100, 160,1100],size=(5, 2)) print(a) print(b)Output:
So using the choice() function, we can declare the size and generate 2-dimensional and 3-dimensional arrays from the array we have declared.
ConclusionIn this article, we have discussed Numpy random using various examples. We have also discussed generating random values using integers, floats, and arrays. We also discussed different techniques for generating multi-dimensional arrays numpy random can be very helpful for working on various projects involving random sequence generation.
Recommended ArticlesWe hope that this EDUCBA information on “NumPy random” was beneficial to you. You can view EDUCBA’s recommended articles for more information.
Learn How Untar Works In Ansible With Examples
Introduction to Ansible untar
Ansible untar module also known as unarchive for Unix OS or win_zip for the windows operating system is used to extract or unpack the archive files or folders on the remote destination by copying the archive file first by default on the remote server and also supports many parameters to deal with the unarchive or win_zip functionality like the owner, dest, exclude and more.
Start Your Free Software Development Course
Web development, programming languages, Software testing & others
SyntaxFor the non-windows target unarchive or ansible.builtin.unarchive command uses the below syntax. We have shown the basics parameters
Parameters:
copy: No / Yes (Default)
The default Option is Yes and it copies the files from the local controller to the remote host if specified yes or nothing specified. For working with the remote source need to specify the remote_src and this copy parameter is not helpful there.
src (required):
Source path of the file. If remote_src is ‘yes’ then the source path would be on the remote location otherwise the source path is on the local controller node.
dest (required):
Remote server absolute path where the archive is going to extract.
remote_src: no (Default) / yes
If set ‘yes’ specifies that the source archive path is on the remote computer. For the ‘no’ value the path is on the local controller node.
owner:
name of the user that should own the files/directory after unpack and same replicates (added) to the chown.
group:
Name of the group that should own the files/directory and same replicates (added) to the chown.
exclude:
List of files or directories that need to be excluded from the unpacking.
include:
List of files or directories that need to be included in the unpacking process.
keep_newer: no (default) / yes
If set yes, it replaces the existing files that are newer than the files inside the archive.
mode:
Permissions that the files or directories should have after unpacked (like 644, 777, etc).
For the windows target src, dest, creates parameters remain the same as unarchive module and the additional parameters are as below.
Parameters:
delete_archive: no (default) / yes
Removes the zip file after unzipping.
password
If the Zip file is password encrypted then this parameter is useful and it requires the PSCX module to be installed.
recurse: no (default) / yes
recursively expands the zip file within the src directory.
Setting value ‘yes’ requires the PSCX module to be installed.
Please note: the win_unzip module doesn’t use the remote_src parameter.
How untar works in Ansible?Ansible unarchive module for non-windows target comes with the ansible-base and so it is included in the Ansible installations. For the windows target, we need to use the win_unzip module. If the module is not available then you can download it from the galaxy.
ansible-galaxy collection install community.windows
Below is the simple playbook for windows untar (unzip).
dest: c:temp7zipInstaller
Output:
The above playbook will unzip the file from the source location to the destination remote servers. If the destination path doesn’t exist it creates the destination path.
You must have noticed here, although the source path is remote, we don’t need to use remote_src because the win_unzip module doesn’t support it and when we use the remote source path for the non-target windows server we must specify the remote_src. For example,
remote_src: yes
ExamplesHere are the following examples mention below
Example #1 – unarchive module task for UNIX os.dest: /tmp/phyes
In this playbook, it will retrieve the chúng tôi file to the destination remote host /tmp/phyes. Before running this task unlike the win_unzip module, you need to make sure that the destination path exists otherwise it will throw an error.
Output:
Example #2 – Exclude files from the archive.To exclude the certain file from the unpacking we can use h
Code:
exclude: ’Test1 document.txt’
If there are multiple files to exclude then you can provide the list as below.
- ’sourcefile.py’
Example #3 – Include files from the archiveCode:
include: ’Test1 document.txt’
The above playbook will include only the test1 text file and to include the multiple documents, use the below command.
- ’sourcefile.py’
Example #4 – using multiple parameters together.Code:
owner: ansibleadmin
In the above playbook, it will include only 2 files, keep_newer parameter will not replace the existing files that are newer than files from the archive, remote_src indicates the remote source and it will set the owner permission on the files and it will keep the file permission 0644.
ConclusionUntar or unarchive or unzip modules are very useful when we write the playbook. It makes it easier to extract the files or folders on the destination server without using any third-party software and in addition, it uses various parameters like we don’t need to copy the file before extracting, adding permissions after extract, etc.
Recommended ArticlesThis is a guide to Ansible untar. Here we discuss How untar works in Ansible and Examples along with the codes and outputs. You may also look at the following articles to learn more –
Update the detailed information about Learn The Examples Of Bootstrap Combobox on the Kientrucdochoi.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!