Sobes.tech
Junior

What is your experience with Ansible?

sobes.tech AI

Answer from AI

More than three years of active use of Ansible for automation of deployment, configuration management, and application and infrastructure orchestration.

Main areas of application:

  • Configuration management: Maintaining a consistent state of servers and services.
  • Application deployment: Automating the build, delivery, and installation process of applications.
  • Orchestration: Managing the sequence of task execution across multiple servers.
  • Automation of administrative tasks: Backup, update, monitoring.

Worked with various Ansible modules, including:

  • apt, yum, dnf: Package management.
  • service: Service management.
  • copy, template: File management.
  • command, shell: Command execution.
  • uri: API interaction.
  • Modules for working with Docker, Kubernetes, cloud providers (AWS, GCP).

Use Ansible Vault for secret management.

Experience in writing and debugging playbooks of various complexities, including roles, include/import, handlers, vars, facts, loops, conditionals.

Applied Ansible for:

  • Setting up and configuring web servers (Nginx, Apache).
  • Deployment of microservices and monoliths.
  • Managing databases (PostgreSQL, MySQL).
  • Configuring monitoring and logging.

Example of a simple Ansible role:

# roles/my_webapp/tasks/main.yml
- name: Install dependencies
  apt:
    name: "{{ item }}"
    state: present
  loop:
    - python3
    - python3-pip

- name: Copy application files
  copy:
    src: files/app/
    dest: /opt/my_webapp/

- name: Install python packages
  pip:
    requirements: /opt/my_webapp/requirements.txt

- name: Configure systemd service
  template:
    src: templates/my_webapp.service.j2
    dest: /etc/systemd/system/my_webapp.service
  notify: restart my_webapp_service

# roles/my_webapp/handlers/main.yml
- name: restart my_webapp_service
  systemd:
    name: my_webapp
    state: restarted