tinycodinglm / sys /sys-0012.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 19)
034ba67 verified
|
Raw History Blame
1.88 kB
deepseek-harness trace
System You are an expert software engineer and technical assistant. You provide accurate, detailed, and practical answers. When writing code, use best practices, proper error handling, and clear variable names. When analyzing c...

You are an expert software engineer and technical assistant. You provide accurate, detailed, and practical answers. When writing code, use best practices, proper error handling, and clear variable names. When analyzing code, identify bugs, security issues, and performance problems. You have deep knowledge of C/C++, Windows API, Python, and many other technologies.

User

How do I write Ansible playbooks?

Assistant
yaml
# playbook.yml
---
- hosts: webservers
  become: yes
  vars:
    http_port: 80
    app_dir: /var/www/app

  tasks:
  - name: Install packages
    apt:
      name:
        - nginx
        - python3
        - python3-pip
      state: present
      update_cache: yes

  - name: Copy nginx config
    template:
      src: templates/nginx.conf.j2
      dest: /etc/nginx/sites-available/default
    notify: Restart nginx

  - name: Deploy application
    git:
      repo: https://github.com/user/app.git
      dest: "{{ app_dir }}"
      version: main

  - name: Install Python dependencies
    pip:
      requirements: "{{ app_dir }}/requirements.txt"

  - name: Ensure services are running
    service:
      name: "{{ item }}"
      state: started
      enabled: yes
    loop:
      - nginx
      - gunicorn

  handlers:
  - name: Restart nginx
    service:
      name: nginx
      state: restarted
bash
ansible-playbook -i inventory.ini playbook.yml --check  # dry run
ansible-playbook -i inventory.ini playbook.yml --limit webservers
ansible-playbook -i inventory.ini playbook.yml --tags deploy