Managing Packages Flashcards

1
Q

Como se instala el paquete http en ansible

A
  • name: install http
    yum:
    name: httpd
    state: latest
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Como

Se actualizan todos los paquetes

A
  • name: update all packages
    yum:
    name: ‘*’
    state: latest
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Como

Se remueve un paquete

A
  • name: remove httpd
    yum:
    name: httpd
    state: absent
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Como

Se instalan las devolpment tools group

A
  • name: install dev
    yum:
    name: ‘@Development Tools’
    state: present
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Install perl app stream module

A
  • name: install perl app stream module
    yum:
    name: ‘@perl:5.6/minimal’
    state: present
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Como se colecta información de paquetes

A
—-
- name: display installed packages 
   hosts: servera
   tasks: 
        - name: gather info 
           package_facts: 
              manager: auto
     - name: List installed package
       debug:  
           msg: “Versión {{ ansible_facts.packages[‘NetworkManager’][0].version”
            when: “‘NetworkMager’ in ansible_favts.packages
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Instalación de multiplataforma con varios package managers

A

—-

  • name: install the required packages
    hosts: webservers
    tasks:
    - name: httpd on rhel
    yum:
    name: httpd
    state: present
    when: “ansible_distribution == ‘Redhat’”
          - name: httpd on Fedora 
             dnf:
                name: httpd 
                state: present 
              when: “ansible_distribution == ‘Fedora’”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Como se puede colocar que se instale el paquete independientemente del repo manager

A

—-

  • name: install required packages in the webservers
    hosts: webservers
    tasks:
    - name: install httpd
    package:
    name: httpd
    state: present
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Como se usa el redhat_subscription

A
- name: register the server
    redhat_subscription:
        username: “{{ user }}”
        password: “{{ pass }}”
        auto_attach: true
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Como se deshabilitan todos los repositorios

A
  • name: disable all repositories
    rhsm_repository:
    name: ‘*’
    state: disabled
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Como se coloca una condición donde solo cuando una variable tenga valor se ejecute un bloque

A

tasks:
block:

       - name: register
          redhat_susbscription:
             username: “{{ user }}”
             password: “{{ password “}

   when:  
      - cdn_username != “”
      - cdn_password != “”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Como se usa el modulo yum_repository

A
- name: define “{{ repo_name }}”
   yum_repository: 
      file: “{{ repo_name }}”
      name: “{{ repo_name }}”
      description: “{{ repo_desc }}”
      base_url: “{{ repo_ desc }}”
      pgpcheck: “{{ repo_gpgcheck }}”
      enabled: “{{ repo_enabled }}”
      state: present
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Como se copia la llave gpg para desplegar con módulo rpm_key

A
  • name: deploy the fog key
    rpm_key:
    key: http://materials/RPM-GPG-KEY-example
    state: present
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Playbook para crear usuario y grupos con reinicio de ssh al finalizar

A
  • name: play
    hosts: webservers
    vars_files:
    - vars/users_vars.ymlhandlers:
    - name: restart sshd
    service:
    name: sshd
    state: restartedtasks:
    - name: add we admin group
    group:
    name: wasasmin
    state: present
       - name: create users
          user:  
             name: user
             groups: webadmin 
           loop: “{{ users }}”
    
         - name: get authorized keys 
             authorized_keys: 
    
                 user:
    
                 key:  
              lookup: {{users}}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly