User Tools

Site Tools


informatica:linux:docker:ansible

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
informatica:linux:docker:ansible [2017/07/04 14:35] joseinformatica:linux:docker:ansible [2019/09/09 13:54] (current) jose
Line 1: Line 1:
 +<code>
 +proyecto
 +├── inventories
 +│   ├── dev
 +│   │   ├── group_vars
 +│   │   ├── hosts
 +│   │   └── vars
 +│   ├── pre
 +│   │   ├── group_vars
 +│   │   ├── hosts
 +│   │   └── vars
 +│   └── pro
 +│       ├── group_vars
 +│       ├── hosts
 +│       └── vars
 +├── main.yml
 +└── roles
 +    └── create_user
 +        ├── README.md
 +        ├── defaults
 +        │   └── main.yml
 +        ├── files
 +        ├── handlers
 +        │   └── main.yml
 +        ├── meta
 +        │   └── main.yml
 +        ├── tasks
 +        │   └── main.yml
 +        ├── templates
 +        ├── tests
 +        │   ├── inventory
 +        │   └── test.yml
 +        └── vars
 +            └── main.yml
 +</code>
 +Cada role lo creamos con:
 +  ansible-galaxy init <role>
 +
 +
 +
 +
 https://serversforhackers.com/an-ansible-tutorial https://serversforhackers.com/an-ansible-tutorial
  
Line 72: Line 113:
  
 </code> </code>
 +
 +====== Tarea dependiente ======
 +Solo ejecuta la segunda tarea cuando ejecuta la primera. En este caso solo arranca nginx si lo instala:
 +<code>
 +- hosts: prueba
 +  tasks:
 +   - name: Install Nginx
 +     apt: pkg=nginx state=installed update_cache=true
 +     notify:
 +      - Start Nginx
 +
 +  handlers:
 +   - name: Start Nginx
 +     service: name=nginx state=started
 +</code>
 +
 +====== Login con usuario ======
 +Deshabilitamos la consulta del fingerprint
 +  # uncomment this to disable SSH key host checking
 +  host_key_checking = False
 +
 +
informatica/linux/docker/ansible.1499178908.txt.gz · Last modified: 2017/07/04 14:35 by jose