Essay -ansible-3

Something about the cycle:

 

 

 

Whether the reason is because the module?

item applies to copy, but not for yum. Despite the warning, but it does not mean that can not be used. Function is unaffected.

 

In the above example, we use yum, copy, service module (service module is not reflected), completed the Apache installation services, configuration, operation maintenance status of these three steps.

 

When we repeatedly performed a playbook, when the same state to be achieved with the current state playbook ansible discovery system as defined, ansible will automatically skip this step.

For example:

If the target host has started httpd, and you want to start httpd playbook in on the target host, when the ansible found such a case, it will jump.

If a shell script, it does not judge, but directly and then start it again. (Although we can add if the judge)

 

 

 

When the user selects the execution playbook:

(1) playbook users in the field

The user (2) inventory defined

(3) using the current default system user identity to connect to a remote host via SSH, running play content from a remote host

You can also specify on the command line:

ansible-playbook playbook.yml --remote-user=ming

 

--ask-sudo-pass

If we execute commands on the control unit, it will be executed on the remote host. If the sudo to execute commands on a remote host, you need to enter a password, then we

You must add --ask-sudo-pass options to help us enter the password on the control unit, delivered to the remote host.

For example:

On the control plane, I tom is logged, so my identity is tom. I now perform a playbook, but I hope this playbook when executed on the client,

Jerry identity to be executed.

In other words, the client must first sudo jerry, then perform the playbook. So here to add --sudo, - sudo-user = jerry, - ask-sudo-pass

The three options. The first is to open sudo, sudo to who is the second, and the third is the password jerry passed, so in order to execute commands tom jerry identity.

 

ansible-playbook of other options tips:

the PATH = --inventory (-i the PATH) : Specifies the inventory file, the default is / etc / ansible / hosts.

--verbose (-v) : show details output may be used -vvvv output shown in more detail.

= the VARS VARS---extra (-e the VARS) : definition of variables used in the playbook format key = value, key = value.

NUM = --forks (-f NUM) : Specifies the number of concurrent execution of the task, the default is 5. The server performance, a large value can improve transfer efficiency ansible.

the TYPE = - Connection (the TYPE -C) : Specifies the remote host connected, by default SSH, is set to local, showing only performed locally playbook.

--check : detection mode.

 

The new module mixed a Lian Shu:

 

 

 

 

 

 

 

nodejs after application deployment summary:

(1) the process of writing yml as if in a one to execute the command. Along with the idea, write out slowly. First do, then do, and finally do.

(2) a nodejs application can be well managed, can later be quickly erected on other servers, it requires only one command.

 

Began deploying another application: drupal

In this master file, you need to introduce vars.yml file, so the following variables will know where to come and look for the value of the variable.

 

 

 

 

Now, let's look at the template file: The content of drupal.dev.conf.j2.

 

See the file defines a variable, so we have to populate these variables. Write a separate file vars.yml:

 

In this way, regardless of the variables are defined in the main file, or the template file drupal.dev.conf.j2 or elsewhere, to be able to look for the value of the vars.yml.

 

Currently only install apache, and ready profiles, now begin configuring php.

Introduction ansible another module: lineinfile, specifically for editing the file contents.

 

PHP apc.rfc1867 options open, ensuring that APC supports the upload progress.

 

Finally, come back configuration mysql.

 

Delete unwanted library test, while creating a new library. Use of mysql_db module. This is a new library.

 

 

 

 

 

 

 

Drush and then began to use git install drupal.

 

 

Also you need to add a variable in vars.yml in:

drupal_site_name: "D8 Test"

 

drupal installation process summary:

It relates to a module:

template module

file module

lineinfile module

mysql_db module

get_url module

git module

 

Guess you like

Origin www.cnblogs.com/t-road/p/11448350.html