Diferències
Ací es mostren les diferències entre la revisió seleccionada i la versió actual de la pàgina.
| Següent revisió | Revisió prèvia | ||
| info:cursos:pue:devops2022:s13 [09/02/2022 09:18] – creat mate | info:cursos:pue:devops2022:s13 [23/03/2022 14:02] (actual) – [windows] mate | ||
|---|---|---|---|
| Línia 1: | Línia 1: | ||
| - | = DevOps Sesión | + | = DevOps Sesión |
| == Documentación relacionada | == Documentación relacionada | ||
| - | == Clase | + | <callout type=" |
| - | == TODO | + | * ./4-Topic 704 Configuration Management |
| - | <callout type=" | + | * ./Material Curso Ansible/ |
| + | </ | ||
| + | == variables | ||
| + | <callout type=" | ||
| + | * ./Material Curso Ansible/ | ||
| + | * ./Material Curso Ansible/Clase Ansible variables basicas .txt | ||
| + | </ | ||
| + | <code yaml> | ||
| + | - name: ensure a list of packages installed | ||
| + | yum: | ||
| + | name: "{{ packages }}" | ||
| + | vars: | ||
| + | packages: | ||
| + | - httpd | ||
| + | - httpd-tools | ||
| + | - php | ||
| + | </ | ||
| + | |||
| + | == plantillas jinja2 | ||
| + | <callout type=" | ||
| + | * ./Material Curso Ansible/ | ||
| + | </ | ||
| + | * **/ | ||
| + | {{ miip }} {{ ansible_hostname }} {{ ansible_fqdn }}</ | ||
| + | * <code yaml ; playbook_sample_variables-ejemplo1.yml> | ||
| + | - name : Crear un fichero con variables | ||
| + | hosts: clientes | ||
| + | remote_user: | ||
| + | vars: | ||
| + | - miip: " | ||
| + | tasks: | ||
| + | - name: Crear fichero hosts | ||
| + | template: src=hosts.j2 dest=/ | ||
| + | ... | ||
| + | </ | ||
| + | <code bash> | ||
| + | <code bash> | ||
| + | === ejemplo | ||
| + | <code jinja2 ; / | ||
| + | < | ||
| + | <html xmlns=" | ||
| + | < | ||
| + | <meta http-equiv=" | ||
| + | < | ||
| + | <style type=" | ||
| + | * { | ||
| + | margin: 0px 0px 0px 0px; | ||
| + | padding: 0px 0px 0px 0px; | ||
| + | } | ||
| + | |||
| + | body, html { | ||
| + | padding: 3px 3px 3px 3px; | ||
| + | |||
| + | background-color: | ||
| + | |||
| + | font-family: | ||
| + | font-size: 11pt; | ||
| + | text-align: center; | ||
| + | } | ||
| + | |||
| + | div.main_page { | ||
| + | position: relative; | ||
| + | display: table; | ||
| + | |||
| + | width: 800px; | ||
| + | |||
| + | margin-bottom: | ||
| + | margin-left: | ||
| + | margin-right: | ||
| + | padding: 0px 0px 0px 0px; | ||
| + | |||
| + | border-width: | ||
| + | border-color: | ||
| + | border-style: | ||
| + | |||
| + | background-color: | ||
| + | |||
| + | text-align: center; | ||
| + | } | ||
| + | |||
| + | div.page_header { | ||
| + | height: 99px; | ||
| + | width: 100%; | ||
| + | |||
| + | background-color: | ||
| + | } | ||
| + | |||
| + | div.page_header span { | ||
| + | margin: 15px 0px 0px 50px; | ||
| + | |||
| + | font-size: 180%; | ||
| + | font-weight: | ||
| + | } | ||
| + | |||
| + | div.page_header img { | ||
| + | margin: 3px 0px 0px 40px; | ||
| + | |||
| + | border: 0px 0px 0px; | ||
| + | } | ||
| + | |||
| + | div.table_of_contents { | ||
| + | clear: left; | ||
| + | |||
| + | min-width: 200px; | ||
| + | |||
| + | margin: 3px 3px 3px 3px; | ||
| + | |||
| + | background-color: | ||
| + | |||
| + | text-align: left; | ||
| + | } | ||
| + | |||
| + | div.table_of_contents_item { | ||
| + | clear: left; | ||
| + | |||
| + | width: 100%; | ||
| + | |||
| + | margin: 4px 0px 0px 0px; | ||
| + | |||
| + | background-color: | ||
| + | |||
| + | color: #000000; | ||
| + | text-align: left; | ||
| + | } | ||
| + | |||
| + | div.table_of_contents_item a { | ||
| + | margin: 6px 0px 0px 6px; | ||
| + | } | ||
| + | |||
| + | div.content_section { | ||
| + | margin: 3px 3px 3px 3px; | ||
| + | |||
| + | background-color: | ||
| + | |||
| + | text-align: left; | ||
| + | } | ||
| + | |||
| + | div.content_section_text { | ||
| + | padding: 4px 8px 4px 8px; | ||
| + | |||
| + | color: #000000; | ||
| + | font-size: 100%; | ||
| + | } | ||
| + | |||
| + | div.content_section_text pre { | ||
| + | margin: 8px 0px 8px 0px; | ||
| + | padding: 8px 8px 8px 8px; | ||
| + | |||
| + | border-width: | ||
| + | border-style: | ||
| + | border-color: | ||
| + | |||
| + | background-color: | ||
| + | |||
| + | font-style: italic; | ||
| + | } | ||
| + | |||
| + | div.content_section_text p { | ||
| + | margin-bottom: | ||
| + | } | ||
| + | |||
| + | div.content_section_text ul, div.content_section_text li { | ||
| + | padding: 4px 8px 4px 16px; | ||
| + | } | ||
| + | |||
| + | div.section_header { | ||
| + | padding: 3px 6px 3px 6px; | ||
| + | |||
| + | background-color: | ||
| + | |||
| + | color: #FFFFFF; | ||
| + | font-weight: | ||
| + | font-size: 112%; | ||
| + | text-align: center; | ||
| + | } | ||
| + | |||
| + | div.section_header_red { | ||
| + | background-color: | ||
| + | } | ||
| + | |||
| + | div.section_header_grey { | ||
| + | background-color: | ||
| + | } | ||
| + | |||
| + | .floating_element { | ||
| + | position: relative; | ||
| + | float: left; | ||
| + | } | ||
| + | |||
| + | div.table_of_contents_item a, | ||
| + | div.content_section_text a { | ||
| + | text-decoration: | ||
| + | font-weight: | ||
| + | } | ||
| + | |||
| + | div.table_of_contents_item a:link, | ||
| + | div.table_of_contents_item a: | ||
| + | div.table_of_contents_item a:active { | ||
| + | color: #000000; | ||
| + | } | ||
| + | |||
| + | div.table_of_contents_item a:hover { | ||
| + | background-color: | ||
| + | |||
| + | color: #FFFFFF; | ||
| + | } | ||
| + | |||
| + | div.content_section_text a:link, | ||
| + | div.content_section_text a: | ||
| + | | ||
| + | background-color: | ||
| + | |||
| + | color: #000000; | ||
| + | } | ||
| + | |||
| + | div.content_section_text a:hover { | ||
| + | background-color: | ||
| + | |||
| + | color: #DCDFE6; | ||
| + | } | ||
| + | |||
| + | div.validator { | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | <div class=" | ||
| + | <div class=" | ||
| + | |||
| + | <a href=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | |||
| + | <div class=" | ||
| + | <div id=" | ||
| + | Curso de DO407-AUTOMATION WITH ANSIBLE I | ||
| + | </ | ||
| + | <div class=" | ||
| + | {% if ansible_distribution == " | ||
| + | |||
| + | <p> | ||
| + | Esta es la página de bienvenida predeterminada para probar el correcto funcionamiento del servidor Apache2 después de la instalación en los sistemas {{ ansible_distribution_version }}. Se basa en la página equivalente en centos. Si puede leer esta página, significa que el servidor HTTP Apache instalado en este sitio funciona correctamente. Debe reemplazar este archivo (ubicado en / | ||
| + | |||
| + | El usuario de configuración de este sitio web es ansible. El servidor desde donde se muestra este contenido es {{ ansible_hostname }} con la ip {{ ansible_default_ipv4.address }} por el puerto 80. You should < | ||
| + | < | ||
| + | </ | ||
| + | {% endif %} | ||
| + | |||
| + | </ | ||
| + | <div class=" | ||
| + | <div id=" | ||
| + | Datos del usuario {{ usuario }} | ||
| + | </ | ||
| + | <div class=" | ||
| + | <p> | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | |-- apache2.conf | ||
| + | | | ||
| + | |-- mods-enabled | ||
| + | | |-- *.load | ||
| + | | `-- *.conf | ||
| + | |-- conf-enabled | ||
| + | | `-- *.conf | ||
| + | |-- sites-enabled | ||
| + | | `-- *.conf | ||
| + | </ | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | file. It puts the pieces together by including all remaining configuration | ||
| + | files when starting up the web server. | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | < | ||
| + | main configuration file. It is used to determine the listening ports for | ||
| + | | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | | ||
| + | < | ||
| + | | ||
| + | | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | They are activated by symlinking available | ||
| + | | ||
| + | | ||
| + | by using our helpers | ||
| + | < | ||
| + | <a href=" | ||
| + | <a href=" | ||
| + | </ | ||
| + | < | ||
| + | <a href=" | ||
| + | <a href=" | ||
| + | </ | ||
| + | and | ||
| + | < | ||
| + | <a href=" | ||
| + | <a href=" | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | The binary is called apache2. Due to the use of | ||
| + | | ||
| + | | ||
| + | < | ||
| + | | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <div class=" | ||
| + | <div id=" | ||
| + | Document Roots | ||
| + | </ | ||
| + | |||
| + | <div class=" | ||
| + | <p> | ||
| + | By default, Ubuntu does not allow access through the web browser to | ||
| + | < | ||
| + | <a href=" | ||
| + | directories (when enabled) and < | ||
| + | applications). If your site is using a web document root | ||
| + | located elsewhere (such as in < | ||
| + | document root directory in < | ||
| + | </ | ||
| + | <p> | ||
| + | The default Ubuntu document root is < | ||
| + | can make your own virtual hosts under /var/www. This is different | ||
| + | to previous releases which provides better security out of the box. | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <div class=" | ||
| + | <div id=" | ||
| + | Reporting Problems | ||
| + | </ | ||
| + | <div class=" | ||
| + | <p> | ||
| + | Please use the < | ||
| + | Apache2 package with Ubuntu. However, check <a | ||
| + | href=" | ||
| + | bug reports</ | ||
| + | </ | ||
| + | <p> | ||
| + | Please report bugs specific to modules (such as PHP and others) | ||
| + | to respective packages, not to the web server itself. | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | <div class=" | ||
| + | <p> | ||
| + | <a href=" | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | <code yaml> | ||
| + | - hosts: clientes | ||
| + | remote_user: | ||
| + | vars: | ||
| + | system_owner: | ||
| + | usuario: Usuario-Berto | ||
| + | tasks: | ||
| + | - template: | ||
| + | src: / | ||
| + | dest: / | ||
| + | owner: root | ||
| + | group: root | ||
| + | mode: 0644 | ||
| + | - name: httpd is running and enabled | ||
| + | service: | ||
| + | name: httpd | ||
| + | state: restarted | ||
| + | </ | ||
| + | * listado de variables (ansible_facts):< | ||
| + | * [[https:// | ||
| + | |||
| + | == roles | ||
| + | <callout type=" | ||
| + | * ./Material Curso Ansible/ | ||
| + | * ./Material Curso Ansible/ | ||
| + | * ./Material Curso Ansible/ | ||
| + | </ | ||
| + | Los roles permiten organizar los playbooks y separarlos en ficheros más pequeños. Los roles proporcionan a Ansible una forma de utilizar tareas, handlers y variables desde archivos externos. Los archivos estáticos y las plantillas también se pueden asociar y hacer referencia mediante un rol. | ||
| + | |||
| + | * estructura | ||
| + | * defaults | ||
| + | * main.yml | ||
| + | * files | ||
| + | * handlers | ||
| + | * main.yml | ||
| + | * meta | ||
| + | * main.yml | ||
| + | * tasks | ||
| + | * main.yml | ||
| + | * templates | ||
| + | * tests | ||
| + | * inventory | ||
| + | * test.yml | ||
| + | * vars | ||
| + | * main.yml | ||
| + | * README.md | ||
| + | |||
| + | == ansible galaxy | ||
| + | <callout type=" | ||
| + | * ./Material Curso Ansible/ | ||
| + | * ./Material Curso Ansible/ | ||
| + | * [[https:// | ||
| + | </ | ||
| + | * [[https:// | ||
| + | <code bash> | ||
| + | ansible-galaxy role --help | ||
| + | ansible-galaxy install zaxos.tomcat-ansible-role | ||
| + | ansible-galaxy list | ||
| + | ansible-galaxy init | ||
| + | </ | ||
| + | <code yaml ; playbook-tomcat.yml> | ||
| + | --- | ||
| + | - hosts: clientes | ||
| + | user: root | ||
| + | become: true | ||
| + | vars: | ||
| + | tomcat_version: | ||
| + | |||
| + | tomcat_permissions_production: | ||
| + | |||
| + | tomcat_users: | ||
| + | - username: " | ||
| + | password: " | ||
| + | roles: " | ||
| + | - username: " | ||
| + | password: " | ||
| + | roles: " | ||
| + | roles: | ||
| + | - role: zaxos.tomcat-ansible-role | ||
| + | ... | ||
| + | </ | ||
| + | <callout type=" | ||
| + | * ./Material Curso Ansible/ | ||
| + | </ | ||
| + | * usar ansible para personalizar un docker-compose.yml que se lanzará en los ndoos destino | ||
| + | |||
| + | <callout type=" | ||
| + | * ./Material Curso Ansible/ | ||
| + | </ | ||
| + | |||
| + | == windows | ||
| + | <callout type=" | ||
| + | * ./Material Curso Ansible/ | ||
| + | * ./Material Curso Ansible/ | ||
| + | * ./Material Curso Ansible/ | ||
| + | * ./Material Curso Ansible/ | ||
| + | * [[https:// | ||
| + | * ./Material Curso Ansible/ | ||
| + | </ | ||
| + | |||
| + | * WinRM (protocolo en máquinas Windows desde W2012) | ||
| + | * https/5986, http/5985 | ||
| + | * .NET 4.0: < | ||
| + | * script ejecutar máquina windows para permitir conexión: **https:// | ||
| + | * Dependencia master ansible:< | ||
| + | * <code properties ; / | ||
| + | [win] | ||
| + | 192.168.1.46 | ||
| + | |||
| + | [win: | ||
| + | ansible_user=Administrador | ||
| + | ansible_password=Password, | ||
| + | ansible_connection=winrm | ||
| + | ansible_winrm_server_cert_validation=ignore | ||
| + | ansible_become_method=runas | ||
| + | ansible_become_user=Administrador | ||
| + | ... | ||
| + | </ | ||
| + | === chocolatey | ||
| + | * " | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | == ansible vault | ||
| + | <callout type=" | ||
| + | * ./Material Curso Ansible/ | ||
| + | * ./Material Curso Ansible/ | ||
| + | * ./Material Curso Ansible/ | ||
| + | </ | ||
| + | * Cifrar playbooks | ||
| + | * '' | ||
| + | * encrypt | ||
| + | * decrypt | ||
| + | * edit | ||
| + | * view | ||
| + | * encrypt_string: | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | == Extra | ||
| + | * [[https:// | ||
| + | * kubernetes: [[https:// | ||